/* Nirvana HP — colorful light financial operations design system. */
:root {
    --hp-blue: #3978f6;
    --hp-blue-deep: #2f62dc;
    --hp-blue-soft: #eaf1ff;
    --hp-purple: #8b5cf6;
    --hp-pink: #ef5da8;
    --hp-orange: #ff9b5c;
    --hp-green: #36c98f;
    --hp-cyan: #38bdf8;
    --hp-red: #ef6675;
    --hp-yellow: #f5c85b;
    --hp-ink: #24324a;
    --hp-muted: #7b879d;
    --hp-bg: #c49a24;
    --hp-surface: #ffffff;
    --hp-border: #e5ebf5;
    --hp-shadow: 0 10px 28px rgba(63, 91, 143, .10);
    --hp-shadow-hover: 0 14px 34px rgba(63, 91, 143, .15);
}

html,
body {
    min-height: 100%;
    background: var(--hp-bg);
}

body.hp-theme {
    --hp-font-scale: .75;
    color: var(--hp-ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at 82% 0%, rgba(255,255,255,.16), transparent 30%),
        linear-gradient(135deg, #b88918 0%, #d0a52c 48%, #b98212 100%) !important;
    background-attachment: fixed;
}

body.hp-theme main {
    background:
        radial-gradient(circle at 88% 0%, rgba(255,255,255,.18), transparent 27%),
        linear-gradient(135deg, rgba(190,145,24,.96), rgba(211,169,50,.94)) !important;
    background-attachment: fixed;
}

body.hp-theme ::selection {
    background: rgba(57,120,246,.20);
}

body.hp-theme ::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}

body.hp-theme ::-webkit-scrollbar-thumb {
    background: rgba(57,120,246,.24);
    border-radius: 999px;
}

body.hp-theme ::-webkit-scrollbar-thumb:hover {
    background: rgba(57,120,246,.40);
}

/* Global surfaces and typography. */
body.hp-theme .bg-slate-100 {
    background-color: #f1f5ff !important;
}

body.hp-theme .bg-slate-50 {
    background-color: #f8faff !important;
}

body.hp-theme .bg-white {
    background-color: var(--hp-surface) !important;
}

body.hp-theme .text-slate-900 {
    color: #1f2d44 !important;
}

body.hp-theme .text-slate-800 {
    color: #2b3952 !important;
}

body.hp-theme .text-slate-700 {
    color: #40506a !important;
}

body.hp-theme .text-slate-600,
body.hp-theme .text-slate-500 {
    color: var(--hp-muted) !important;
}

body.hp-theme .text-slate-400 {
    color: #9aa6b9 !important;
}

body.hp-theme .border-slate-200,
body.hp-theme .border-slate-100 {
    border-color: var(--hp-border) !important;
}

body.hp-theme .border-slate-50 {
    border-color: #edf1f8 !important;
}

body.hp-theme .rounded-lg,
body.hp-theme .rounded-xl,
body.hp-theme .rounded-2xl {
    border-radius: .8rem;
}

body.hp-theme .shadow,
body.hp-theme .shadow-sm,
body.hp-theme .shadow-md,
body.hp-theme .shadow-lg,
body.hp-theme .shadow-xl {
    box-shadow: var(--hp-shadow) !important;
}

body.hp-theme .shadow-sm:hover,
body.hp-theme .shadow-md:hover {
    box-shadow: var(--hp-shadow-hover) !important;
}

/* Buttons / primary actions. */
body.hp-theme .bg-blue-600 {
    background: linear-gradient(135deg, #4d86ff 0%, #376fe9 100%) !important;
    color: #fff !important;
    box-shadow: 0 7px 18px rgba(57,120,246,.20) !important;
}

body.hp-theme .bg-blue-700 {
    background: linear-gradient(135deg, #376fe9 0%, #2e5fd0 100%) !important;
    color: #fff !important;
}

body.hp-theme .text-blue-600,
body.hp-theme .text-blue-700 {
    color: var(--hp-blue) !important;
}

body.hp-theme .border-blue-600 {
    border-color: var(--hp-blue) !important;
}

body.hp-theme .hover\\:bg-blue-700:hover {
    background: linear-gradient(135deg, #376fe9 0%, #2e5fd0 100%) !important;
    color: #fff !important;
}

body.hp-theme .hover\\:bg-blue-50:hover {
    background: #edf3ff !important;
}

body.hp-theme .hover\\:bg-slate-800:hover {
    background-color: #edf2ff !important;
}

body.hp-theme .hover\\:bg-slate-100:hover {
    background-color: #eef3ff !important;
}

body.hp-theme .focus\\:ring-blue-500:focus {
    --tw-ring-color: rgba(57,120,246,.22) !important;
}

/* Inputs, selects, textareas and file controls. */
body.hp-theme input:not([type="checkbox"]):not([type="radio"]),
body.hp-theme select,
body.hp-theme textarea {
    border-color: #d9e2f0 !important;
    background: rgba(255,255,255,.96) !important;
    color: var(--hp-ink) !important;
    border-radius: .65rem;
    transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

body.hp-theme input:not([type="checkbox"]):not([type="radio"]):focus,
body.hp-theme select:focus,
body.hp-theme textarea:focus {
    border-color: #5b8cff !important;
    box-shadow: 0 0 0 3px rgba(57,120,246,.11) !important;
    outline: none;
}

body.hp-theme input[type="file"] {
    background: #f8faff !important;
}

body.hp-theme input::placeholder,
body.hp-theme textarea::placeholder {
    color: #a0aabd;
}

/* Tables. */
body.hp-theme table {
    border-collapse: separate;
    border-spacing: 0;
}

body.hp-theme table thead {
    background: linear-gradient(180deg, #f8faff 0%, #f3f6fc 100%) !important;
}

body.hp-theme table th {
    color: #64728a !important;
    font-weight: 700;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .045em;
}

body.hp-theme table td,
body.hp-theme table th {
    border-color: var(--hp-border) !important;
}

body.hp-theme table tbody tr {
    transition: background-color 150ms ease;
}

body.hp-theme table tbody tr:hover {
    background: #f7f9ff !important;
}

body.hp-theme .hover\\:bg-slate-50:hover {
    background-color: #f7f9ff !important;
}

/* ============================================================
   SYSTEM SETTINGS SIDEBAR — SINGLE SOURCE OF TRUTH
   ============================================================
   All sidebar navigation text, section labels, hover states and
   the active item are driven by the System Settings appearance
   values. No hard-coded white/blue navigation colors remain.
*/
body.hp-theme aside {
    background: linear-gradient(
        180deg,
        var(--system-sidebar-bg),
        color-mix(
            in srgb,
            var(--system-sidebar-bg) calc(100% - var(--system-sidebar-bg-secondary-weight)),
            var(--system-sidebar-bg-secondary) var(--system-sidebar-bg-secondary-weight)
        )
    ) !important;
    color: var(--system-sidebar-text) !important;
    box-shadow: 8px 0 30px rgba(49,91,173,.16);
    position: relative;
    z-index: 20;
}

body.hp-theme aside::after {
    content: "";
    position: absolute;
    inset: auto 0 0;
    height: 32%;
    pointer-events: none;
    background: linear-gradient(
        180deg,
        transparent,
        color-mix(in srgb, var(--system-sidebar-text) 10%, transparent)
    );
}

body.hp-theme aside nav {
    position: relative;
    z-index: 1;
}

body.hp-theme aside .border-blue-500\\/50 {
    border-color: color-mix(in srgb, var(--system-sidebar-text) 18%, transparent) !important;
}

body.hp-theme aside .text-blue-100,
body.hp-theme aside .text-slate-900,
body.hp-theme aside .text-slate-800,
body.hp-theme aside .text-slate-700,
body.hp-theme aside .text-slate-600,
body.hp-theme aside .text-slate-500,
body.hp-theme aside .text-slate-400 {
    color: var(--system-sidebar-text) !important;
}

body.hp-theme .sidebar-section {
    margin-bottom: .18rem;
}

body.hp-theme .sidebar-section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: .52rem .68rem;
    color: var(--system-sidebar-text) !important;
    font-size: .66rem;
    line-height: 1rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .09em;
    cursor: pointer;
    list-style: none;
    user-select: none;
    opacity: .78;
}

body.hp-theme .sidebar-section-title::-webkit-details-marker,
body.hp-theme .sidebar-section-title::marker {
    display: none;
}

body.hp-theme .sidebar-chevron {
    font-size: .85rem;
    line-height: .7rem;
    color: var(--system-sidebar-text) !important;
    opacity: .72;
    transition: transform 160ms ease;
}

body.hp-theme .sidebar-section[open] .sidebar-chevron {
    transform: rotate(180deg);
}

body.hp-theme .sidebar-section-content {
    padding: .05rem .15rem .35rem;
}

body.hp-theme .sidebar-link {
    display: flex;
    align-items: center;
    min-height: 31px;
    padding: .36rem .7rem;
    margin: 2px 0;
    border-radius: .55rem;
    font-size: .78rem;
    line-height: 1rem;
    font-weight: 600;
    color: var(--system-sidebar-text) !important;
    transition: background-color 160ms ease, color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

body.hp-theme .sidebar-link:hover {
    background: color-mix(in srgb, var(--system-sidebar-text) 16%, transparent) !important;
    color: var(--system-sidebar-text) !important;
    transform: translateX(2px);
}

body.hp-theme aside nav a {
    color: var(--system-sidebar-text) !important;
}

body.hp-theme aside nav a:hover {
    background: color-mix(in srgb, var(--system-sidebar-text) 16%, transparent) !important;
    color: var(--system-sidebar-text) !important;
}

body.hp-theme aside nav a.bg-blue-50,
body.hp-theme aside nav a.bg-white,
body.hp-theme aside .bg-blue-600 {
    background: var(--system-sidebar-active-bg) !important;
    color: var(--system-sidebar-active-text) !important;
}

body.hp-theme aside .bg-white {
    background: var(--system-sidebar-active-bg) !important;
    color: var(--system-sidebar-active-text) !important;
}

body.hp-theme aside .bg-white\\/20 {
    background: color-mix(in srgb, var(--system-sidebar-text) 16%, transparent) !important;
}

body.hp-theme .sidebar-link.sidebar-link-active {
    background: var(--system-sidebar-active-bg) !important;
    color: var(--system-sidebar-active-text) !important;
    box-shadow: 0 4px 12px rgba(20,55,135,.14) !important;
}

body.hp-theme .sidebar-link.sidebar-link-active:hover {
    background: var(--system-sidebar-active-bg) !important;
    color: var(--system-sidebar-active-text) !important;
}

/* Top bar. */
body.hp-theme header {
    background: rgba(255,255,255,.96) !important;
    border-bottom-color: #e4eaf4 !important;
    box-shadow: 0 4px 18px rgba(65,89,128,.07);
    backdrop-filter: blur(12px);
}

body.hp-theme header .text-slate-800,
body.hp-theme header .text-slate-700 {
    color: #2b3952 !important;
}

body.hp-theme header a:hover,
body.hp-theme header button:hover {
    background-color: #f3f6ff !important;
}

body.hp-theme header .bg-slate-100 {
    background-color: #f0f4ff !important;
}

body.hp-theme header .border-slate-200 {
    border-color: #e3e9f3 !important;
}

/* Main page surfaces: turn existing white Tailwind blocks into the reference's soft cards. */
body.hp-theme main > div > div.bg-white,
body.hp-theme main .bg-white.rounded-lg,
body.hp-theme main .bg-white.rounded-xl,
body.hp-theme main .bg-white.rounded-2xl {
    border-color: rgba(220,228,241,.92) !important;
    box-shadow: var(--hp-shadow) !important;
}

body.hp-theme main .bg-white.rounded-lg:hover,
body.hp-theme main .bg-white.rounded-xl:hover,
body.hp-theme main .bg-white.rounded-2xl:hover {
    box-shadow: var(--hp-shadow-hover) !important;
}

/* Dashboard hero. */
body.hp-theme.hp-dashboard-page main .bg-white.rounded-xl:first-child {
    background:
        radial-gradient(circle at 100% 0%, rgba(109,157,255,.10), transparent 35%),
        linear-gradient(135deg, #ffffff 0%, #f7faff 100%) !important;
}

/* Colorful KPI cards — modeled on the supplied reference. */
body.hp-theme.hp-dashboard-page main .grid.grid-cols-2 > div,
body.hp-theme.hp-dashboard-page main .grid.grid-cols-1.md\\:grid-cols-2 > div {
    position: relative;
    overflow: hidden;
}

body.hp-theme.hp-admin-page main .grid.grid-cols-2.lg\\:grid-cols-3.xl\\:grid-cols-6 > div:nth-child(1),
body.hp-theme.hp-dealer-page main .grid.grid-cols-1.md\\:grid-cols-2.xl\\:grid-cols-5 > div:nth-child(1) {
    background: linear-gradient(135deg, #9b62f6 0%, #6f7bf7 100%) !important;
    color: #fff !important;
}

body.hp-theme.hp-admin-page main .grid.grid-cols-2.lg\\:grid-cols-3.xl\\:grid-cols-6 > div:nth-child(2),
body.hp-theme.hp-dealer-page main .grid.grid-cols-1.md\\:grid-cols-2.xl\\:grid-cols-5 > div:nth-child(2) {
    background: linear-gradient(135deg, #48a8ff 0%, #4e78f5 100%) !important;
    color: #fff !important;
}

body.hp-theme.hp-admin-page main .grid.grid-cols-2.lg\\:grid-cols-3.xl\\:grid-cols-6 > div:nth-child(3),
body.hp-theme.hp-dealer-page main .grid.grid-cols-1.md\\:grid-cols-2.xl\\:grid-cols-5 > div:nth-child(3) {
    background: linear-gradient(135deg, #ef668f 0%, #ff9a62 100%) !important;
    color: #fff !important;
}

body.hp-theme.hp-admin-page main .grid.grid-cols-2.lg\\:grid-cols-3.xl\\:grid-cols-6 > div:nth-child(4),
body.hp-theme.hp-dealer-page main .grid.grid-cols-1.md\\:grid-cols-2.xl\\:grid-cols-5 > div:nth-child(4) {
    background: linear-gradient(135deg, #42d59b 0%, #75d95d 100%) !important;
    color: #fff !important;
}

body.hp-theme.hp-admin-page main .grid.grid-cols-2.lg\\:grid-cols-3.xl\\:grid-cols-6 > div:nth-child(5),
body.hp-theme.hp-dealer-page main .grid.grid-cols-1.md\\:grid-cols-2.xl\\:grid-cols-5 > div:nth-child(5) {
    background: linear-gradient(135deg, #ffae63 0%, #f2cf58 100%) !important;
    color: #fff !important;
}

body.hp-theme.hp-admin-page main .grid.grid-cols-2.lg\\:grid-cols-3.xl\\:grid-cols-6 > div:nth-child(6) {
    background: linear-gradient(135deg, #5c9cff 0%, #43c8e9 100%) !important;
    color: #fff !important;
}

body.hp-theme.hp-dashboard-page main .grid.grid-cols-2.lg\\:grid-cols-3.xl\\:grid-cols-6 > div *,
body.hp-theme.hp-dealer-page main .grid.grid-cols-1.md\\:grid-cols-2.xl\\:grid-cols-5 > div * {
    color: inherit;
}

body.hp-theme.hp-dashboard-page main .grid.grid-cols-2.lg\\:grid-cols-3.xl\\:grid-cols-6 > div .bg-slate-100,
body.hp-theme.hp-dashboard-page main .grid.grid-cols-2.lg\\:grid-cols-3.xl\\:grid-cols-6 > div .bg-amber-50,
body.hp-theme.hp-dashboard-page main .grid.grid-cols-2.lg\\:grid-cols-3.xl\\:grid-cols-6 > div .bg-blue-50,
body.hp-theme.hp-dashboard-page main .grid.grid-cols-2.lg\\:grid-cols-3.xl\\:grid-cols-6 > div .bg-emerald-50,
body.hp-theme.hp-dashboard-page main .grid.grid-cols-2.lg\\:grid-cols-3.xl\\:grid-cols-6 > div .bg-rose-50 {
    background: rgba(255,255,255,.18) !important;
    color: #fff !important;
}

/* Dashboard sections and chart surfaces. */
body.hp-theme.hp-dashboard-page .trend-live-summary .bg-sky-50 {
    background-color: #eef6ff !important;
}

body.hp-theme.hp-dashboard-page .trend-live-summary .text-sky-700 {
    color: #4b78b7 !important;
}

body.hp-theme.hp-dashboard-page #applicationsChart {
    width: 100% !important;
}

body.hp-theme.hp-dashboard-page .bg-slate-50 {
    background: #f6f9ff !important;
}

/* Status colors remain intentional and readable. */
body.hp-theme .bg-green-100 {
    background: #e5fbf1 !important;
}
body.hp-theme .text-green-700,
body.hp-theme .text-green-600 {
    color: #159b68 !important;
}
body.hp-theme .bg-amber-100 {
    background: #fff4dc !important;
}
body.hp-theme .text-amber-700,
body.hp-theme .text-amber-600 {
    color: #c77a16 !important;
}
body.hp-theme .bg-red-100,
body.hp-theme .bg-rose-100 {
    background: #ffe8ec !important;
}
body.hp-theme .text-red-700,
body.hp-theme .text-red-600,
body.hp-theme .text-rose-700,
body.hp-theme .text-rose-600 {
    color: #d94c61 !important;
}
body.hp-theme .bg-blue-100,
body.hp-theme .bg-indigo-100 {
    background: #e9f1ff !important;
}
body.hp-theme .text-indigo-700 {
    color: #6752d8 !important;
}

/* Footer. */
body.hp-theme footer {
    background: rgba(255,255,255,.94);
    border-top-color: #e3e9f3 !important;
}

body.hp-theme header h1.nirvana-accent::after {
    display: none !important;
}

body.hp-theme #notificationDropdown a,
body.hp-theme #notificationDropdown button {
    text-decoration: none !important;
}

body.hp-theme #notificationDropdown a:hover,
body.hp-theme #notificationDropdown button:hover {
    text-decoration: none !important;
}

/* Reports and compact action groups. */
body.hp-theme .report-actions {
    gap: .5rem !important;
}

body.hp-theme .report-action {
    display: inline-flex !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: max-content !important;
    flex: 0 0 auto !important;
    align-items: center !important;
    justify-content: center !important;
    white-space: nowrap !important;
    padding: .48rem .78rem !important;
    margin: 0 !important;
    border-radius: .6rem !important;
    font-size: .75rem !important;
    line-height: 1rem !important;
    font-weight: 700 !important;
    text-decoration: none !important;
    box-sizing: border-box !important;
}

body.hp-theme .report-action-primary {
    background: linear-gradient(135deg, #4d86ff, #376fe9) !important;
    color: #fff !important;
    border: 1px solid #3d76ed !important;
    box-shadow: 0 6px 15px rgba(57,120,246,.16) !important;
}

body.hp-theme .report-action-primary:hover {
    background: linear-gradient(135deg, #376fe9, #2e5fd0) !important;
    color: #fff !important;
}

body.hp-theme .report-action-secondary {
    background: #fff !important;
    color: #43516a !important;
    border: 1px solid #d9e2ef !important;
}

body.hp-theme .report-action-secondary:hover {
    background: #f3f6ff !important;
    color: #26364f !important;
}

/* Responsive tightening without changing application behavior. */
@media (max-width: 1024px) {
    body.hp-theme aside {
        width: 15rem;
    }

    body.hp-theme main {
        padding: 1rem !important;
    }
}

@media (max-width: 640px) {
    body.hp-theme aside {
        width: 13rem;
    }

    body.hp-theme header > div {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    body.hp-theme .trend-live-summary {
        justify-content: flex-start;
        width: 100%;
    }

    body.hp-theme .report-actions {
        gap: .4rem !important;
    }

    body.hp-theme .report-action {
        padding: .4rem .65rem !important;
    }
}

/* Loading animation preserved from the existing system. */
.sidebar-loading-logo {
    transform-origin: center center;
    backface-visibility: hidden;
}

body.hp-theme.page-loading .sidebar-loading-logo {
    animation: nirvana-logo-loading 1.15s linear infinite;
}

@keyframes nirvana-logo-loading {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    body.hp-theme.page-loading .sidebar-loading-logo {
        animation: none;
    }
}

/* Keep the first-login screen compact; the in-app font controller starts after authentication. */
body.hp-theme.hp-auth-page {
    font-size: 14px;
}
body.hp-theme.hp-auth-page .auth-brand-panel h1 {
    font-size: 2.15rem !important;
    line-height: 1.15 !important;
}
body.hp-theme.hp-auth-page .auth-brand-panel p.text-lg {
    font-size: 1rem !important;
    line-height: 1.65 !important;
}
body.hp-theme.hp-auth-page .auth-card h2 {
    font-size: 1.1rem !important;
}
body.hp-theme.hp-auth-page .auth-card input:not([type="checkbox"]):not([type="radio"]) {
    font-size: .875rem !important;
}
body.hp-theme.hp-auth-page .auth-card button,
body.hp-theme.hp-auth-page .auth-card a {
    font-size: .875rem !important;
}
body.hp-theme.hp-auth-page .auth-card label {
    font-size: .8125rem !important;
}
body.hp-theme.hp-auth-page .auth-card p,
body.hp-theme.hp-auth-page .auth-card span {
    font-size: .8125rem;
}
body.hp-theme.hp-auth-page .auth-card .text-xs {
    font-size: .75rem !important;
}

/* Public authentication screens use the same light colorful visual language. */
body.hp-theme.hp-auth-page {
    min-height: 100vh;
    overflow: auto !important;
    background:
        radial-gradient(circle at 12% 8%, rgba(255,255,255,.16), transparent 25%),
        radial-gradient(circle at 88% 90%, rgba(142,92,246,.12), transparent 28%),
        linear-gradient(135deg, #b88918 0%, #d0a52c 52%, #b98212 100%) !important;
}

body.hp-theme.hp-auth-page .auth-brand-panel {
    background:
        radial-gradient(circle at 20% 10%, rgba(126,183,255,.48), transparent 32%),
        linear-gradient(145deg, #4b83f7 0%, #376fe8 52%, #7658dc 100%) !important;
}

body.hp-theme.hp-auth-page .auth-card {
    border: 1px solid rgba(220,228,241,.95) !important;
    box-shadow: 0 18px 45px rgba(35,59,106,.13) !important;
}

@media (max-width: 767px) {
    body.hp-theme {
        overflow-x: hidden;
    }

    body.hp-theme aside {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(50vw, 240px) !important;
        max-width: 240px !important;
        transform: translateX(-110%);
        transition: transform 220ms ease;
        z-index: 50;
        overflow-y: auto;
        overflow-x: hidden;
    }

    body.hp-theme aside.mobile-sidebar-open {
        transform: translateX(0);
    }

    body.hp-theme #mobileSidebarBackdrop {
        z-index: 40;
    }

    body.hp-theme #mobileSidebarBackdrop:not(.hidden) {
        display: block;
    }

    body.hp-theme aside nav {
        padding-bottom: 4rem;
    }

    body.hp-theme aside .sidebar-link {
        min-height: 36px;
        padding: .48rem .72rem;
        font-size: .82rem;
    }

    body.hp-theme aside .sidebar-section-title {
        padding: .58rem .72rem;
        font-size: .68rem;
    }

    body.hp-theme aside .font-size-control-toggle {
        min-height: 2.4rem;
    }

    body.hp-theme aside .font-size-control-panel {
        max-width: 100%;
    }

    body.hp-theme main {
        min-width: 0;
        width: 100%;
    }

    body.hp-theme main > div {
        min-width: 0;
        max-width: 100%;
    }

    body.hp-theme main .overflow-x-auto {
        max-width: 100%;
    }

    body.hp-theme header {
        min-height: 64px;
    }

    body.hp-theme header > div {
        min-width: 0;
    }

    body.hp-theme header h1 {
        font-size: .95rem;
        line-height: 1.25rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    body.hp-theme header p {
        font-size: .7rem;
        line-height: 1rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 42vw;
    }

    body.hp-theme header .relative {
        flex-shrink: 0;
    }

    body.hp-theme header .w-10 {
        width: 2.25rem;
        height: 2.25rem;
    }

    body.hp-theme main {
        padding: .75rem !important;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
    }

    body.hp-theme main > * {
        max-width: 100%;
        min-width: 0;
    }

    body.hp-theme main .grid {
        min-width: 0;
    }

    body.hp-theme main .grid > * {
        min-width: 0;
    }

    body.hp-theme main table {
        display: block;
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    body.hp-theme main table th,
    body.hp-theme main table td {
        white-space: nowrap;
    }

    body.hp-theme main .overflow-x-auto {
        max-width: 100%;
        -webkit-overflow-scrolling: touch;
    }

    body.hp-theme main .text-3xl {
        font-size: 1.6rem;
        line-height: 2rem;
    }

    body.hp-theme main .text-2xl {
        font-size: 1.35rem;
        line-height: 1.75rem;
    }

    body.hp-theme main .p-8 {
        padding: 1rem !important;
    }

    body.hp-theme main .p-6 {
        padding: 1rem !important;
    }

    body.hp-theme main .px-8 {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    body.hp-theme main .gap-8 {
        gap: 1rem !important;
    }

    body.hp-theme main .gap-6 {
        gap: .875rem !important;
    }

    body.hp-theme footer {
        padding-left: .75rem;
        padding-right: .75rem;
        text-align: center;
    }

    body.hp-theme input:not([type="checkbox"]):not([type="radio"]),
    body.hp-theme select,
    body.hp-theme textarea {
        max-width: 100%;
        font-size: 16px;
    }

    body.hp-theme button,
    body.hp-theme a {
        -webkit-tap-highlight-color: transparent;
    }
}

@media (max-width: 767px) {
    body.hp-theme main {
        width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    body.hp-theme main .grid {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    body.hp-theme main .flex {
        min-width: 0;
    }

    body.hp-theme main .flex:not(.items-center) {
        flex-wrap: wrap;
    }

    body.hp-theme main [class~="w-full"],
    body.hp-theme main [class~="w-96"],
    body.hp-theme main [class~="w-80"],
    body.hp-theme main [class~="w-72"],
    body.hp-theme main [class~="w-64"],
    body.hp-theme main [class~="w-1\/2"],
    body.hp-theme main [class~="w-1\/3"],
    body.hp-theme main [class~="w-2\/3"] {
        max-width: 100% !important;
    }

    body.hp-theme main [class~="w-96"],
    body.hp-theme main [class~="w-80"],
    body.hp-theme main [class~="w-72"],
    body.hp-theme main [class~="w-64"] {
        width: 100% !important;
    }

    body.hp-theme main .space-x-6 > *,
    body.hp-theme main .space-x-5 > *,
    body.hp-theme main .space-x-4 > *,
    body.hp-theme main .space-x-3 > * {
        margin-left: 0 !important;
        margin-right: .5rem;
    }

    body.hp-theme main form {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    body.hp-theme main form .flex,
    body.hp-theme main .form-row {
        width: 100%;
        min-width: 0;
    }

    body.hp-theme main form button,
    body.hp-theme main form a[class*="px-"] {
        max-width: 100%;
    }

    body.hp-theme main img {
        max-width: 100%;
        height: auto;
    }

    body.hp-theme main pre,
    body.hp-theme main code {
        max-width: 100%;
        overflow-x: auto;
        white-space: pre-wrap;
        overflow-wrap: anywhere;
    }

    body.hp-theme main .overflow-hidden {
        min-width: 0;
    }

    body.hp-theme main .rounded-xl,
    body.hp-theme main .rounded-2xl {
        max-width: 100%;
    }

    body.hp-theme main .gap-4,
    body.hp-theme main .gap-3,
    body.hp-theme main .gap-2 {
        row-gap: .6rem;
    }

    body.hp-theme main input[type="file"] {
        width: 100%;
        max-width: 100%;
    }

    body.hp-theme.hp-dashboard-page main > * {
        width: 100%;
    }

    body.hp-theme.hp-dashboard-page main .grid > div {
        width: 100%;
        min-width: 0;
    }

    body.hp-theme main .overflow-x-auto {
        width: 100%;
        max-width: 100%;
        overflow-x: auto !important;
    }
}

@media (max-width: 767px) {
    body.hp-theme > .flex.h-screen {
        display: flex;
        flex-direction: column;
        width: 100%;
        max-width: 100%;
    }

    body.hp-theme > .flex.h-screen > div.flex.flex-col {
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }

    body.hp-theme aside#app-sidebar {
        width: min(50vw, 240px) !important;
        max-width: 240px !important;
    }

    body.hp-theme #mobileSidebarBackdrop:not(.hidden) {
        display: block;
    }

    body.hp-theme header > div {
        gap: .5rem !important;
    }

    body.hp-theme header h1 {
        max-width: 48vw;
        font-size: .95rem !important;
    }

    body.hp-theme header p {
        max-width: 48vw;
    }

    body.hp-theme header .flex.items-center.gap-2,
    body.hp-theme header .flex.items-center.gap-4 {
        gap: .4rem !important;
    }

    body.hp-theme header form[action*="global_search"] {
        display: none !important;
    }

    body.hp-theme main [class*="grid-cols-"] {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    body.hp-theme main [class*="col-span-"] {
        grid-column: auto !important;
    }

    body.hp-theme main > *,
    body.hp-theme main .max-w-7xl,
    body.hp-theme main .max-w-6xl,
    body.hp-theme main .max-w-5xl,
    body.hp-theme main .max-w-4xl,
    body.hp-theme main .max-w-3xl,
    body.hp-theme main .max-w-2xl {
        width: 100%;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box;
    }

    body.hp-theme main .flex[class*="justify-between"],
    body.hp-theme main .flex[class*="justify-end"],
    body.hp-theme main .flex[class*="justify-start"] {
        flex-wrap: wrap;
        row-gap: .75rem;
    }

    body.hp-theme main .flex[class*="justify-between"] > :first-child {
        min-width: 0;
        max-width: 100%;
    }

    body.hp-theme main form > *,
    body.hp-theme main form .grid > *,
    body.hp-theme main form .flex > * {
        min-width: 0 !important;
        max-width: 100%;
    }

    body.hp-theme main input,
    body.hp-theme main select,
    body.hp-theme main textarea {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    body.hp-theme main input[type="checkbox"],
    body.hp-theme main input[type="radio"] {
        width: auto;
    }

    body.hp-theme main .flex > button,
    body.hp-theme main .flex > a {
        max-width: 100%;
        white-space: normal;
    }

    body.hp-theme main .overflow-x-auto {
        display: block;
        width: 100%;
        max-width: 100%;
        overflow-x: auto !important;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
    }

    body.hp-theme main .overflow-x-auto table {
        width: max-content;
        min-width: 100%;
    }

    body.hp-theme main .break-words,
    body.hp-theme main [class*="truncate"] {
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    body.hp-theme main .p-10,
    body.hp-theme main .p-9,
    body.hp-theme main .p-8 {
        padding: 1rem !important;
    }

    body.hp-theme main .p-7,
    body.hp-theme main .p-6 {
        padding: .9rem !important;
    }

    body.hp-theme main .px-10,
    body.hp-theme main .px-9,
    body.hp-theme main .px-8,
    body.hp-theme main .px-7 {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    body.hp-theme main .py-10,
    body.hp-theme main .py-9,
    body.hp-theme main .py-8 {
        padding-top: 1rem !important;
        padding-bottom: 1rem !important;
    }

    body.hp-theme.hp-dashboard-page main h1.text-4xl {
        font-size: 1.65rem !important;
        line-height: 2rem !important;
    }

    body.hp-theme.hp-dashboard-page main h2.text-3xl {
        font-size: 1.5rem !important;
        line-height: 1.9rem !important;
    }

    body.hp-theme main [class*="grid-cols-2"] > *,
    body.hp-theme main [class*="grid-cols-3"] > *,
    body.hp-theme main [class*="grid-cols-4"] > *,
    body.hp-theme main [class*="grid-cols-5"] > *,
    body.hp-theme main [class*="grid-cols-6"] > *,
    body.hp-theme main [class*="grid-cols-8"] > * {
        min-width: 0 !important;
    }

    body.hp-theme footer {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow: hidden;
    }
}

@media (max-width: 1023px) {
    body.hp-theme.hp-auth-page .auth-card {
        max-width: 100% !important;
    }

    body.hp-theme.hp-auth-page > div {
        width: 100%;
        min-width: 0;
    }
}

@media (min-width: 768px) {
    body.hp-theme {
        font-size: clamp(10px, calc(17px * var(--desktop-font-size, .75)), 22px);
    }

    body.hp-theme .text-sm { font-size: .9375rem !important; }
    body.hp-theme .text-base { font-size: 1rem !important; }

    body.hp-theme #desktopFontSizeControl {
        display: block !important;
        width: 100% !important;
        margin-top: .75rem !important;
        padding: .7rem !important;
        background: rgba(255,255,255,.12) !important;
        border: 1px solid rgba(255,255,255,.22) !important;
        border-radius: .75rem !important;
        color: inherit !important;
    }

    body.hp-theme #desktopFontSizeRange {
        width: 100% !important;
        min-width: 0 !important;
    }

    body.hp-theme .font-size-control-button {
        width: 2rem !important;
        min-width: 2rem !important;
        height: 2rem !important;
        padding: 0 !important;
        border-radius: .5rem !important;
        background: rgba(255,255,255,.16) !important;
        color: inherit !important;
        font-size: .8rem !important;
        font-weight: 700 !important;
    }
}

@media (max-width: 767px) {
    html { font-size: clamp(10px, calc(16px * var(--mobile-font-size, .75)), 22px); }
    body.hp-theme { font-size: 1rem; }
    body.hp-theme main { font-size: 1rem; }
    body.hp-theme main .text-xs { font-size: .78rem !important; }
    body.hp-theme main .text-sm { font-size: .9rem !important; }
    body.hp-theme main .text-base { font-size: 1rem !important; }
    body.hp-theme main .text-lg { font-size: 1.08rem !important; }
    body.hp-theme main .text-xl { font-size: 1.2rem !important; }
    body.hp-theme main .text-2xl { font-size: 1.4rem !important; }
    body.hp-theme header { min-height: 54px; }
    body.hp-theme header h1 { font-size: .95rem !important; line-height: 1.15rem !important; }
    body.hp-theme header p { font-size: .72rem !important; line-height: .9rem !important; }
    body.hp-theme header .w-10 { width: 2rem; height: 2rem; }
    body.hp-theme header .w-10 + div { display: none; }
    body.hp-theme header .relative { flex-shrink: 0; }
    body.hp-theme main label { font-size: .85rem; }
    body.hp-theme main button, body.hp-theme main a { font-size: .9rem; }

    body.hp-theme #mobileFontSizeControl {
        display: block !important;
        visibility: visible !important;
    }

    body.hp-theme #mobileFontSizeRange {
        min-width: 0 !important;
        width: 100% !important;
    }

    body.hp-theme #mobileFontSizeControl button {
        width: 2rem !important;
        min-width: 2rem !important;
        height: 2rem !important;
        padding: 0 !important;
        font-size: .8rem !important;
    }
}

@media (min-width: 768px) {
    #mobileFontSizeControl { display: none !important; }
    #mobileLogoSpin { display: none !important; }
}

/* Global font scaling is applied directly to every rendered element by the navbar font-size controller. */

@media (min-width: 768px) {
    body.hp-theme #desktopFontSizeControl {
        display: block !important;
        width: 100% !important;
        margin-top: .75rem !important;
        color: inherit !important;
    }

    body.hp-theme .font-size-control-toggle {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        width: 100% !important;
        min-height: 2.35rem !important;
        padding: .55rem .7rem !important;
        border: 0 !important;
        background: transparent !important;
        color: inherit !important;
        cursor: pointer !important;
        font-weight: 700 !important;
        text-align: left !important;
    }

    body.hp-theme .font-size-control-panel {
        margin-top: .25rem !important;
        padding: .65rem .7rem .7rem !important;
        background: rgba(255,255,255,.12) !important;
        border: 1px solid rgba(255,255,255,.22) !important;
        border-radius: .75rem !important;
        overflow: hidden !important;
    }

    body.hp-theme .font-size-control-panel-scroll {
        max-height: 7rem !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        padding-right: .15rem !important;
    }

    body.hp-theme #desktopFontSizeRange {
        width: 100% !important;
        min-width: 0 !important;
    }

    body.hp-theme .font-size-control-button {
        width: 2rem !important;
        min-width: 2rem !important;
        height: 2rem !important;
        padding: 0 !important;
        border-radius: .5rem !important;
        background: rgba(255,255,255,.16) !important;
        color: inherit !important;
        font-weight: 700 !important;
        cursor: pointer !important;
    }
}

@media (max-width: 767px) {
    body.hp-theme #mobileFontSizeControl {
        display: block !important;
        visibility: visible !important;
    }

    body.hp-theme #mobileFontSizeRange {
        min-width: 0 !important;
        width: 100% !important;
    }

    body.hp-theme #mobileFontSizeControl button {
        width: 2rem !important;
        min-width: 2rem !important;
        height: 2rem !important;
        padding: 0 !important;
        font-size: .8rem !important;
    }
}

/* Global typography scale. */
:root {
    --hp-font-scale: .75;
    --hp-font-min: 10px;
    --hp-font-max: 22px;
}

html {
    font-size: clamp(var(--hp-font-min), calc(16px * var(--hp-font-scale)), var(--hp-font-max));
}

body.hp-theme {
    font-size: clamp(var(--hp-font-min), calc(16px * var(--hp-font-scale)), var(--hp-font-max));
}

body.hp-theme.hp-auth-page {
    font-size: clamp(var(--hp-font-min), calc(16px * var(--hp-font-scale)), var(--hp-font-max)) !important;
}

body.hp-theme.hp-auth-page .auth-brand-panel h1 {
    font-size: clamp(var(--hp-font-min), calc(34.4px * var(--hp-font-scale)), var(--hp-font-max)) !important;
}

body.hp-theme.hp-auth-page .auth-brand-panel p.text-lg {
    font-size: clamp(var(--hp-font-min), calc(16px * var(--hp-font-scale)), var(--hp-font-max)) !important;
}

body.hp-theme.hp-auth-page .auth-card h2 {
    font-size: clamp(var(--hp-font-min), calc(17.6px * var(--hp-font-scale)), var(--hp-font-max)) !important;
}

body.hp-theme.hp-auth-page .auth-card input:not([type="checkbox"]):not([type="radio"]),
body.hp-theme.hp-auth-page .auth-card button,
body.hp-theme.hp-auth-page .auth-card a {
    font-size: clamp(var(--hp-font-min), calc(14px * var(--hp-font-scale)), var(--hp-font-max)) !important;
}

body.hp-theme.hp-auth-page .auth-card label,
body.hp-theme.hp-auth-page .auth-card p,
body.hp-theme.hp-auth-page .auth-card span {
    font-size: clamp(var(--hp-font-min), calc(13px * var(--hp-font-scale)), var(--hp-font-max)) !important;
}

body.hp-theme.hp-auth-page .auth-card .text-xs {
    font-size: clamp(var(--hp-font-min), calc(12px * var(--hp-font-scale)), var(--hp-font-max)) !important;
}

/* Final sidebar color guard.
   This is intentionally at the end of the stylesheet so no earlier
   Tailwind/theme rule can override the System Settings values. */
body.hp-theme aside,
body.hp-theme aside nav a,
body.hp-theme aside .sidebar-link,
body.hp-theme aside .sidebar-section-title,
body.hp-theme aside .sidebar-chevron {
    color: var(--system-sidebar-text) !important;
}

body.hp-theme aside nav a:hover,
body.hp-theme aside .sidebar-link:hover {
    background: color-mix(in srgb, var(--system-sidebar-text) 16%, transparent) !important;
    color: var(--system-sidebar-text) !important;
}

body.hp-theme aside nav a.sidebar-link-active,
body.hp-theme aside .sidebar-link.sidebar-link-active,
body.hp-theme aside nav a.bg-blue-50,
body.hp-theme aside nav a.bg-white,
body.hp-theme aside .bg-blue-600 {
    background: var(--system-sidebar-active-bg) !important;
    color: var(--system-sidebar-active-text) !important;
}

body.hp-theme aside nav a.sidebar-link-active:hover,
body.hp-theme aside .sidebar-link.sidebar-link-active:hover {
    background: var(--system-sidebar-active-bg) !important;
    color: var(--system-sidebar-active-text) !important;
}
