/* 
* Zero Dropout Dashboard - Exact Design Match
* Based on Reference Image
*/

:root {
    --sidebar-bg: #0f172a;
    --sidebar-active: #3b82f6;
    --body-bg: #f1f5f9;
    --card-bg: rgba(255, 255, 255, 0.95);
    --header-bg: #ffffff;
    --text-dark: #0f172a;
    --text-muted: #64748b;
    --blue: #2563eb;
    --blue-glow: rgba(37, 99, 235, 0.2);
    --green: #10b981;
    --green-glow: rgba(16, 185, 129, 0.2);
    --yellow: #f59e0b;
    --yellow-glow: rgba(245, 158, 11, 0.2);
    --navy: #1e3a8a;
    --gray: #e2e8f0;
    --white: #ffffff;
    --glass: rgba(255, 255, 255, 0.7);
    --radius: 16px;
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
    --border-color: #e2e8f0;
    --sidebar-text: #94a3b8;
}

[data-theme='dark'] {
    --body-bg: #0f172a;
    --card-bg: #1e293b;
    --header-bg: #1e293b;
    --text-dark: #f8fafc;
    --text-muted: #94a3b8;
    --gray: #334155;
    --white: #1e293b;
    --glass: rgba(15, 23, 42, 0.85);
    --border-color: #334155;
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: all 0.2s ease-out;
}

body {
    font-family: 'Sarabun', -apple-system, sans-serif;
    background: var(--body-bg);
    color: var(--text-dark);
    line-height: 1.6;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Prompt', sans-serif;
    font-weight: 600;
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--sidebar-bg);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.1);
}

.sidebar-brand {
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(255, 255, 255, 0.02);
}

.brand-logo-container {
    width: 100px;
    height: 100px;
    background: #ffffff;
    padding: 12px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

[data-theme='dark'] .brand-logo-container {
    background: rgba(255, 255, 255, 0.9);
}

.main-sidebar-logo {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.brand-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.brand-name {
    font-family: 'Prompt', sans-serif;
    font-weight: 700;
    font-size: 18px;
    letter-spacing: 1px;
    color: #ffffff;
}

.brand-subtitle {
    font-size: 10px;
    color: #94a3b8;
    margin-top: 4px;
    line-height: 1.4;
    max-width: 200px;
}

.sidebar-nav {
    padding: 20px 0;
    flex: 1;
    overflow-y: auto;
    /* Prevent pushing the user profile out of view */
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.section-title {
    display: block;
    font-size: 11px;
    color: var(--sidebar-text);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0 24px;
    margin-bottom: 12px;
    opacity: 0.7;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 24px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 15px;
    margin: 4px 12px;
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.nav-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background: var(--sidebar-active);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
    transform: translateX(4px);
}

.nav-link:hover::before {
    transform: scaleY(1);
}

.nav-link.active {
    background: var(--sidebar-active);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.nav-link.active::before {
    transform: scaleY(1);
}

.nav-link i {
    width: 20px;
    font-size: 16px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--card-bg);
    padding: 6px 14px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
    transition: all 0.3s ease;
}

.user-profile:hover {
    border-color: var(--blue);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.08);
}

.user-avatar {
    width: 34px;
    height: 34px;
    background: var(--blue);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.user-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.user-name {
    font-weight: 700;
    font-size: 13px;
    color: var(--text-dark);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.user-role {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 500;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.logout-mini-btn {
    color: #ef4444;
    font-size: 16px;
    margin-left: 4px;
    padding: 6px;
    border-radius: 8px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logout-mini-btn:hover {
    background: #fee2e2;
    transform: scale(1.1);
}

.login-btn-premium {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--blue);
    color: white !important;
    text-decoration: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Prompt', sans-serif;
}

.login-btn-premium:hover {
    background: #1d4ed8;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.3);
}

.login-btn-premium i {
    font-size: 16px;
}


/* Main Content */
.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 10px 40px 40px;
    /* Shifted up to reduce top whitespace */
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0;
    margin-bottom: 32px;
}

.page-header.box-mode {
    background: var(--card-bg);
    padding: 24px 32px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    margin-bottom: 32px;
}

.header-left h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-dark);
    margin-top: 0;
    /* Reset browser default */
    margin-bottom: 8px;
}

.header-subtitle {
    color: var(--text-muted);
    font-size: 14px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.date-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-muted);
}

.btn-create {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--navy);
    color: white;
    border: none;
    border-radius: 8px;
    font-family: 'Prompt';
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-create:hover {
    background: #1e40af;
}

/* Filter Bar */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 24px;
    background: var(--card-bg);
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-group label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

.form-select {
    padding: 10px 16px;
    min-width: 160px;
    border: 1px solid var(--gray);
    border-radius: 8px;
    background: var(--card-bg);
    font-family: 'Sarabun';
    font-size: 14px;
    color: var(--text-dark);
    cursor: pointer;
}

/* Tom Select Styling Customization */
.ts-wrapper .ts-control {
    border: 1px solid var(--border-color) !important;
    border-radius: 10px !important;
    padding: 10px 14px !important;
    font-family: 'Sarabun', sans-serif !important;
    font-size: 14px !important;
    background: var(--card-bg) !important;
    color: var(--text-dark) !important;
    box-shadow: none !important;
    min-height: 42px;
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
}

.ts-wrapper.focus .ts-control {
    border-color: var(--blue) !important;
    box-shadow: 0 0 0 4px var(--blue-glow) !important;
}

.ts-wrapper .ts-dropdown {
    border: 1px solid var(--border-color) !important;
    border-radius: 12px !important;
    box-shadow: var(--shadow) !important;
    margin-top: 8px !important;
    padding: 8px !important;
    background: var(--card-bg) !important;
    color: var(--text-dark) !important;
    backdrop-filter: blur(10px);
    z-index: 1000 !important;
}

.ts-dropdown .option {
    padding: 10px 15px !important;
    border-radius: 8px !important;
    font-family: 'Sarabun', sans-serif !important;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ts-dropdown .active {
    background: var(--blue-glow) !important;
    color: var(--blue) !important;
}

.ts-dropdown .option input[type="checkbox"] {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 1.5px solid var(--border-color);
    cursor: pointer;
    background: var(--white);
    transition: all 0.2s ease;
}

.ts-dropdown .option.selected input[type="checkbox"] {
    background: var(--blue);
    border-color: var(--blue);
}

.ts-dropdown .option.selected {
    background: var(--blue-glow) !important;
    color: var(--blue) !important;
    font-weight: 500;
}

.ts-wrapper .ts-control .item {
    background: var(--blue-glow) !important;
    color: var(--blue) !important;
    border: 1px solid rgba(59, 130, 246, 0.2) !important;
    border-radius: 6px !important;
    padding: 2px 8px !important;
    font-size: 13px !important;
    font-weight: 500;
}

.ts-wrapper.multi .ts-control > div {
    margin: 3px 6px 3px 0 !important;
}

.ts-dropdown .dropdown-input-wrap {
    padding: 8px !important;
    border-bottom: 1px solid var(--border-color) !important;
}

.ts-dropdown .dropdown-input {
    border-radius: 8px !important;
    border: 1px solid var(--border-color) !important;
    padding: 8px 12px !important;
    font-family: 'Sarabun' !important;
}

/* Theme Toggle Button */
.theme-toggle-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-toggle-btn:hover {
    color: var(--blue);
    border-color: var(--blue);
    background: var(--blue-glow);
    transform: rotate(15deg);
}

[data-theme='dark'] .fa-moon {
    display: none;
}

[data-theme='light'] .fa-sun {
    display: none;
}

/* Action Buttons */
.btn-export {
    height: 42px;
    padding: 10px 20px;
    border-radius: 10px;
    border: 1px solid #10b981;
    background: var(--card-bg);
    color: #10b981;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
    font-family: 'Prompt';
    font-size: 14px;
}

.btn-export:hover {
    background: #10b981 !important;
    color: white !important;
}

.btn-print {
    height: 42px;
    padding: 10px 20px;
    border-radius: 10px;
    border: 1px solid #3b82f6;
    background: var(--card-bg);
    color: #3b82f6;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
    font-family: 'Prompt';
    font-size: 14px;
}

.btn-print:hover {
    background: #3b82f6 !important;
    color: white !important;
}

.btn-reset {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 42px;
    padding: 0 16px;
    background: var(--card-bg);
    color: var(--text-muted);
    border-radius: 10px;
    border: 1px solid var(--border-color);
    text-decoration: none;
    transition: all 0.2s;
    font-family: 'Prompt';
    font-size: 14px;
}

.btn-reset:hover {
    background: var(--gray);
    color: var(--text-dark);
}

.badge-danger-soft {
    background: #fff1f2;
    color: #e11d48;
    border: 1px solid #fecdd3;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
}

[data-theme='dark'] .badge-danger-soft {
    background: rgba(225, 29, 72, 0.15) !important;
    color: #fb7185 !important;
    border-color: rgba(225, 29, 72, 0.3) !important;
}

.ts-wrapper .ts-control .item {
    font-size: 14px !important;
}

.info-box-soft {
    background: linear-gradient(135deg, #eff6ff, #f0f9ff);
    border: 1px solid #bfdbfe;
    color: #1e40af;
    padding: 20px;
    border-radius: 16px;
    margin-top: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
}

[data-theme='dark'] .info-box-soft {
    background: rgba(59, 130, 246, 0.1) !important;
    border-color: rgba(59, 130, 246, 0.2) !important;
    color: #93c5fd !important;
}

.info-box-danger {
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    border-left: 4px solid #ef4444;
    color: #991b1b;
}

[data-theme='dark'] .info-box-danger {
    background: rgba(239, 68, 68, 0.1) !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
    color: #fca5a5 !important;
}

.info-box-warning {
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    border-left: 4px solid #f59e0b;
    color: #92400e;
}

[data-theme='dark'] .info-box-warning {
    background: rgba(245, 158, 11, 0.1) !important;
    border-color: rgba(245, 158, 11, 0.3) !important;
    color: #fcd34d !important;
}

/* Action Buttons Alignment */
.filter-actions-group {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    margin-left: auto;
}

.btn-filter {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--blue);
    color: white;
    border: none;
    border-radius: 8px;
    font-family: 'Prompt';
    font-size: 14px;
    cursor: pointer;
    margin-left: auto;
}

.btn-filter:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
}

.btn-reset:hover {
    background: var(--gray);
    color: var(--text-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

/* Modern Premium Stats Layout */
.modern-stats-wrapper {
    display: flex;
    flex-direction: column;
    gap: 32px;
    margin-bottom: 40px;
}

.stat-group {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.group-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-left: 4px;
}

.group-header h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.group-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.group-indicator.all {
    background: var(--blue);
    box-shadow: 0 0 10px var(--blue-glow);
}

.group-indicator.thai {
    background: #7c4dff;
    box-shadow: 0 0 10px rgba(124, 77, 255, 0.4);
}

.group-indicator.foreign {
    background: #1e293b;
    box-shadow: 0 0 10px rgba(30, 41, 59, 0.4);
}

.stats-flex-container {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
}

.premium-card-v2 {
    background: var(--card-bg);
    /* Adaptive background */
    border-radius: 14px;
    /* Slimmer look with tighter corners */
    padding: 12px 16px;
    /* Reduced padding */
    position: relative;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 4px;
    /* Tighter gap for slim look */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.premium-card-v2:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 35px -10px rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.2);
}

.card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.card-icon-v2 {
    width: 32px;
    /* Smaller icon */
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.premium-card-v2.main .card-icon-v2 {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

.premium-card-v2.success .card-icon-v2 {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.premium-card-v2.warning .card-icon-v2 {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}

.premium-card-v2.danger .card-icon-v2 {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.premium-card-v2.info .card-icon-v2 {
    background: rgba(14, 165, 233, 0.2);
    color: #7dd3fc;
}

.v2-label {
    font-size: 11px;
    /* Smaller label */
    color: var(--text-muted);
    /* Adaptive text color */
    font-weight: 500;
}

.v2-value-wrap {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.v2-value {
    font-size: 20px;
    /* Smaller value */
    font-weight: 700;
    color: var(--text-dark);
    /* Adaptive text color */
}

.v2-unit {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
}

/* Progress Bars */
.v2-progress-inner.blue {
    background: linear-gradient(90deg, #60a5fa, #3b82f6);
}

.v2-progress-inner.green {
    background: linear-gradient(90deg, #34d399, #10b981);
}

.v2-progress-inner.yellow {
    background: linear-gradient(90deg, #fcd34d, #f59e0b);
}

.v2-progress-inner.red {
    background: linear-gradient(90deg, #f87171, #ef4444);
}

.v2-progress-inner.info {
    background: linear-gradient(90deg, #7dd3fc, #0ea5e9);
}

/* Compact Card Variant */
.premium-card-v2.compact {
    padding: 12px 16px;
    gap: 6px;
}

.premium-card-v2.compact .v2-label {
    font-size: 11px;
}

.premium-card-v2.compact .v2-value {
    font-size: 18px;
}

.premium-card-v2.compact .card-icon-v2 {
    width: 30px;
    height: 30px;
    font-size: 13px;
    border-radius: 8px;
}

.v2-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 10px;
    /* Unified small size */
    margin-top: 2px;
}

.premium-card-v2.compact .v2-footer {
    font-size: 10px;
    /* Keep it equal */
}

.v2-percent,
.v2-meta {
    font-size: 10px;
}

/* Adjust Grid for Compact Cards */
.stats-flex-container {
    display: grid;
    grid-template-columns: 1.2fr 1fr 1fr 0.8fr 0.8fr;
    gap: 16px;
}

@media (max-width: 1400px) {
    .stats-flex-container {
        grid-template-columns: repeat(3, 1fr);
    }
}

.v2-percent {
    color: var(--text-dark);
    /* Adaptive percentage color */
}

.v2-meta {
    color: var(--text-muted);
}

/* Specific Card variants for "Thai" and "Foreign" rows */
.premium-card-v2.accent-thai {
    border-left: 4px solid #7c4dff;
}

.premium-card-v2.accent-foreign {
    border-left: 4px solid #1e293b;
}

@media (max-width: 1400px) {
    .stats-flex-container {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 900px) {
    .stats-flex-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .stats-flex-container {
        grid-template-columns: 1fr;
    }
}

/* Top Summary Charts Grid */
.top-charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 32px;
    margin-bottom: 48px;
}

.top-charts-grid .chart-card {
    min-height: 200px;
    border-radius: 24px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.top-charts-grid .chart-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.06);
    border-color: rgba(79, 70, 229, 0.2);
}

.top-charts-grid .chart-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-dark);
}

.top-charts-grid .chart-header i {
    color: #4f46e5;
    margin-right: 10px;
}

/* Premium Donut Layout */
.donut-container-mini {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 40px;
    gap: 60px;
}

.donut-wrapper-mini {
    width: 140px;
    height: 140px;
    position: relative;
    flex-shrink: 0;
}

.donut-legend-mini {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex-grow: 1;
}

.legend-item-mini {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: 'Prompt', sans-serif;
}

.legend-dot-mini {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.label-mini {
    color: var(--text-dark);
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
}

.value-mini {
    color: var(--text-dark);
    font-size: 15px;
    font-weight: 700;
    margin-left: auto;
}

.comparison-chart .chart-body {
    height: 150px;
}

@media (max-width: 1400px) {
    .charts-row {
        grid-template-columns: 1fr 1fr;
    }

    .chart-card.large {
        grid-column: span 2;
    }
}

@media (max-width: 900px) {
    .charts-row {
        grid-template-columns: 1fr;
    }

    .chart-card.large {
        grid-column: span 1;
    }
}

.chart-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.chart-card.large {
    min-height: 350px;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.chart-header h3 {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chart-header h3 i {
    color: var(--blue);
}

.btn-icon {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 6px;
}

.btn-icon:hover {
    background: #f1f5f9;
}

.chart-body {
    padding: 10px;
    /* height: 280px;  <-- เอาออก ให้ Wrapper จัดการ */
}

/* Wrapper สำหรับ Bar Chart */
.chart-wrapper {
    position: relative;
    height: 300px;
    width: 100%;
}

/* Wrapper สำหรับ Donut Chart (ต้องเล็กกว่า) */
.donut-wrapper {
    position: relative;
    height: 180px;
    /* กำหนดความสูงตายตัว */
    width: 180px;
    /* กำหนดความกว้างตายตัว เพื่อไม่ให้เบี้ยว */
    margin: 0 auto;
    /* จัดกึ่งกลาง */
}

/* Container รวมสำหรับ Donut + Legend */
.donut-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.donut-legend {
    width: 100%;
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

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

.legend-dot.green {
    background: var(--green);
}

.legend-dot.yellow {
    background: var(--yellow);
}

.legend-dot.blue {
    background: var(--blue);
}

.legend-dot.gray {
    background: var(--gray);
}

.legend-label {
    flex: 1;
    font-size: 14px;
    color: var(--text-muted);
}

.legend-value {
    font-weight: 600;
    font-size: 14px;
}

/* ==========================================================
   RESPONSIVE DESIGN SYSTEM - Mobile-First Approach
   Breakpoints:
   - Mobile  : <= 576px
   - Tablet  : 577px - 992px
   - Desktop : >= 993px
   ========================================================== */

/* --- Global Responsive Resets --- */
img, video, canvas, iframe {
    max-width: 100%;
    height: auto;
}

/* Prevent horizontal overflow globally */
html, body {
    max-width: 100%;
    overflow-x: hidden;
}

/* Tables: horizontal scroll on small screens */
.table-responsive-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
}

/* Touch-friendly buttons */
.btn-filter, .btn-export, .btn-print, .btn-create, .btn-reset {
    min-height: 44px;
    min-width: 44px;
}

/* --- Hamburger Button --- */
.hamburger-btn {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 200;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 10px;
    background: var(--sidebar-bg);
    cursor: pointer;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.hamburger-btn:hover {
    background: #1e293b;
    transform: scale(1.05);
}

.hamburger-line {
    display: block;
    width: 22px;
    height: 2px;
    background: #ffffff;
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
}

/* Hamburger → X animation */
.hamburger-btn.active .hamburger-line:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.hamburger-btn.active .hamburger-line:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.hamburger-btn.active .hamburger-line:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* --- Sidebar Overlay --- */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 99;
    backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
}

/* ============================================================
   DESKTOP (>= 993px) — default layout
   ============================================================ */
@media (min-width: 993px) {
    .hamburger-btn {
        display: none !important;
    }
    .sidebar-overlay {
        display: none !important;
    }
    .sidebar {
        transform: translateX(0) !important;
    }
}

/* ============================================================
   TABLET (577px - 992px)
   ============================================================ */
@media (max-width: 992px) {
    /* Show hamburger button */
    .hamburger-btn {
        display: flex;
    }

    /* Sidebar off-canvas by default */
    .sidebar {
        transform: translateX(-100%);
        z-index: 150;
        transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    }

    /* Sidebar open state */
    .sidebar.sidebar-open {
        transform: translateX(0);
    }

    /* Show overlay when sidebar is open */
    .sidebar-open ~ .sidebar-overlay,
    .sidebar-overlay.active {
        display: block;
    }

    /* Main content takes full width */
    .main-content {
        margin-left: 0;
        padding: 16px;
        padding-top: 70px; /* space for hamburger button */
    }

    /* Page header adjustments */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .page-header.box-mode {
        padding: 16px 20px;
    }

    .header-left h1 {
        font-size: 22px;
    }

    .header-right {
        width: 100%;
        flex-wrap: wrap;
        gap: 8px;
    }

    /* Stats grid */
    .stats-flex-container {
        grid-template-columns: repeat(3, 1fr) !important;
    }

    /* Charts */
    .top-charts-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .charts-row {
        grid-template-columns: 1fr;
    }

    .chart-card.large {
        grid-column: span 1;
    }

    /* Filter bar wraps */
    .filter-bar {
        flex-direction: column;
        gap: 12px;
    }

    .filter-group {
        width: 100%;
    }

    .form-select {
        width: 100%;
        min-width: unset;
    }

    .filter-actions-group {
        width: 100%;
        margin-left: 0;
        flex-wrap: wrap;
    }

    .filter-actions-group .btn-filter,
    .filter-actions-group .btn-export,
    .filter-actions-group .btn-print {
        flex: 1;
        justify-content: center;
    }

    /* Table horizontal scroll */
    .report-table-container,
    .province-report-card > table,
    .province-report-card .report-table {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        display: block;
        width: 100%;
    }

    /* Calendar popover repositioning */
    .calendar-popover {
        right: auto;
        left: 0;
        width: 300px;
    }

    /* Accordion */
    .sub-cause-list {
        padding: 0 12px 16px 16px;
    }

    .cat-icon-box {
        width: 36px;
        height: 36px;
        font-size: 15px;
    }

    /* User profile in header */
    .user-name {
        max-width: 130px;
    }

    .user-role {
        max-width: 130px;
    }

    /* Date badge text hide on small tablet */
    .date-badge span {
        display: none;
    }

    /* Stats cards */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================================
   MOBILE (<= 576px)
   ============================================================ */
@media (max-width: 576px) {
    /* Typography */
    body {
        font-size: 14px;
    }

    .header-left h1 {
        font-size: 18px;
    }

    .header-subtitle {
        font-size: 12px;
    }

    /* Main content */
    .main-content {
        padding: 12px;
        padding-top: 68px;
    }

    /* Page header */
    .page-header.box-mode {
        padding: 14px 16px;
        border-radius: 12px;
        margin-bottom: 16px;
    }

    /* Stats: single column */
    .stats-flex-container {
        grid-template-columns: repeat(2, 1fr) !important;
    }

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

    /* Chart cards */
    .chart-card {
        padding: 16px;
        border-radius: 12px;
    }

    .chart-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .chart-header h3 {
        font-size: 14px;
    }

    /* Donut chart layout */
    .donut-container-mini {
        flex-direction: column;
        gap: 16px;
        padding: 16px;
    }

    /* Filter bar */
    .filter-bar {
        padding: 14px;
        border-radius: 10px;
    }

    /* Accordion */
    .accordion-header {
        padding: 12px 14px;
    }

    .header-main {
        gap: 10px;
    }

    .cat-name {
        font-size: 13px;
    }

    .cat-count, .cat-share {
        font-size: 11px;
    }

    /* Hide mini progress bar on mobile */
    .mini-progress-container {
        display: none;
    }

    /* Table card-mode: auto wrapping */
    .report-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Calendar popover full-width */
    .calendar-popover {
        width: calc(100vw - 32px);
        left: 50%;
        transform: translateX(-50%);
        right: auto;
    }

    /* User info hide role on mobile */
    .user-role {
        display: none;
    }

    .user-name {
        max-width: 100px;
        font-size: 12px;
    }

    .user-avatar {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }

    /* Premium cards */
    .premium-card-v2 {
        padding: 10px 12px;
    }

    .v2-value {
        font-size: 16px;
    }

    .v2-label {
        font-size: 10px;
    }

    /* Cause details */
    .cause-details-section {
        padding: 16px;
        border-radius: 14px;
    }

    .modern-section-title {
        font-size: 15px;
    }

    /* Info boxes */
    .info-box-soft {
        flex-direction: column;
        gap: 10px;
        padding: 14px;
    }

    /* Action buttons stack */
    .filter-actions-group {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .btn-filter {
        grid-column: 1 / -1;
    }

    /* Login button */
    .login-btn-premium span {
        display: none;
    }

    .login-btn-premium {
        padding: 10px;
        border-radius: 10px;
    }

    /* Table footer legend */
    .table-footer-legend {
        flex-direction: column;
        gap: 8px;
        padding: 12px;
    }

    /* Hamburger position */
    .hamburger-btn {
        top: 12px;
        left: 12px;
        width: 40px;
        height: 40px;
    }
}

/* ============================================================
   LARGE DESKTOP ONLY (>= 1400px)
   ============================================================ */
@media (min-width: 1400px) {
    .stats-flex-container {
        grid-template-columns: 1.2fr 1fr 1fr 0.8fr 0.8fr;
    }
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--glass);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.loading-overlay.active {
    display: flex;
}

.loading-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 24px;
}

.loader {
    --path: #2F3545;
    --dot: #5628EE;
    --duration: 3s;
    width: 44px;
    height: 44px;
    position: relative;
    display: inline-block;
    margin: 0 16px;
}

.loader:before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    position: absolute;
    display: block;
    background: var(--dot);
    top: 37px;
    left: 19px;
    transform: translate(-18px, -18px);
    animation: dotRect var(--duration) cubic-bezier(0.785, 0.135, 0.15, 0.86) infinite;
}

.loader svg {
    display: block;
    width: 100%;
    height: 100%;
}

.loader svg rect,
.loader svg polygon,
.loader svg circle {
    fill: none;
    stroke: var(--path);
    stroke-width: 10px;
    stroke-linejoin: round;
    stroke-linecap: round;
}

.loader svg polygon {
    stroke-dasharray: 145 76 145 76;
    stroke-dashoffset: 0;
    animation: pathTriangle var(--duration) cubic-bezier(0.785, 0.135, 0.15, 0.86) infinite;
}

.loader svg rect {
    stroke-dasharray: 192 64 192 64;
    stroke-dashoffset: 0;
    animation: pathRect 3s cubic-bezier(0.785, 0.135, 0.15, 0.86) infinite;
}

.loader svg circle {
    stroke-dasharray: 150 50 150 50;
    stroke-dashoffset: 75;
    animation: pathCircle var(--duration) cubic-bezier(0.785, 0.135, 0.15, 0.86) infinite;
}

.loader.triangle {
    width: 48px;
}

.loader.triangle:before {
    left: 21px;
    transform: translate(-10px, -18px);
    animation: dotTriangle var(--duration) cubic-bezier(0.785, 0.135, 0.15, 0.86) infinite;
}

@keyframes pathTriangle {
    33% {
        stroke-dashoffset: 74;
    }

    66% {
        stroke-dashoffset: 147;
    }

    100% {
        stroke-dashoffset: 221;
    }
}

@keyframes dotTriangle {
    33% {
        transform: translate(0, 0);
    }

    66% {
        transform: translate(10px, -18px);
    }

    100% {
        transform: translate(-10px, -18px);
    }
}

@keyframes pathRect {
    25% {
        stroke-dashoffset: 64;
    }

    50% {
        stroke-dashoffset: 128;
    }

    75% {
        stroke-dashoffset: 192;
    }

    100% {
        stroke-dashoffset: 256;
    }
}

@keyframes dotRect {
    25% {
        transform: translate(0, 0);
    }

    50% {
        transform: translate(18px, -18px);
    }

    75% {
        transform: translate(0, -36px);
    }

    100% {
        transform: translate(-18px, -18px);
    }
}

@keyframes pathCircle {
    25% {
        stroke-dashoffset: 125;
    }

    50% {
        stroke-dashoffset: 175;
    }

    75% {
        stroke-dashoffset: 225;
    }

    100% {
        stroke-dashoffset: 275;
    }
}

.loading-text {
    font-family: 'Prompt';
    font-weight: 600;
    letter-spacing: 1px;
    color: var(--text-dark);
}

/* --- Cause Details Table Premium Styles --- */
.v-middle td {
    vertical-align: middle !important;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.cause-row {
    transition: all 0.2s;
}

.cause-row:hover {
    background-color: rgba(248, 250, 252, 0.8) !important;
}

.code-badge {
    display: inline-block;
    padding: 2px 8px;
    background: #f1f5f9;
    color: #475569;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    font-family: 'Prompt';
}

.category-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.category-pill i {
    font-size: 10px;
}

/* Category Colors */
.cat-personal {
    background: rgba(99, 102, 241, 0.1);
    color: #4f46e5;
}

.cat-health {
    background: rgba(236, 72, 153, 0.1);
    color: #db2777;
}

.cat-family {
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
}

.cat-social {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
}

.cat-school {
    background: rgba(59, 130, 246, 0.1);
    color: #2563eb;
}

.cat-success {
    background: rgba(139, 92, 246, 0.1);
    color: #7c3aed;
}

.cat-tracking {
    background: rgba(100, 116, 139, 0.1);
    color: #475569;
}

.cat-other {
    background: rgba(148, 163, 184, 0.1);
    color: #64748b;
}

.cause-text {
    font-size: 14px;
    color: #1e293b;
    line-height: 1.5;
    max-width: 400px;
}

.highlight-value {
    font-family: 'Prompt';
    font-weight: 700;
    font-size: 16px;
    color: var(--navy);
}

.percent-text {
    font-size: 13px;
    color: #64748b;
    font-weight: 500;
}

/* Premium Progress Bar */
.progress-premium {
    height: 10px;
    background: #f1f5f9;
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

.progress-bar-inner {
    height: 100%;
    border-radius: 20px;
    position: relative;
    transition: width 1s cubic-bezier(0.1, 0.5, 0.3, 1);
}

/* Background overrides for progress bars (Solid colors) */
.progress-bar-inner.cat-personal {
    background: #6366f1;
}

.progress-bar-inner.cat-health {
    background: #ec4899;
}

.progress-bar-inner.cat-family {
    background: #f59e0b;
}

.progress-bar-inner.cat-social {
    background: #10b981;
}

.progress-bar-inner.cat-school {
    background: #3b82f6;
}

.progress-bar-inner.cat-success {
    background: #8b5cf6;
}

.progress-bar-inner.cat-tracking {
    background: #64748b;
}

.progress-shimmer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
            rgba(255, 255, 255, 0) 0%,
            rgba(255, 255, 255, 0.3) 50%,
            rgba(255, 255, 255, 0) 100%);
    animation: shimmer 2s infinite linear;
    transform: translateX(-100%);
}

@keyframes shimmer {
    100% {
        transform: translateX(100%);
    }
}

/* Empty State */
.empty-state {
    padding: 60px !important;
}

.empty-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #94a3b8;
}

.empty-content i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* Table Footer Legend */
.table-footer-legend {
    padding: 20px;
    border-top: 1px solid #f1f5f9;
    background: #fcfcfd;
    display: flex;
    align-items: center;
    gap: 20px;
}

.legend-title {
    font-size: 13px;
    font-weight: 700;
    color: #64748b;
    white-space: nowrap;
}

.legend-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 600;
}

/* Grouped Table Styles */
.category-header-row {
    background-color: #f8fafc !important;
}

.category-header-content {
    display: flex;
    align-items: center;
    padding: 8px 0;
}

.category-pill.large {
    padding: 8px 20px;
    font-size: 14px;
    font-weight: 700;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.category-total {
    font-family: 'Prompt';
    font-weight: 800;
    font-size: 15px;
    color: #1e293b;
}

.category-percent {
    font-weight: 700;
    color: var(--navy);
}

.child-row {
    background-color: transparent !important;
}

.child-row td:nth-child(3) {
    padding-left: 20px;
}

.highlight-value.small {
    font-size: 14px;
}

.percent-text.small {
    font-size: 12px;
}

.progress-premium.thin {
    height: 6px;
}

.opacity-50 {
    opacity: 0.6;
}

.cause-text {
    font-size: 13px;
    color: #475569;
}

/* Ensure empty state spans all columns */
.empty-state {
    text-align: center;
    padding: 50px !important;
}

/* --- Cause Details Visual Accordion Styles --- */
.cause-details-section {
    background: var(--card-bg);
    padding: 24px;
    border-radius: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.modern-section-title {
    font-size: 18px;
    margin-bottom: 4px;
}

.section-subtitle {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 24px;
}

.cause-accordion {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.accordion-item {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.accordion-item:hover {
    border-color: #e2e8f0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.accordion-header {
    padding: 16px 20px;
    background: var(--card-bg);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
    color: var(--text-dark);
}

/* Print header - hidden on screen */
.print-header {
    display: none;
}

.accordion-header:hover {
    background: var(--body-bg);
}

.header-main {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
}

.cat-icon-box {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

/* Category Colors for Accordion */
.cat-icon-box.cat-personal {
    background: rgba(99, 102, 241, 0.1);
    color: #4f46e5;
}

.cat-icon-box.cat-health {
    background: rgba(236, 72, 153, 0.1);
    color: #db2777;
}

.cat-icon-box.cat-family {
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
}

.cat-icon-box.cat-social {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
}

.cat-icon-box.cat-school {
    background: rgba(59, 130, 246, 0.1);
    color: #2563eb;
}

.cat-icon-box.cat-success {
    background: rgba(139, 92, 246, 0.1);
    color: #7c3aed;
}

.cat-icon-box.cat-tracking {
    background: rgba(100, 116, 139, 0.1);
    color: #475569;
}

.cat-info {
    display: flex;
    flex-direction: column;
}

.cat-name {
    font-family: 'Prompt';
    font-weight: 600;
    font-size: 15px;
    color: var(--text-dark);
}

.cat-stats-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cat-count {
    font-size: 13px;
    color: #64748b;
}

.cat-share {
    font-size: 12px;
    color: #94a3b8;
    font-weight: 500;
}

.cat-separator {
    color: #e2e8f0;
    font-size: 10px;
}

.header-visual {
    display: flex;
    align-items: center;
    gap: 20px;
}

.mini-progress-container {
    width: 120px;
    height: 6px;
    background: #f1f5f9;
    border-radius: 10px;
    overflow: hidden;
}

.mini-progress-bar {
    height: 100%;
    border-radius: 10px;
}

/* Mini Progress Colors */
.mini-progress-bar.cat-personal {
    background: #6366f1;
}

.mini-progress-bar.cat-health {
    background: #ec4899;
}

.mini-progress-bar.cat-family {
    background: #f59e0b;
}

.mini-progress-bar.cat-social {
    background: #10b981;
}

.mini-progress-bar.cat-school {
    background: #3b82f6;
}

.mini-progress-bar.cat-success {
    background: #8b5cf6;
}

.mini-progress-bar.cat-tracking {
    background: #64748b;
}

.chevron-icon {
    font-size: 14px;
    color: #cbd5e1;
    transition: transform 0.3s ease;
}

.accordion-item.active {
    border-color: #3b82f6;
    box-shadow: 0 10px 20px -5px rgba(59, 130, 246, 0.1);
}

.accordion-item.active .chevron-icon {
    transform: rotate(180deg);
    color: #3b82f6;
}

.accordion-item.active .accordion-header {
    background: var(--body-bg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out;
    background: var(--card-bg);
}

.accordion-item.active .accordion-content {
    max-height: 800px;
}

.sub-cause-list {
    padding: 0 20px 20px 80px;
    display: flex;
    flex-direction: column;
}

.list-header {
    display: flex;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sub-cause-item {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px dashed var(--border-color);
    font-size: 13px;
}

.sub-cause-item:last-child {
    border-bottom: none;
}

.sub-code {
    width: 60px;
    font-weight: 700;
    color: #64748b;
    font-family: 'Prompt';
}

.sub-text {
    color: var(--text-dark);
}

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

.sub-value small {
    color: #94a3b8;
    font-weight: 400;
}

.no-data-card {
    padding: 40px;
    text-align: center;
    background: #f8fafc;
    border-radius: 12px;
    color: #94a3b8;
}

.no-data-card i {
    font-size: 32px;
    margin-bottom: 12px;
}

.report-table-container {
    max-height: 500px;
    overflow-y: auto;
    position: relative;
}

.report-table {
    width: 100%;
    border-collapse: collapse;
}

.report-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.report-table thead th {
    background: var(--body-bg);
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    color: var(--text-dark);
}

.report-table th,
.report-table td {
    text-align: center;
    vertical-align: middle;
}

.report-table th.col-province,
.report-table td.col-province {
    text-align: left;
}


.province-report-card {
    background: var(--card-bg);
    padding: 24px;
    border-radius: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 32px;
    border: 1px solid var(--border-color);
}

/* Button Expand (Plus/Minus) */
.btn-expand {
    background: transparent;
    border: none;
    color: var(--blue);
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    margin-right: 4px;
    transition: transform 0.2s ease;
}

.btn-expand:hover {
    color: #1d4ed8;
    transform: scale(1.1);
}



.level-province {
    font-weight: 600;
}

/* Update for specific column alignment */
.col-progress {
    width: 20%;
    vertical-align: middle;
}

/* Data Bar Style */
.data-bar-wrapper {
    position: relative;
    width: 100%;
    min-height: 24px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

/* Data Bar Colors */
.data-bar-province {
    background-color: #dcfce7;
    /* Light green */
}

.data-text-province {
    color: #15803d;
    /* Green text */
}

.data-bar-district {
    background-color: #dbeafe;
    /* Light blue */
}

.data-text-district {
    color: #1d4ed8;
    /* Blue text */
}

.data-bar-subdistrict {
    background-color: #ffedd5;
    /* Light orange/brown */
}

.data-text-subdistrict {
    color: #c2410c;
    /* Brown/Orange text */
}

.data-bar {
    position: absolute;
    left: 0;
    top: 4px;
    bottom: 4px;
    border-radius: 4px;
    z-index: 0;
}

.data-text {
    position: relative;
    z-index: 1;
    font-size: 11px;
    font-weight: 600;
    margin-right: 4px;
}

/* Calendar Popover */
.date-badge {
    position: relative;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s;
    z-index: 50;
    /* Ensure it stays above content */
}

.date-badge:hover {
    background: var(--body-bg);
    border-color: var(--border-color);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.date-badge:active {
    transform: translateY(0);
}

.calendar-popover {
    position: absolute;
    top: 120%;
    right: 0;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--shadow);
    width: 380px;
    z-index: 9999;
    padding: 0;
    display: none;
    animation: slideDown 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

.calendar-popover.active {
    display: block;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--body-bg);
    border-bottom: 1px solid var(--border-color);
}

.calendar-header h4 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Calendar Popover Grid */
.calendar-wrapper {
    padding: 16px;
    background: var(--card-bg);
}

.calendar-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.current-month {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-dark);
    font-family: 'Prompt', sans-serif;
}

.nav-btn {
    background: transparent;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #64748b;
    font-size: 12px;
}

.nav-btn:hover {
    background: #f1f5f9;
    color: #3b82f6;
    border-color: #cbd5e1;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    text-align: center;
}

.grid-header {
    font-size: 11px;
    font-weight: 600;
    color: #94a3b8;
    margin-bottom: 8px;
}

.calendar-day {
    height: 32px;
    width: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 13px;
    color: var(--text-muted);
    cursor: default;
    margin: 0 auto;
    position: relative;
}

.calendar-day:hover:not(.empty) {
    background: var(--gray);
}

/* Day with data update */
.calendar-day.has-update {
    background: #eff6ff;
    color: #2563eb;
    font-weight: 700;
    border: 1px solid #bfdbfe;
    cursor: pointer;
}

.calendar-day.has-update:hover {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
    transform: scale(1.1);
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.4);
}

.calendar-day.has-update::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    background: #2563eb;
    border-radius: 50%;
}

.calendar-day.has-update:hover::after {
    background: white;
}

.calendar-day.empty {
    pointer-events: none;
}

.update-details-footer {
    border-top: 1px solid var(--border-color);
    padding: 16px;
    background: var(--body-bg);
}

.selected-date-info {
    font-size: 13px;
    color: var(--text-dark);
    font-weight: 600;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.selected-date-desc {
    font-size: 12px;
    color: #64748b;
}

/* ============================================================
   OFFICIAL GOVERNMENT REPORT PRINT LAYOUT (A4 Portrait)
   Based on Thai formal document standard
   ============================================================ */
@media print {

    /* 1. Page setup: A4, with generous margins for official documents */
    @page {
        size: A4 portrait;
        margin: 20mm 20mm 25mm 20mm;
    }

    body {
        background: white !important;
        color: #000 !important;
        font-family: 'Sarabun', sans-serif !important;
        font-size: 15pt !important;
        line-height: 1.8 !important;
    }

    /* 2. Hide all non-printable UI elements */
    .sidebar,
    .filter-bar,
    .header-right,
    .loading-overlay,
    .theme-toggle-btn,
    .user-profile,
    .back-link,
    .page-header,
    .btn,
    button,
    .action-buttons,
    canvas,
    .chart-card,
    .premium-card-v2,
    .card,
    .main-sidebar-logo,
    .print-header,
    .screen-only,
    .no-print,
    #live-indicator,
    .info-box-soft,
    .dopa-credit,
    .btn-expand,
    .col-progress,
    .data-bar-wrapper,
    .chart-wrapper,
    .percent-badge,
    .modern-stats-wrapper,
    .map-section,
    .top-charts-grid {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        background: white !important;
        overflow: visible !important;
    }

    .app-container {
        display: block !important;
        overflow: visible !important;
    }

    /* 3. Official Report Header — centered, Thai government style */
    .official-report-header {
        display: block !important;
        text-align: center;
        margin-bottom: 20pt;
        padding-bottom: 10pt;
        border-bottom: 1.5pt solid #000;
        page-break-inside: avoid;
    }

    .report-logo-area {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 14pt;
        margin-bottom: 6pt;
    }

    .report-logo-area img {
        width: 52pt;
        height: auto;
    }

    .agency-name {
        text-align: left;
        font-size: 13pt;
        font-weight: 700;
        color: #000;
        line-height: 1.5;
    }

    /* Main title: BOLD, CENTERED, 18pt — matching reference image */
    .report-title-main {
        text-align: center;
        font-size: 18pt;
        font-weight: 700;
        margin: 8pt 0 4pt;
        color: #000;
        line-height: 1.5;
        letter-spacing: 0.5pt;
    }

    /* Subtitle: centered, slightly smaller, normal weight */
    .report-subtitle {
        text-align: center;
        font-size: 14pt;
        font-weight: 400;
        margin-bottom: 0;
        color: #000;
        line-height: 1.6;
    }

    .report-subtitle small {
        font-size: 11pt;
        color: #333;
        font-weight: normal;
    }

    /* 4. Report sections */
    .report-section {
        display: block !important;
        margin-bottom: 16pt;
        page-break-inside: avoid;
    }

    /* Section heading: bold with left-side border, Thai official style */
    .section-title-formal {
        display: block !important;
        font-size: 15pt;
        font-weight: 700;
        color: #000;
        padding: 3pt 0 3pt 10pt;
        border-left: 4pt solid #000;
        margin-bottom: 8pt;
        line-height: 1.4;
        background: #f0f0f0;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* Body paragraph: justified, indented first line */
    .report-text {
        text-align: justify;
        text-indent: 36pt;
        margin-bottom: 6pt;
        font-size: 15pt;
        line-height: 1.8;
        color: #000;
    }

    /* Numbered list items — Thai official document style (no hanging indent needed) */
    .report-item {
        display: block !important;
        margin-bottom: 5pt;
        padding-left: 28pt;
        text-indent: -28pt;
        font-size: 15pt;
        line-height: 1.8;
        color: #000;
    }

    /* 5. Formal tables */
    .formal-table,
    table.report-table,
    .province-report-card table,
    table {
        width: 100% !important;
        border-collapse: collapse !important;
        margin: 6pt 0 12pt !important;
        font-size: 13pt !important;
        table-layout: auto !important;
    }

    .formal-table th,
    table.report-table th,
    table th,
    th {
        background-color: #dce6f1 !important;
        color: #000 !important;
        border: 1pt solid #000 !important;
        padding: 5pt 8pt !important;
        font-weight: 700 !important;
        text-align: center !important;
        font-size: 13pt !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .formal-table td,
    table.report-table td,
    table td,
    td {
        border: 1pt solid #000 !important;
        padding: 4pt 8pt !important;
        font-size: 13pt !important;
        color: #000 !important;
        vertical-align: middle !important;
    }

    tfoot tr td,
    .formal-table tfoot tr td {
        background-color: #f2f2f2 !important;
        font-weight: 700 !important;
        border: 1pt solid #000 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .formal-table .text-right, td.text-right { text-align: right !important; }
    .formal-table .text-center, td.text-center { text-align: center !important; }

    thead { display: table-header-group !important; }
    tfoot { display: table-row-group !important; }
    tr { page-break-inside: avoid !important; }

    /* Table responsive containers: remove overflow clip */
    .province-report-card,
    .report-table-container,
    .table-responsive-wrapper,
    .table-responsive {
        display: block !important;
        overflow: visible !important;
        max-height: none !important;
        height: auto !important;
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
    }

    /* Table note / footnote */
    .table-note {
        font-size: 11pt;
        font-style: italic;
        color: #444;
        margin-top: 4pt;
    }

    /* 6. Progress bars (simplified grayscale for print) */
    .print-bar-container {
        display: block !important;
        width: 100%;
        height: 10pt;
        background: #e0e0e0;
        border: 0.5pt solid #888;
        border-radius: 2pt;
        margin-top: 3pt;
        position: relative;
        overflow: hidden;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .print-bar-fill {
        display: block !important;
        height: 100%;
        background: #666 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* 7. Footer — fixed at bottom of each printed page */
    .official-footer {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        font-size: 10pt;
        color: #333;
        display: flex !important;
        justify-content: space-between;
        border-top: 1pt solid #000;
        padding-top: 5pt;
        background: white;
        font-family: 'Sarabun', sans-serif;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* 8. Reset dark mode for print */
    [data-theme='dark'] {
        --body-bg: #ffffff !important;
        --card-bg: #ffffff !important;
        --header-bg: #ffffff !important;
        --text-dark: #000000 !important;
        --text-muted: #333333 !important;
        --border-color: #000000 !important;
        --gray: #f0f0f0 !important;
    }
}

/* Hide print-only sections on screen */
.official-report-header,
.report-section,
.official-footer,
.section-title-formal,
.print-bar-container,
.report-item {
    display: none;
}

.pdf-agency-report {
    display: none;
}

@media print {
    body .pdf-agency-report {
        display: block !important;
        width: 100% !important;
        min-height: 100vh !important;
        background: #ffffff !important;
        color: #08204a !important;
        font-family: 'Prompt', 'Sarabun', sans-serif !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    body .official-report-header:not(.pdf-agency-header),
    body .report-section {
        display: none !important;
    }

    body .pdf-agency-hero {
        position: relative !important;
        display: grid !important;
        grid-template-columns: 42mm 1fr 54mm !important;
        min-height: 72mm !important;
        overflow: hidden !important;
        border: 0.6pt solid #d5dbe5 !important;
        background: linear-gradient(90deg, #ffffff 0%, #ffffff 56%, #eef6ff 100%) !important;
    }

    body .pdf-agency-brand {
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 5mm !important;
        padding: 8mm 5mm !important;
        color: #ffffff !important;
        background: linear-gradient(180deg, #05224d 0%, #003b73 100%) !important;
        text-align: center !important;
    }

    body .pdf-agency-brand img {
        width: 24mm !important;
        height: auto !important;
        filter: drop-shadow(0 1mm 1.5mm rgba(0,0,0,.22)) !important;
    }

    body .pdf-agency-brand strong {
        display: block !important;
        color: #ffffff !important;
        font-size: 8.2pt !important;
        line-height: 1.35 !important;
        font-weight: 800 !important;
    }

    body .pdf-agency-brand span {
        display: block !important;
        margin-top: 1.5mm !important;
        color: #cfe2ff !important;
        font-size: 6.8pt !important;
        line-height: 1.2 !important;
    }

    body .pdf-agency-title {
        padding: 12mm 8mm 8mm 9mm !important;
        z-index: 2 !important;
    }

    body .pdf-agency-title span {
        display: block !important;
        color: #0b3a75 !important;
        font-size: 17pt !important;
        line-height: 1 !important;
        font-weight: 800 !important;
        margin: 0 0 2mm !important;
    }

    body .pdf-agency-title h1 {
        color: #061f49 !important;
        font-size: 31pt !important;
        line-height: 1.02 !important;
        font-weight: 900 !important;
        margin: 0 !important;
        letter-spacing: 0 !important;
    }

    body .pdf-agency-title h2 {
        color: #0b3a75 !important;
        font-size: 19pt !important;
        line-height: 1.15 !important;
        font-weight: 800 !important;
        margin: 2.5mm 0 4mm !important;
    }

    body .pdf-agency-title p {
        max-width: 112mm !important;
        color: #334155 !important;
        font-size: 8.5pt !important;
        line-height: 1.38 !important;
        margin: 0 !important;
        word-spacing: 0 !important;
    }

    body .pdf-hero-photo {
        position: relative !important;
        min-height: 72mm !important;
        background:
            linear-gradient(90deg, rgba(255,255,255,.1), rgba(255,255,255,.72)),
            url('../img/messageImage_1767863535029.jpg') center/cover no-repeat !important;
    }

    body .pdf-hero-photo::after {
        content: '' !important;
        position: absolute !important;
        right: -14mm !important;
        bottom: -10mm !important;
        width: 45mm !important;
        height: 72mm !important;
        background: linear-gradient(135deg, #0b3a75, #005a9e) !important;
        transform: skewX(-28deg) !important;
    }

    body .pdf-summary-strip {
        position: relative !important;
        display: grid !important;
        grid-template-columns: 1.35fr 1fr 1fr 1fr !important;
        gap: 0 !important;
        margin: -8mm 9mm 6mm !important;
        background: #ffffff !important;
        border: 0.7pt solid #d0d7e2 !important;
        border-radius: 4mm !important;
        overflow: hidden !important;
        box-shadow: 0 2mm 7mm rgba(15, 23, 42, .12) !important;
        z-index: 3 !important;
    }

    body .pdf-total-card,
    body .pdf-mini-stat {
        min-height: 24mm !important;
        padding: 5mm 5mm !important;
        border-right: 0.5pt solid #dce3ed !important;
        background: #ffffff !important;
    }

    body .pdf-total-card {
        color: #ffffff !important;
        background: linear-gradient(135deg, #072b63 0%, #004784 100%) !important;
        border-right: none !important;
    }

    body .pdf-total-card span,
    body .pdf-mini-stat span {
        display: block !important;
        font-size: 8pt !important;
        line-height: 1.2 !important;
        font-weight: 700 !important;
        margin: 0 0 1.5mm !important;
    }

    body .pdf-total-card strong {
        display: inline-block !important;
        color: #ffffff !important;
        font-size: 23pt !important;
        line-height: 1 !important;
        font-weight: 900 !important;
    }

    body .pdf-total-card em {
        color: #dbeafe !important;
        font-size: 9pt !important;
        font-style: normal !important;
        margin-left: 1.5mm !important;
    }

    body .pdf-mini-stat strong {
        display: block !important;
        color: #102a5c !important;
        font-size: 15pt !important;
        line-height: 1.05 !important;
        font-weight: 900 !important;
    }

    body .pdf-mini-stat em {
        display: block !important;
        color: #475569 !important;
        font-size: 8pt !important;
        font-style: normal !important;
        line-height: 1.2 !important;
        margin-top: 1mm !important;
    }

    body .pdf-mini-stat.blue span { color: #1d4ed8 !important; }
    body .pdf-mini-stat.pink span { color: #db2777 !important; }
    body .pdf-mini-stat.green span { color: #4d8f2f !important; }

    body .pdf-agency-grid {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 5mm !important;
        margin: 0 9mm !important;
    }

    body .pdf-panel {
        display: block !important;
        min-height: 72mm !important;
        padding: 6mm !important;
        background: #ffffff !important;
        border: 0.7pt solid #d0d7e2 !important;
        border-radius: 3mm !important;
        box-shadow: 0 1.5mm 5mm rgba(15, 23, 42, .07) !important;
        break-inside: avoid !important;
    }

    body .pdf-panel h3 {
        display: block !important;
        margin: 0 0 5mm !important;
        padding: 0 !important;
        border: none !important;
        background: transparent !important;
        color: #08204a !important;
        font-size: 11.3pt !important;
        line-height: 1.25 !important;
        font-weight: 900 !important;
        text-align: center !important;
    }

    body .pdf-bar-chart {
        display: grid !important;
        gap: 2.2mm !important;
        margin-bottom: 4mm !important;
    }

    body .pdf-bar-row {
        display: grid !important;
        grid-template-columns: 21mm 1fr 24mm !important;
        align-items: center !important;
        gap: 3mm !important;
        color: #1f2937 !important;
        font-size: 8.2pt !important;
        line-height: 1.2 !important;
    }

    body .pdf-bar-row div {
        height: 7mm !important;
        background: #eef4fb !important;
        border-radius: 1.3mm !important;
        overflow: hidden !important;
    }

    body .pdf-bar-row i {
        display: block !important;
        height: 100% !important;
        background: linear-gradient(90deg, #0a3b75, #0e6fb4) !important;
    }

    body .pdf-bar-row strong {
        color: #08204a !important;
        font-size: 8.3pt !important;
        line-height: 1 !important;
        text-align: right !important;
        font-variant-numeric: tabular-nums !important;
    }

    body .pdf-insight {
        display: block !important;
        margin-top: 4mm !important;
        padding: 3.2mm 4mm !important;
        background: #eef6ff !important;
        border-left: 1.2mm solid #1d74b7 !important;
        border-radius: 2mm !important;
        color: #24405f !important;
        font-size: 7.8pt !important;
        line-height: 1.34 !important;
        text-align: left !important;
        word-spacing: 0 !important;
    }

    body .pdf-insight b {
        display: inline !important;
        color: #08204a !important;
        font-size: 8pt !important;
        font-weight: 900 !important;
        margin-right: 1.5mm !important;
    }

    body .pdf-status-list {
        display: grid !important;
        gap: 2.2mm !important;
        margin-bottom: 4mm !important;
    }

    body .pdf-status-list div {
        display: grid !important;
        grid-template-columns: 7mm 1fr 28mm 15mm !important;
        align-items: center !important;
        gap: 2.5mm !important;
        padding: 2.4mm 2.5mm !important;
        border-bottom: 0.4pt solid #e2e8f0 !important;
    }

    body .pdf-status-list p {
        margin: 0 !important;
        color: #334155 !important;
        font-size: 8.3pt !important;
        line-height: 1.2 !important;
        word-spacing: 0 !important;
    }

    body .pdf-status-list strong {
        color: #0b3a75 !important;
        font-size: 12pt !important;
        line-height: 1 !important;
        font-weight: 900 !important;
        text-align: right !important;
        font-variant-numeric: tabular-nums !important;
    }

    body .pdf-status-list em {
        color: #475569 !important;
        font-size: 8pt !important;
        line-height: 1 !important;
        font-style: normal !important;
        text-align: right !important;
    }

    body .dot {
        display: block !important;
        width: 6mm !important;
        height: 6mm !important;
        border-radius: 999px !important;
    }

    body .dot.blue { background: #2d7fc1 !important; }
    body .dot.yellow { background: #f6b82f !important; }
    body .dot.green { background: #67b346 !important; }
    body .dot.red { background: #df5f86 !important; }

    body .pdf-cause-layout {
        display: grid !important;
        grid-template-columns: 34mm 1fr !important;
        align-items: center !important;
        gap: 5mm !important;
    }

    body .pdf-donut {
        width: 31mm !important;
        height: 31mm !important;
        border-radius: 999px !important;
        position: relative !important;
    }

    body .pdf-donut::after {
        content: '' !important;
        position: absolute !important;
        inset: 8mm !important;
        background: #ffffff !important;
        border-radius: 999px !important;
    }

    body .pdf-cause-list {
        display: grid !important;
        gap: 2mm !important;
    }

    body .pdf-cause-list div {
        display: grid !important;
        grid-template-columns: 4mm 1fr 13mm !important;
        align-items: center !important;
        gap: 2mm !important;
    }

    body .pdf-cause-list span {
        display: block !important;
        width: 3mm !important;
        height: 3mm !important;
        border-radius: 999px !important;
    }

    body .pdf-cause-list p {
        margin: 0 !important;
        color: #334155 !important;
        font-size: 7.8pt !important;
        line-height: 1.18 !important;
        word-spacing: 0 !important;
    }

    body .pdf-cause-list strong {
        color: #08204a !important;
        font-size: 8pt !important;
        line-height: 1 !important;
        text-align: right !important;
        font-weight: 800 !important;
    }

    body .pdf-action-list {
        display: grid !important;
        gap: 2.6mm !important;
    }

    body .pdf-action-list div {
        display: grid !important;
        grid-template-columns: 8mm 1fr !important;
        gap: 2.8mm !important;
        align-items: center !important;
        padding-bottom: 2.4mm !important;
        border-bottom: 0.4pt solid #e2e8f0 !important;
    }

    body .pdf-action-list i {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 7mm !important;
        height: 7mm !important;
        border-radius: 999px !important;
        background: #e0ecff !important;
        color: #0b3a75 !important;
        font-style: normal !important;
        font-size: 8pt !important;
        font-weight: 900 !important;
    }

    body .pdf-action-list p {
        margin: 0 !important;
        color: #334155 !important;
        font-size: 8.2pt !important;
        line-height: 1.28 !important;
        word-spacing: 0 !important;
    }

    body .pdf-agency-footer {
        display: grid !important;
        grid-template-columns: 1fr 1.5fr !important;
        gap: 10mm !important;
        margin: 6mm 0 0 !important;
        padding: 6mm 10mm !important;
        color: #ffffff !important;
        background: linear-gradient(90deg, #05224d, #004784) !important;
    }

    body .pdf-agency-footer strong {
        display: block !important;
        color: #ffffff !important;
        font-size: 8.5pt !important;
        line-height: 1.2 !important;
        margin-bottom: 1.5mm !important;
    }

    body .pdf-agency-footer span {
        display: block !important;
        color: #dbeafe !important;
        font-size: 7.5pt !important;
        line-height: 1.35 !important;
    }
}

/* ============================================================
   POLISHED PDF REPORT THEME
   Applies over page-level print blocks used by report pages.
   ============================================================ */
@media print {
    @page {
        size: A4 portrait;
        margin: 16mm 14mm 18mm 14mm;
    }

    html body {
        background: #ffffff !important;
        color: #111827 !important;
        font-family: 'Sarabun', 'Prompt', sans-serif !important;
        font-size: 12pt !important;
        line-height: 1.55 !important;
    }

    body .main-content {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        background: #ffffff !important;
        overflow: visible !important;
    }

    body .official-report-header {
        display: block !important;
        margin: 0 0 14pt !important;
        padding: 0 0 10pt !important;
        border-bottom: 2pt solid #1e3a8a !important;
        text-align: center !important;
        page-break-inside: avoid !important;
    }

    body .report-logo-area {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 12pt !important;
        margin-bottom: 6pt !important;
    }

    body .report-logo-area img {
        width: 48pt !important;
        height: auto !important;
    }

    body .agency-name {
        color: #1f2937 !important;
        font-size: 10.5pt !important;
        font-weight: 700 !important;
        line-height: 1.45 !important;
        text-align: left !important;
    }

    body .report-title-main {
        color: #0f172a !important;
        font-size: 18pt !important;
        font-weight: 800 !important;
        line-height: 1.35 !important;
        margin: 6pt 0 3pt !important;
        letter-spacing: 0 !important;
    }

    body .report-subtitle {
        color: #334155 !important;
        font-size: 11.5pt !important;
        line-height: 1.45 !important;
        margin: 0 !important;
    }

    body .report-subtitle small {
        color: #64748b !important;
        font-size: 9.5pt !important;
    }

    body .report-section {
        display: block !important;
        margin: 0 0 11pt !important;
        page-break-inside: avoid !important;
    }

    body .section-title-formal,
    body .modern-section-title,
    body .report-card h3,
    body .chart-header h3 {
        display: block !important;
        color: #0f172a !important;
        background: #eaf2ff !important;
        border-left: 4pt solid #1d4ed8 !important;
        border-bottom: 0.5pt solid #bfdbfe !important;
        padding: 4pt 8pt !important;
        margin: 0 0 7pt !important;
        font-size: 13pt !important;
        font-weight: 800 !important;
        line-height: 1.35 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    body .report-text,
    body .section-subtitle {
        color: #111827 !important;
        font-size: 11.5pt !important;
        line-height: 1.7 !important;
        text-align: justify !important;
        margin: 0 0 6pt !important;
    }

    body .report-text {
        text-indent: 24pt !important;
    }

    body .province-report-card,
    body .report-table-card,
    body .report-card,
    body .table-responsive-wrapper,
    body .report-table-container,
    body .table-responsive {
        display: block !important;
        width: 100% !important;
        height: auto !important;
        max-height: none !important;
        margin: 0 0 10pt !important;
        padding: 0 !important;
        overflow: visible !important;
        background: #ffffff !important;
        border: none !important;
        box-shadow: none !important;
    }

    body table,
    body .formal-table,
    body .report-table {
        width: 100% !important;
        border-collapse: collapse !important;
        margin: 6pt 0 11pt !important;
        font-size: 10.5pt !important;
        table-layout: auto !important;
    }

    body table th,
    body .formal-table th,
    body .report-table th {
        background: #dbeafe !important;
        color: #0f172a !important;
        border: 0.75pt solid #475569 !important;
        padding: 5pt 6pt !important;
        font-size: 10.5pt !important;
        font-weight: 800 !important;
        text-align: center !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    body table td,
    body .formal-table td,
    body .report-table td {
        color: #111827 !important;
        border: 0.75pt solid #64748b !important;
        padding: 4.5pt 6pt !important;
        font-size: 10.5pt !important;
        vertical-align: middle !important;
    }

    body table tbody tr:nth-child(even) td {
        background: #f8fafc !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    body table tfoot td,
    body .level-subtotal td {
        background: #eef2ff !important;
        font-weight: 800 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    body thead { display: table-header-group !important; }
    body tfoot { display: table-row-group !important; }
    body tr { page-break-inside: avoid !important; }

    body .text-right,
    body td.text-right {
        text-align: right !important;
    }

    body .text-center,
    body td.text-center {
        text-align: center !important;
    }

    body .print-bar-container {
        display: block !important;
        height: 8pt !important;
        background: #e2e8f0 !important;
        border: 0.5pt solid #94a3b8 !important;
        border-radius: 2pt !important;
        overflow: hidden !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    body .print-bar-fill {
        display: block !important;
        height: 100% !important;
        background: #2563eb !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    body .official-footer {
        display: flex !important;
        position: fixed !important;
        left: 14mm !important;
        right: 14mm !important;
        bottom: 8mm !important;
        justify-content: space-between !important;
        padding-top: 4pt !important;
        border-top: 0.75pt solid #cbd5e1 !important;
        background: #ffffff !important;
        color: #64748b !important;
        font-size: 8.5pt !important;
    }

    body .btn-export,
    body .btn-print,
    body .btn-excel,
    body .btn-pdf,
    body .filter-bar,
    body .sidebar,
    body .screen-only,
    body .loading-overlay,
    body .chart-card,
    body canvas,
    body .map-section,
    body .dopa-credit,
    body .btn-expand,
    body .data-bar-wrapper,
    body .col-progress {
        display: none !important;
    }
}

/* ============================================================
   AGENCY-STYLE WORD-LIKE PDF REFINEMENT
   Final print pass for polished spacing, hierarchy and readability.
   ============================================================ */
@media print {
    @page {
        size: A4 portrait;
        margin: 18mm 16mm 20mm 16mm;
    }

    html body {
        font-family: 'Sarabun', 'Prompt', 'TH Sarabun New', sans-serif !important;
        font-size: 11.2pt !important;
        line-height: 1.68 !important;
        color: #1f2937 !important;
        text-rendering: geometricPrecision !important;
        -webkit-font-smoothing: antialiased !important;
    }

    body .official-report-header {
        margin: 0 0 16pt !important;
        padding: 12pt 14pt 11pt !important;
        border: 0.75pt solid #cbd5e1 !important;
        border-top: 4pt solid #1d4ed8 !important;
        border-bottom: 1.5pt solid #1e3a8a !important;
        border-radius: 0 !important;
        background: linear-gradient(180deg, #f8fbff 0%, #ffffff 100%) !important;
        box-shadow: none !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    body .report-logo-area {
        gap: 10pt !important;
        margin-bottom: 7pt !important;
    }

    body .report-logo-area img {
        width: 44pt !important;
        padding: 3pt !important;
        border: 0.75pt solid #dbeafe !important;
        background: #ffffff !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    body .agency-name {
        font-size: 10.2pt !important;
        line-height: 1.38 !important;
        color: #334155 !important;
        font-weight: 700 !important;
        letter-spacing: 0 !important;
    }

    body .report-title-main {
        max-width: 170mm !important;
        margin: 7pt auto 4pt !important;
        color: #0f172a !important;
        font-size: 17pt !important;
        font-weight: 800 !important;
        line-height: 1.28 !important;
        letter-spacing: 0 !important;
    }

    body .report-subtitle {
        color: #475569 !important;
        font-size: 10.6pt !important;
        line-height: 1.5 !important;
    }

    body .report-subtitle small {
        color: #64748b !important;
        display: inline-block !important;
        margin-top: 2pt !important;
        font-size: 9.2pt !important;
    }

    body .report-section {
        margin: 0 0 12pt !important;
        padding: 0 !important;
        page-break-inside: auto !important;
    }

    body .section-title-formal,
    body .modern-section-title,
    body .report-card h3,
    body .chart-header h3 {
        margin: 13pt 0 7pt !important;
        padding: 4.5pt 8pt 4.5pt 9pt !important;
        color: #0f172a !important;
        background: #eff6ff !important;
        border-left: 3.5pt solid #2563eb !important;
        border-top: 0.5pt solid #bfdbfe !important;
        border-right: 0.5pt solid #bfdbfe !important;
        border-bottom: 0.5pt solid #bfdbfe !important;
        font-size: 12.4pt !important;
        line-height: 1.35 !important;
        font-weight: 800 !important;
        page-break-after: avoid !important;
        page-break-inside: avoid !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    body .report-text,
    body .section-subtitle,
    body p {
        color: #1f2937 !important;
        font-size: 11.1pt !important;
        line-height: 1.78 !important;
        margin: 0 0 6.5pt !important;
        letter-spacing: 0 !important;
        word-spacing: 0.5pt !important;
    }

    body .report-text {
        text-align: justify !important;
        text-indent: 10mm !important;
    }

    body strong,
    body b {
        font-weight: 800 !important;
        color: #0f172a !important;
    }

    body .formal-table,
    body .report-table,
    body table {
        margin: 7pt 0 12pt !important;
        font-size: 9.8pt !important;
        line-height: 1.42 !important;
        border: 0.75pt solid #475569 !important;
        box-shadow: none !important;
        page-break-inside: auto !important;
    }

    body table th,
    body .formal-table th,
    body .report-table th {
        background: #e0ecff !important;
        color: #0f172a !important;
        border: 0.6pt solid #64748b !important;
        padding: 4.8pt 5.5pt !important;
        font-size: 9.7pt !important;
        line-height: 1.35 !important;
        font-weight: 800 !important;
        vertical-align: middle !important;
    }

    body table td,
    body .formal-table td,
    body .report-table td {
        border: 0.55pt solid #94a3b8 !important;
        padding: 4.3pt 5.5pt !important;
        font-size: 9.6pt !important;
        line-height: 1.42 !important;
        color: #1f2937 !important;
        vertical-align: top !important;
    }

    body table tbody tr:nth-child(even) td {
        background: #f8fafc !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    body table tbody tr:hover td {
        background: inherit !important;
    }

    body table tfoot td,
    body .level-subtotal td,
    body .total-row td {
        background: #edf3ff !important;
        color: #0f172a !important;
        font-weight: 800 !important;
        border-top: 1pt solid #475569 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    body td.text-right,
    body .text-right,
    body td[class*="number"],
    body td[class*="total"],
    body td[class*="percent"] {
        font-variant-numeric: tabular-nums !important;
    }

    body .province-report-card,
    body .report-table-card,
    body .report-card,
    body .table-responsive-wrapper,
    body .report-table-container,
    body .table-responsive {
        margin-bottom: 12pt !important;
    }

    body .print-bar-container {
        height: 7pt !important;
        margin: 2pt 0 1pt !important;
        background: #e5e7eb !important;
        border: 0.5pt solid #cbd5e1 !important;
    }

    body .print-bar-fill {
        background: linear-gradient(90deg, #1d4ed8, #60a5fa) !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    body .official-footer {
        left: 16mm !important;
        right: 16mm !important;
        bottom: 8mm !important;
        color: #64748b !important;
        border-top: 0.6pt solid #d1d5db !important;
        font-size: 8.2pt !important;
        line-height: 1.35 !important;
    }

    body .print-only {
        display: block !important;
    }

    body .screen-only,
    body .sidebar,
    body .filter-bar,
    body .header-right,
    body .btn,
    body button,
    body .btn-export,
    body .btn-print,
    body .btn-excel,
    body .btn-pdf,
    body .loading-overlay,
    body .chart-card,
    body .map-section,
    body .top-charts-grid,
    body .modern-stats-wrapper,
    body .dopa-credit {
        display: none !important;
    }
}


/* ==========================================================
   ADDITIONAL RESPONSIVE UTILITIES
   ========================================================== */

/* Wrap all native tables that don't have a wrapper */
.province-report-card,
.cause-details-section {
    overflow: hidden;
}

/* Ensure all filter groups stretch on mobile */
@media (max-width: 992px) {
    .filter-group .ts-wrapper {
        width: 100%;
    }

    .ts-wrapper .ts-control {
        min-width: unset !important;
    }
}

/* Improved form selects on mobile */
@media (max-width: 576px) {
    .form-select,
    select {
        font-size: 16px; /* Prevent iOS zoom on focus */
        padding: 12px 14px;
        border-radius: 8px;
        width: 100%;
    }

    input[type="text"],
    input[type="search"],
    input[type="number"],
    input[type="email"],
    input[type="password"],
    textarea {
        font-size: 16px; /* Prevent iOS zoom */
        padding: 12px 14px;
        border-radius: 8px;
        width: 100%;
    }

    /* Buttons touch-friendly */
    button,
    .btn-filter,
    .btn-export,
    .btn-print,
    .btn-create,
    .btn-reset,
    .nav-link {
        min-height: 44px;
    }
}

/* Top charts single column on tablet */
@media (max-width: 992px) {
    .top-charts-grid {
        grid-template-columns: 1fr !important;
    }
}

/* Modern stats wrapper on tablet */
@media (max-width: 992px) {
    .modern-stats-wrapper {
        gap: 20px;
        margin-bottom: 24px;
    }

    .province-report-card {
        padding: 16px;
        border-radius: 14px;
    }
}

/* Sub-cause list responsive */
@media (max-width: 576px) {
    .sub-cause-list {
        padding: 0 10px 14px 10px;
    }

    .sub-cause-item {
        flex-wrap: wrap;
        gap: 4px;
    }

    .sub-code {
        width: 50px;
    }

    .sub-value {
        width: auto;
    }

    /* List header hidden on mobile */
    .list-header {
        display: none;
    }
}

/* No horizontal overflow on any container */
.app-container,
.main-content,
.filter-bar,
.chart-card,
.province-report-card,
.cause-details-section {
    max-width: 100%;
    box-sizing: border-box;
}

@media print {
    body:has(.pdf-agency-report) .pdf-agency-report {
        display: block !important;
    }

    body:has(.pdf-agency-report) .official-report-header:not(.pdf-agency-header),
    body:has(.pdf-agency-report) .report-section,
    body:has(.pdf-agency-report) .official-footer {
        display: none !important;
    }

    body:has(.pdf-agency-report) .pdf-insight,
    body:has(.pdf-agency-report) .pdf-insight b,
    body:has(.pdf-agency-report) .pdf-action-list p,
    body:has(.pdf-agency-report) .pdf-cause-list p,
    body:has(.pdf-agency-report) .pdf-status-list p,
    body:has(.pdf-agency-report) .pdf-agency-title p {
        line-height: 1.32 !important;
        word-spacing: 0 !important;
        letter-spacing: 0 !important;
    }
}

@media print {
    @page {
        size: A4 portrait;
        margin: 0;
    }

    body:has(.pdf-agency-report) {
        margin: 0 !important;
        padding: 0 !important;
        background: #ffffff !important;
    }

    body:has(.pdf-agency-report) .main-content {
        padding: 0 !important;
    }

    body:has(.pdf-agency-report) .pdf-agency-report {
        display: block !important;
        width: 210mm !important;
        height: 296.5mm !important;
        min-height: 296.5mm !important;
        max-height: 296.5mm !important;
        overflow: hidden !important;
        page-break-after: auto !important;
        break-after: auto !important;
        box-sizing: border-box !important;
        padding: 0 !important;
        background: #ffffff !important;
    }

    body:has(.pdf-agency-report) .official-report-header:not(.pdf-agency-header),
    body:has(.pdf-agency-report) .report-section {
        display: block !important;
    }

    body:has(.pdf-agency-report) .official-report-header:not(.pdf-agency-header) {
        margin: 3mm 15mm 5mm !important;
        padding: 0 0 4mm !important;
        page-break-before: auto !important;
    }

    body:has(.pdf-agency-report) .report-section {
        margin: 0 15mm 7mm !important;
    }

    body:has(.pdf-agency-report) .pdf-agency-hero {
        grid-template-columns: 39mm 1fr 50mm !important;
        min-height: 62mm !important;
        height: 62mm !important;
        border-left: none !important;
        border-right: none !important;
        border-top: none !important;
    }

    body:has(.pdf-agency-report) .pdf-agency-brand {
        padding: 6mm 4mm !important;
        gap: 4mm !important;
    }

    body:has(.pdf-agency-report) .pdf-agency-brand img {
        width: 22mm !important;
    }

    body:has(.pdf-agency-report) .pdf-agency-brand strong {
        font-size: 7.7pt !important;
        line-height: 1.25 !important;
    }

    body:has(.pdf-agency-report) .pdf-agency-brand span {
        font-size: 6.2pt !important;
    }

    body:has(.pdf-agency-report) .pdf-agency-title {
        padding: 9mm 7mm 6mm 8mm !important;
    }

    body:has(.pdf-agency-report) .pdf-agency-title span {
        font-size: 15pt !important;
        margin-bottom: 1.5mm !important;
    }

    body:has(.pdf-agency-report) .pdf-agency-title h1 {
        font-size: 28pt !important;
        line-height: 1 !important;
    }

    body:has(.pdf-agency-report) .pdf-agency-title h2 {
        font-size: 17pt !important;
        margin: 2mm 0 3mm !important;
    }

    body:has(.pdf-agency-report) .pdf-agency-title p {
        font-size: 7.5pt !important;
        line-height: 1.25 !important;
        max-width: 108mm !important;
    }

    body:has(.pdf-agency-report) .pdf-hero-photo {
        min-height: 62mm !important;
        height: 62mm !important;
    }

    body:has(.pdf-agency-report) .pdf-summary-strip {
        grid-template-columns: 1.28fr 1fr 1fr 1fr !important;
        margin: -7mm 10mm 4mm !important;
        border-radius: 3mm !important;
    }

    body:has(.pdf-agency-report) .pdf-total-card,
    body:has(.pdf-agency-report) .pdf-mini-stat {
        min-height: 20mm !important;
        padding: 4mm !important;
    }

    body:has(.pdf-agency-report) .pdf-total-card strong {
        font-size: 20pt !important;
    }

    body:has(.pdf-agency-report) .pdf-mini-stat strong {
        font-size: 13pt !important;
    }

    body:has(.pdf-agency-report) .pdf-total-card span,
    body:has(.pdf-agency-report) .pdf-mini-stat span {
        font-size: 7.1pt !important;
        margin-bottom: 1mm !important;
    }

    body:has(.pdf-agency-report) .pdf-total-card em,
    body:has(.pdf-agency-report) .pdf-mini-stat em {
        font-size: 7.2pt !important;
    }

    body:has(.pdf-agency-report) .pdf-agency-grid {
        gap: 4mm !important;
        margin: 0 10mm !important;
    }

    body:has(.pdf-agency-report) .pdf-panel {
        min-height: 62mm !important;
        height: 62mm !important;
        padding: 4.5mm !important;
        border-radius: 2.5mm !important;
    }

    body:has(.pdf-agency-report) .pdf-panel h3 {
        font-size: 10pt !important;
        line-height: 1.18 !important;
        margin-bottom: 3.5mm !important;
    }

    body:has(.pdf-agency-report) .pdf-bar-chart,
    body:has(.pdf-agency-report) .pdf-status-list,
    body:has(.pdf-agency-report) .pdf-action-list,
    body:has(.pdf-agency-report) .pdf-cause-list {
        gap: 1.6mm !important;
    }

    body:has(.pdf-agency-report) .pdf-bar-row {
        grid-template-columns: 19mm 1fr 21mm !important;
        gap: 2mm !important;
        font-size: 7.2pt !important;
    }

    body:has(.pdf-agency-report) .pdf-bar-row div {
        height: 5.6mm !important;
    }

    body:has(.pdf-agency-report) .pdf-bar-row strong {
        font-size: 7.2pt !important;
    }

    body:has(.pdf-agency-report) .pdf-status-list div {
        grid-template-columns: 5.5mm 1fr 24mm 13mm !important;
        gap: 2mm !important;
        padding: 1.7mm 1mm !important;
    }

    body:has(.pdf-agency-report) .dot {
        width: 5mm !important;
        height: 5mm !important;
    }

    body:has(.pdf-agency-report) .pdf-status-list p,
    body:has(.pdf-agency-report) .pdf-action-list p {
        font-size: 7.3pt !important;
        line-height: 1.18 !important;
    }

    body:has(.pdf-agency-report) .pdf-status-list strong {
        font-size: 10.2pt !important;
    }

    body:has(.pdf-agency-report) .pdf-status-list em {
        font-size: 7pt !important;
    }

    body:has(.pdf-agency-report) .pdf-cause-layout {
        grid-template-columns: 29mm 1fr !important;
        gap: 4mm !important;
    }

    body:has(.pdf-agency-report) .pdf-donut {
        width: 27mm !important;
        height: 27mm !important;
    }

    body:has(.pdf-agency-report) .pdf-donut::after {
        inset: 7mm !important;
    }

    body:has(.pdf-agency-report) .pdf-cause-list div {
        grid-template-columns: 3.5mm 1fr 12mm !important;
        gap: 1.7mm !important;
    }

    body:has(.pdf-agency-report) .pdf-cause-list p {
        font-size: 6.9pt !important;
        line-height: 1.12 !important;
    }

    body:has(.pdf-agency-report) .pdf-cause-list strong {
        font-size: 7pt !important;
    }

    body:has(.pdf-agency-report) .pdf-action-list div {
        grid-template-columns: 6.5mm 1fr !important;
        gap: 2mm !important;
        padding-bottom: 1.8mm !important;
    }

    body:has(.pdf-agency-report) .pdf-action-list i {
        width: 6mm !important;
        height: 6mm !important;
        font-size: 7pt !important;
    }

    body:has(.pdf-agency-report) .pdf-insight {
        margin-top: 3mm !important;
        padding: 2.2mm 3mm !important;
        font-size: 6.9pt !important;
        line-height: 1.18 !important;
        border-radius: 1.6mm !important;
    }

    body:has(.pdf-agency-report) .pdf-insight b {
        font-size: 7pt !important;
        line-height: 1.18 !important;
    }

    body:has(.pdf-agency-report) .pdf-agency-footer {
        grid-template-columns: .9fr 1.6fr !important;
        gap: 8mm !important;
        margin-top: 4mm !important;
        padding: 5mm 10mm !important;
        min-height: 23mm !important;
    }

    body:has(.pdf-agency-report) .pdf-agency-footer strong {
        font-size: 7.5pt !important;
        margin-bottom: 1mm !important;
    }

    body:has(.pdf-agency-report) .pdf-agency-footer span {
        font-size: 6.7pt !important;
        line-height: 1.25 !important;
    }

    body:has(.pdf-agency-report) .official-report-header:not(.pdf-agency-header) .report-logo-area {
        gap: 7mm !important;
        margin-bottom: 3mm !important;
    }

    body:has(.pdf-agency-report) .official-report-header:not(.pdf-agency-header) .report-logo-area img {
        width: 16mm !important;
    }

    body:has(.pdf-agency-report) .official-report-header:not(.pdf-agency-header) .agency-name {
        font-size: 9pt !important;
        line-height: 1.25 !important;
    }

    body:has(.pdf-agency-report) .official-report-header:not(.pdf-agency-header) .report-title-main {
        font-size: 15pt !important;
        line-height: 1.2 !important;
        margin: 2mm 0 1mm !important;
    }

    body:has(.pdf-agency-report) .official-report-header:not(.pdf-agency-header) .report-subtitle {
        font-size: 9.3pt !important;
        line-height: 1.25 !important;
    }

    body:has(.pdf-agency-report) .official-report-header:not(.pdf-agency-header) .report-subtitle small {
        font-size: 8pt !important;
        line-height: 1.2 !important;
    }

    body:has(.pdf-agency-report) .report-section {
        page-break-inside: auto !important;
        break-inside: auto !important;
    }

    body:has(.pdf-agency-report) .report-section .section-title-formal {
        margin: 0 0 3.2mm !important;
        padding: 2.2mm 3.5mm !important;
        font-size: 10.8pt !important;
        line-height: 1.22 !important;
        border-left-width: 2.5pt !important;
    }

    body:has(.pdf-agency-report) .report-section .report-text,
    body:has(.pdf-agency-report) .report-section p {
        margin: 0 0 3mm !important;
        font-size: 9.7pt !important;
        line-height: 1.42 !important;
        text-indent: 7mm !important;
        word-spacing: 0 !important;
        letter-spacing: 0 !important;
    }

    body:has(.pdf-agency-report) .report-section .report-text[style*="text-indent:0"] {
        text-indent: 0 !important;
    }

    body:has(.pdf-agency-report) .report-section .table-responsive-wrapper,
    body:has(.pdf-agency-report) .report-section .table-responsive,
    body:has(.pdf-agency-report) .report-section .report-table-container {
        margin: 0 0 4mm !important;
        padding: 0 !important;
        overflow: visible !important;
    }

    body:has(.pdf-agency-report) .report-section table,
    body:has(.pdf-agency-report) .report-section .formal-table {
        margin: 2mm 0 4mm !important;
        font-size: 8.8pt !important;
        line-height: 1.22 !important;
    }

    body:has(.pdf-agency-report) .report-section th {
        padding: 2.2mm 2.8mm !important;
        font-size: 8.8pt !important;
        line-height: 1.18 !important;
    }

    body:has(.pdf-agency-report) .report-section td {
        padding: 2mm 2.8mm !important;
        font-size: 8.8pt !important;
        line-height: 1.22 !important;
    }

    body:has(.pdf-agency-report) .report-section > div[style*="display:flex"] {
        gap: 8mm !important;
        align-items: flex-start !important;
    }

    body:has(.pdf-agency-report) .report-section .print-bar-container {
        height: 4.5mm !important;
        margin: 1mm 0 .5mm !important;
    }
}
