        @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700&display=swap');

        body {
            font-family: 'Inter', sans-serif;
        }

        .tab-active {
            border-bottom: 2px solid #2563eb;
            color: #2563eb;
            font-weight: 600;
        }

        .tab-inactive {
            color: #64748b;
        }

        html.dark .tab-inactive {
            color: #94a3b8;
        }

        /* ADT table sort indicator */
        #view-adt .sort-control {
            position: relative;
            cursor: pointer;
            user-select: none;
            padding-right: 1.35rem;
        }

        #view-adt .sort-control::after {
            content: "↕";
            position: absolute;
            right: 0.4rem;
            top: 50%;
            transform: translateY(-50%);
            font-size: 0.75rem;
            color: #94a3b8;
        }

        #view-adt .sort-control[aria-sort="ascending"]::after {
            content: "↑";
            color: #0f766e;
            font-weight: 700;
        }

        #view-adt .sort-control[aria-sort="descending"]::after {
            content: "↓";
            color: #0f766e;
            font-weight: 700;
        }

        /* Tooltip Button Hover Effect */
        .info-btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 2rem;
            height: 2rem;
            border-radius: 9999px;
            background-color: #eff6ff;
            /* blue-50 */
            color: #3b82f6;
            /* blue-500 */
            transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
            cursor: pointer;
        }

        .info-btn:hover {
            background-color: #3b82f6;
            /* blue-500 */
            color: white;
            transform: translateY(-1px);
            box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.3);
        }

        /* Specific style for calculator button to differentiate slightly if needed */
        .calc-btn {
            background-color: #f0fdf4;
            /* green-50 */
            color: #16a34a;
            /* green-600 */
        }

        .calc-btn:hover {
            background-color: #16a34a;
            color: white;
            box-shadow: 0 4px 6px -1px rgba(22, 163, 74, 0.3);
        }

        .info-btn svg {
            width: 1.2rem;
            height: 1.2rem;
        }

        /* Explanation drawer only: cleaner reading layout */
        #explanation-modal #exp-content {
            font-size: 0.84rem;
            line-height: 1.65;
        }

        #explanation-modal #exp-content p {
            margin-top: 0;
            margin-bottom: 0.9rem;
        }

        #explanation-modal #exp-content p:last-child {
            margin-bottom: 0;
        }

        /* Dark mode readability overrides for legacy light-only utility usage */
        html.dark body {
            background-color: #0f172a;
            color: #e2e8f0;
        }

        html.dark .bg-white {
            background-color: #111827 !important;
        }

        html.dark .bg-slate-50 {
            background-color: #0f172a !important;
        }

        html.dark .bg-slate-100 {
            background-color: #1e293b !important;
        }

        html.dark .border-slate-50,
        html.dark .border-slate-100,
        html.dark .border-slate-200,
        html.dark .border-slate-300 {
            border-color: #334155 !important;
        }

        html.dark .text-slate-900,
        html.dark .text-slate-800,
        html.dark .text-slate-700 {
            color: #e2e8f0 !important;
        }

        html.dark .text-slate-600,
        html.dark .text-slate-500,
        html.dark .text-slate-400 {
            color: #94a3b8 !important;
        }

        html.dark input,
        html.dark select,
        html.dark textarea {
            background-color: #0f172a !important;
            border-color: #334155 !important;
            color: #e2e8f0 !important;
        }

        html.dark input::placeholder,
        html.dark textarea::placeholder {
            color: #64748b !important;
        }

        /* Softer accent palette in dark mode */
        html.dark .bg-blue-50,
        html.dark .hover\:bg-blue-50:hover {
            background-color: rgba(59, 130, 246, 0.12) !important;
        }

        html.dark .bg-indigo-50,
        html.dark .hover\:bg-indigo-50:hover {
            background-color: rgba(99, 102, 241, 0.12) !important;
        }

        html.dark .bg-rose-50,
        html.dark .hover\:bg-rose-50:hover {
            background-color: rgba(244, 63, 94, 0.12) !important;
        }

        html.dark .bg-amber-50,
        html.dark .hover\:bg-amber-50:hover {
            background-color: rgba(245, 158, 11, 0.12) !important;
        }

        html.dark .bg-cyan-50,
        html.dark .hover\:bg-cyan-50:hover,
        html.dark .bg-teal-50,
        html.dark .hover\:bg-teal-50:hover {
            background-color: rgba(20, 184, 166, 0.12) !important;
        }

        html.dark .bg-blue-100 {
            background-color: rgba(59, 130, 246, 0.2) !important;
        }

        html.dark .bg-indigo-100 {
            background-color: rgba(99, 102, 241, 0.2) !important;
        }

        html.dark .bg-emerald-100 {
            background-color: rgba(16, 185, 129, 0.2) !important;
        }

        html.dark .bg-rose-100 {
            background-color: rgba(244, 63, 94, 0.2) !important;
        }

        html.dark .bg-cyan-100 {
            background-color: rgba(6, 182, 212, 0.2) !important;
        }

        html.dark .bg-teal-100 {
            background-color: rgba(20, 184, 166, 0.2) !important;
        }

        html.dark .border-blue-100,
        html.dark .border-blue-200,
        html.dark .border-indigo-100,
        html.dark .border-indigo-200,
        html.dark .border-rose-100,
        html.dark .border-rose-200,
        html.dark .border-amber-100,
        html.dark .border-amber-200,
        html.dark .border-cyan-100,
        html.dark .border-teal-100 {
            border-color: rgba(148, 163, 184, 0.28) !important;
        }

        html.dark .text-blue-800,
        html.dark .text-blue-700,
        html.dark .text-blue-600,
        html.dark .text-blue-500 {
            color: #93c5fd !important;
        }

        html.dark .text-indigo-700,
        html.dark .text-indigo-600,
        html.dark .text-indigo-500 {
            color: #a5b4fc !important;
        }

        html.dark .text-rose-700,
        html.dark .text-rose-600,
        html.dark .text-rose-500 {
            color: #fda4af !important;
        }

        html.dark .text-amber-700,
        html.dark .text-amber-600,
        html.dark .text-amber-500 {
            color: #fcd34d !important;
        }

        html.dark .text-cyan-700,
        html.dark .text-cyan-600,
        html.dark .text-teal-700,
        html.dark .text-teal-600 {
            color: #67e8f9 !important;
        }

        html.dark .bg-blue-600,
        html.dark .hover\:bg-blue-700:hover {
            background-color: #3a5f97 !important;
        }

        html.dark .info-btn {
            background-color: rgba(59, 130, 246, 0.16);
            color: #93c5fd;
        }

        html.dark .info-btn:hover {
            background-color: rgba(59, 130, 246, 0.3);
            color: #dbeafe;
            box-shadow: 0 4px 10px -3px rgba(59, 130, 246, 0.25);
        }

        html.dark .calc-btn {
            background-color: rgba(34, 197, 94, 0.14);
            color: #86efac;
        }

        html.dark .calc-btn:hover {
            background-color: rgba(34, 197, 94, 0.26);
            color: #dcfce7;
            box-shadow: 0 4px 10px -3px rgba(34, 197, 94, 0.22);
        }

        html.dark #explanation-modal #exp-content {
            color: #cbd5e1;
        }

        /* Period summary bar contrast tuning for report tabs */
        html.dark #period-display-container {
            background: linear-gradient(135deg, #0b1b34 0%, #0f172a 100%) !important;
            border-color: #2d4a76 !important;
            box-shadow: inset 0 1px 0 rgba(148, 163, 184, 0.08);
        }

        html.dark #period-display-container p {
            color: #cbd5e1 !important;
        }

        html.dark #main-period-display {
            color: #f8fafc !important;
        }

        html.dark #period-type-badge {
            border: 1px solid rgba(148, 163, 184, 0.32);
            color: #dbeafe !important;
        }

        /* Demographics tab dark-mode compatibility refinements */
        html.dark #view-demographics .text-amber-900,
        html.dark #view-demographics .text-amber-800 {
            color: #fde68a !important;
        }

        html.dark #view-demographics .bg-amber-100 {
            background-color: rgba(245, 158, 11, 0.2) !important;
        }

        html.dark #view-demographics .bg-purple-100 {
            background-color: rgba(147, 51, 234, 0.2) !important;
        }

        html.dark #view-demographics .text-purple-600 {
            color: #c4b5fd !important;
        }

        html.dark #view-demographics .border-purple-100,
        html.dark #view-demographics .border-purple-200 {
            border-color: rgba(167, 139, 250, 0.32) !important;
        }

        html.dark #view-demographics .bg-emerald-100 {
            background-color: rgba(16, 185, 129, 0.2) !important;
        }

        html.dark #view-demographics .text-emerald-800 {
            color: #6ee7b7 !important;
        }

        html.dark #view-demographics .text-rose-800 {
            color: #fda4af !important;
        }

        html.dark #view-demographics .border-emerald-200 {
            border-color: rgba(110, 231, 183, 0.35) !important;
        }

        /* Keep translucent white callouts readable in dark mode */
        html.dark #view-demographics [class*="bg-white/"] {
            background-color: rgba(15, 23, 42, 0.72) !important;
        }

        /* Survey respondent demographics section polish */
        .survey-demo-section {
            border-color: #e2e8f0;
            box-shadow: 0 10px 24px -18px rgba(15, 23, 42, 0.34);
        }

        .survey-demo-header {
            padding-bottom: 0.65rem;
            border-bottom: 1px solid #e2e8f0;
        }

        .survey-demo-controls {
            align-items: center;
        }

        .survey-demo-view-select {
            min-height: 2.35rem;
            border-radius: 0.6rem;
        }

        .survey-demo-kpi-grid {
            margin-top: 1rem;
        }

        .survey-demo-kpi-card {
            position: relative;
            overflow: hidden;
            background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
            border-color: #dbe7f5;
            border-radius: 0.85rem;
            min-height: 6.4rem;
        }

        .survey-demo-kpi-card::before {
            content: "";
            position: absolute;
            left: 0;
            top: 0;
            width: 4px;
            height: 100%;
            background: linear-gradient(180deg, #0891b2 0%, #3b82f6 100%);
        }

        .survey-demo-chart-card {
            border-radius: 0.9rem;
            border-color: #dbe7f5;
            background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
            box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
        }

        .survey-demo-chart-title {
            letter-spacing: 0.01em;
        }

        .survey-status-summary-card {
            background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
        }

        .survey-status-summary-card #survey-adherence-due-attempts {
            white-space: nowrap;
        }

        .adt-kpi-card {
            position: relative;
            overflow: hidden;
            background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
            border: 1px solid #dbe7f5;
            border-radius: 0.9rem;
            padding: 1rem 1.1rem;
            box-shadow: 0 6px 16px -14px rgba(15, 23, 42, 0.42);
        }

        .adt-kpi-card::before {
            content: "";
            position: absolute;
            left: 0;
            top: 0;
            width: 4px;
            height: 100%;
            background: linear-gradient(180deg, #7c3aed 0%, #6366f1 100%);
        }

        .adt-kpi-card[data-accent="violet"]::before { background: linear-gradient(180deg, #7c3aed 0%, #8b5cf6 100%); }
        .adt-kpi-card[data-accent="indigo"]::before { background: linear-gradient(180deg, #4f46e5 0%, #6366f1 100%); }
        .adt-kpi-card[data-accent="cyan"]::before { background: linear-gradient(180deg, #0891b2 0%, #06b6d4 100%); }
        .adt-kpi-card[data-accent="rose"]::before { background: linear-gradient(180deg, #e11d48 0%, #f43f5e 100%); }
        .adt-kpi-card[data-accent="sky"]::before { background: linear-gradient(180deg, #0284c7 0%, #0ea5e9 100%); }
        .adt-kpi-card[data-accent="emerald"]::before { background: linear-gradient(180deg, #059669 0%, #10b981 100%); }
        .adt-kpi-card[data-accent="slate"]::before { background: linear-gradient(180deg, #475569 0%, #64748b 100%); }

        .adt-kpi-head {
            display: flex;
            align-items: center;
            gap: 0.6rem;
            margin-bottom: 0.6rem;
        }

        .adt-kpi-icon {
            width: 1.8rem;
            height: 1.8rem;
            border-radius: 0.55rem;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
        }

        .adt-kpi-label {
            font-size: 0.78rem;
            font-weight: 600;
            color: #64748b;
            letter-spacing: 0.01em;
        }

        .adt-kpi-value {
            font-size: 1.95rem;
            line-height: 1;
            font-weight: 800;
            color: #1e293b;
            margin-left: 2.4rem;
        }

        .survey-status-chart-card .h-72 {
            min-height: 18rem;
        }

        @media (max-width: 767px) {
            .survey-demo-header {
                gap: 0.8rem;
                flex-direction: column;
                align-items: flex-start;
            }

            .survey-demo-controls {
                width: 100%;
                align-items: center;
                justify-content: space-between;
            }

            .survey-demo-controls .min-w-\[150px\] {
                min-width: 0 !important;
                width: 100%;
            }

            .survey-status-summary-card #survey-adherence-due-attempts {
                white-space: normal;
                text-align: right;
            }

            .adt-kpi-value {
                margin-left: 0;
            }
        }

        html.dark .survey-demo-section {
            border-color: #334155;
            box-shadow: 0 10px 24px -18px rgba(2, 6, 23, 0.6);
        }

        html.dark .survey-demo-header {
            border-bottom-color: #334155;
        }

        html.dark .survey-demo-kpi-card {
            background: linear-gradient(160deg, rgba(15, 23, 42, 0.9) 0%, rgba(30, 41, 59, 0.9) 100%);
            border-color: rgba(71, 85, 105, 0.9);
        }

        html.dark .survey-demo-kpi-card::before {
            background: linear-gradient(180deg, #22d3ee 0%, #60a5fa 100%);
        }

        html.dark .survey-demo-chart-card {
            border-color: rgba(71, 85, 105, 0.9);
            background: linear-gradient(180deg, rgba(15, 23, 42, 0.7) 0%, rgba(30, 41, 59, 0.7) 100%);
            box-shadow: inset 0 1px 0 rgba(148, 163, 184, 0.08);
        }

        html.dark .survey-status-summary-card {
            background: linear-gradient(180deg, rgba(15, 23, 42, 0.82) 0%, rgba(30, 41, 59, 0.82) 100%);
        }

        html.dark .adt-kpi-card {
            background: linear-gradient(160deg, rgba(15, 23, 42, 0.9) 0%, rgba(30, 41, 59, 0.86) 100%);
            border-color: rgba(71, 85, 105, 0.9);
            box-shadow: 0 10px 24px -18px rgba(2, 6, 23, 0.7);
        }

        html.dark .adt-kpi-label {
            color: #94a3b8;
        }

        html.dark .adt-kpi-value {
            color: #e2e8f0;
        }
