/* :root:root raises specificity so these tokens win over the compiled
               Tailwind/daisyUI :root layer (which loads after this inline style). */
            :root:root,
            [data-theme],
            [data-theme="innerloop-theme"] {
                --radius-box: 0.5rem;
                --radius-field: 0.5rem;
                --radius-selector: 0.5rem;
                /* Border + elevation (driven by Design System > Borders / Shadows) */
                --border: 1px;
                --border-width: 1px;
                --ds-shadow-sm: 0 1px 2px rgb(0 0 0 / 0.05);
                --ds-shadow-md: 0 6px 16px -6px rgb(0 0 0 / 0.12);
                --ds-shadow-lg: 0 18px 40px -18px rgb(0 0 0 / 0.22);
                --color-primary: #4f46e5;
                --color-primary-content: #ffffff;
                --color-secondary: #64748b;
                --color-secondary-content: #ffffff;
                --color-accent: #06b6d4;
                --color-accent-content: #0f172a;
                --color-neutral: #1e293b;
                --color-neutral-content: #ffffff;
                                /* Typography tokens (driven by Design System > Typography) */
                --font-size-sm: 0.875rem;
                --font-size-base: 1rem;
                --font-size-lg: 1.125rem;
                --font-size-xl: 1.25rem;
                --font-weight-normal: 400;
                --font-weight-medium: 500;
                --font-weight-semibold: 600;
                --font-weight-bold: 700;
                /* NOTE: font stacks are printed raw (NOT esc_attr'd) — they live in a
                   <style> block, which is raw text in HTML: entities would NOT be decoded,
                   so esc_attr() would turn 'Inter' into &#039;Inter&#039; (an unknown
                   family → serif fallback). Values come from the trusted registry above. */
                --font-sans: 'Inter', 'system-ui', sans-serif;
                --font-display: 'Inter', 'system-ui', sans-serif;
                --font-size-root: 1rem;
                --heading-font-weight: 600;
            }

            /* Typography application: base scale on html, display font & weight on headings */
            html {
                font-size: var(--font-size-root);
            }
            h1, h2, h3, h4, h5, h6, .font-display {
                font-family: var(--font-display);
            }
            h1, h2, h3, h4, h5, h6 {
                font-weight: var(--heading-font-weight);
            }

            /* Make Tailwind's fixed rounded-* utilities follow the Design System
               radius so EVERY container, button, card and menu item (not just
               daisyUI components) respects the radius setting — consistency
               throughout. Avatars, badges and pills keep rounded-full (always
               circular), and rounded-none stays square. These rules are unlayered,
               so they beat the compiled Tailwind utility layer. */
            .rounded-sm,
            .rounded,
            .rounded-md,
            .rounded-lg,
            .rounded-xl,
            .rounded-2xl,
            .rounded-3xl {
                border-radius: var(--radius-box);
            }

            /* Elevation: Tailwind's fixed shadow utilities follow the Design
               System shadow scale. Unlayered, so they beat the utility layer. */
            .shadow-sm,
            .shadow {
                box-shadow: var(--ds-shadow-sm);
            }
            .shadow-md {
                box-shadow: var(--ds-shadow-md);
            }
            .shadow-lg,
            .shadow-xl,
            .shadow-2xl {
                box-shadow: var(--ds-shadow-lg);
            }

            /* Borders: component borders follow the Design System width.
               `.border-0` stays the explicit escape hatch for a one-off
               borderless element. */
            .border {
                border-width: var(--border-width);
            }
            .border-t {
                border-top-width: var(--border-width);
            }
            .border-r {
                border-right-width: var(--border-width);
            }
            .border-b {
                border-bottom-width: var(--border-width);
            }
            .border-l {
                border-left-width: var(--border-width);
            }
            .border-x {
                border-inline-width: var(--border-width);
            }
            .border-y {
                border-block-width: var(--border-width);
            }
            .border-0 {
                border-width: 0;
            }

            /* Multi-line fields (textareas / paragraph fields) should never get the
               pill scale's 9999px --radius-field — that turns them into huge pills.
               Cap their radius at the box radius so "pill" stays workable, while
               single-line inputs keep the full pill. Unlayered so it beats daisyUI. */
            textarea,
            textarea.textarea,
            .textarea {
                border-radius: min(var(--radius-field), var(--radius-box));
            }

            /* Dark mode keeps daisyUI's own dark base palette; only the brand
               neutral accent (used by btn-neutral / status-neutral / neutral
               text & borders) is carried over so the brand survives dark mode
               without clobbering the dark background tokens. */
            [data-theme="innerloop-theme-dark"] {
                --color-neutral: #1e293b;
                --color-neutral-content: #ffffff;
                            }

            /* Default app canvas — brand-tinted gradient over the base surface.
               Token-driven: preset color changes flow through automatically, and
               the base adapts to light/dark mode (base-100 is white in light,
               near-black in dark). Gives every app page the immersive canvas.
               Sites that want a flat product surface select "Flat canvas" in
               Design System → Surface Mood (see .il-canvas-flat). */
            #main-content {
                background:
                    radial-gradient(1200px 620px at 85% -10%, color-mix(in oklch, var(--color-primary) 32%, transparent), transparent 62%),
                    radial-gradient(950px 520px at -8% 8%, color-mix(in oklch, var(--color-accent) 22%, transparent), transparent 56%),
                    radial-gradient(760px 760px at 50% 125%, color-mix(in oklch, var(--color-secondary) 18%, transparent), transparent 62%),
                    radial-gradient(600px 400px at 50% 50%, color-mix(in oklch, var(--color-primary) 6%, transparent), transparent 70%),
                    var(--color-base-200);
            }
            /* Custom scrollbar — thin, rounded, brand-tinted. */
            ::-webkit-scrollbar {
                width: 10px;
                height: 10px;
            }
            ::-webkit-scrollbar-track {
                background: var(--color-base-200);
                border-radius: 9999px;
            }
            ::-webkit-scrollbar-thumb {
                background: color-mix(in oklch, var(--color-base-content) 22%, transparent);
                border-radius: 9999px;
                border: 2px solid var(--color-base-200);
            }
            ::-webkit-scrollbar-thumb:hover {
                background: color-mix(in oklch, var(--color-primary) 55%, transparent);
            }
            ::-webkit-scrollbar-corner {
                background: var(--color-base-200);
            }
            * {
                scrollbar-width: thin;
                scrollbar-color: color-mix(in oklch, var(--color-base-content) 22%, transparent) var(--color-base-200);
            }
            .dark * , [data-theme="innerloop-theme-dark"] * {
                scrollbar-color: color-mix(in oklch, var(--color-base-content) 28%, transparent) var(--color-base-200);
            }

            /* Standalone pages (auth / 404 / error / maintenance) share the same
               immersive canvas. The form/content panel is glassed so the brand
               gradient glows through behind the card. */
            .il-standalone-message,
            .auth-wrap {
                background:
                    radial-gradient(1200px 620px at 85% -10%, color-mix(in oklch, var(--color-primary) 26%, transparent), transparent 62%),
                    radial-gradient(950px 520px at -8% 8%, color-mix(in oklch, var(--color-accent) 18%, transparent), transparent 56%),
                    radial-gradient(760px 760px at 50% 125%, color-mix(in oklch, var(--color-secondary) 14%, transparent), transparent 62%),
                    var(--color-base-100);
            }
            /* Left brand panel: dark neutral lifted by brand glows instead of a
               flat black slab — keeps the split layout but feels cohesive with
               the app canvas. Only the split auth layout (and the shared
               standalone message pages) owns a left panel. */
            .il-standalone-message > div:first-child,
            .auth-wrap.il-auth-split > div:first-child {
                position: relative;
                background:
                    radial-gradient(820px 560px at 18% 12%, color-mix(in oklch, var(--color-primary) 30%, transparent), transparent 55%),
                    radial-gradient(640px 640px at 88% 92%, color-mix(in oklch, var(--color-accent) 20%, transparent), transparent 60%),
                    radial-gradient(500px 500px at 60% 40%, color-mix(in oklch, var(--color-secondary) 14%, transparent), transparent 60%),
                    linear-gradient(160deg, var(--color-neutral), color-mix(in oklch, var(--color-neutral) 88%, var(--color-primary) 12%));
            }
            /* When a background image is set, keep the brand gradient as an
               overlay so the canvas aesthetic survives behind the artwork. */
            .il-standalone-message > div:first-child.has-bg-image,
            .auth-wrap.il-auth-split > div:first-child.has-bg-image {
                background-color: var(--color-neutral);
            }
            .il-standalone-message > div:first-child.has-bg-image::before,
            .auth-wrap.il-auth-split > div:first-child.has-bg-image::before {
                content: "";
                position: absolute;
                inset: 0;
                background:
                    radial-gradient(820px 560px at 18% 12%, color-mix(in oklch, var(--color-primary) 40%, transparent), transparent 55%),
                    radial-gradient(640px 640px at 88% 92%, color-mix(in oklch, var(--color-accent) 28%, transparent), transparent 60%),
                    linear-gradient(160deg, color-mix(in oklch, var(--color-neutral) 62%, transparent), color-mix(in oklch, var(--color-neutral) 28%, transparent));
                pointer-events: none;
            }
            /* Split brand panel: subtle dot grid so the large surface reads as
               intentional artwork rather than an empty block. */
            .auth-brand-panel::after {
                content: "";
                position: absolute;
                inset: 0;
                pointer-events: none;
                background-image: radial-gradient(color-mix(in oklch, var(--color-neutral-content) 16%, transparent) 1px, transparent 1px);
                background-size: 26px 26px;
                -webkit-mask-image: radial-gradient(ellipse at 28% 22%, #000 0%, transparent 68%);
                mask-image: radial-gradient(ellipse at 28% 22%, #000 0%, transparent 68%);
            }
            /* Right form/content panel: frosted glass card edge so the canvas
               and left panel flow together. Centered and minimal auth layouts
               keep a transparent panel so the brand canvas stays visible. */
            .il-standalone-message > div:last-child,
            .auth-wrap.il-auth-split > div:last-child {
                background: color-mix(in oklch, var(--color-base-100) 74%, transparent) !important;
                backdrop-filter: blur(22px);
                -webkit-backdrop-filter: blur(22px);
                border-left: 1px solid color-mix(in oklch, var(--color-base-100) 18%, transparent);
            }
            .auth-wrap.il-auth-centered > div:last-child,
            .auth-wrap.il-auth-minimal > div:last-child {
                background: transparent !important;
            }

            /* Auth forms: Formidable's per-form inline styles force the field
               container to block, which collapses the theme's field gap and
               makes labels sit on the previous input. Reinstate a comfortable
               single-column rhythm inside the auth canvas only. */
            .auth-wrap .frm_forms .frm_fields_container {
                display: flex !important;
                flex-direction: column;
                align-items: stretch !important;
                gap: 1.1rem !important;
            }

            /* Match the native auth forms: one full-width primary action. */
            .auth-wrap .frm_forms .frm_submit :is(button, input[type="submit"]) {
                width: 100% !important;
            }
            .dark .il-standalone-message,
            .dark .auth-wrap,
            [data-theme="innerloop-theme-dark"] .il-standalone-message,
            [data-theme="innerloop-theme-dark"] .auth-wrap {
                background:
                    radial-gradient(1200px 620px at 85% -10%, color-mix(in oklch, var(--color-primary) 24%, transparent), transparent 62%),
                    radial-gradient(950px 520px at -8% 8%, color-mix(in oklch, var(--color-accent) 17%, transparent), transparent 56%),
                    radial-gradient(760px 760px at 50% 125%, color-mix(in oklch, var(--color-secondary) 12%, transparent), transparent 62%),
                    var(--color-base-100);
            }

            /* ── Design System Global Component Variations ── */
            .il-card-default {
                            }

            /* Gradient button — brand primary → accent gradient, token-driven so
               it follows the active preset and works in light & dark mode. */
            .btn-gradient {
                background: linear-gradient(120deg,
                    var(--color-primary),
                    color-mix(in oklch, var(--color-accent) 55%, var(--color-primary)) 55%,
                    var(--color-accent)) !important;
                border: 0 !important;
                color: var(--color-primary-content) !important;
                box-shadow: 0 6px 24px color-mix(in oklch, var(--color-accent) 35%, transparent) !important;
            }
            .btn-gradient:hover {
                color: var(--color-primary-content) !important;
                box-shadow: 0 9px 30px color-mix(in oklch, var(--color-accent) 45%, transparent) !important;
            }

            /* Gradient display text — token-driven, light/dark safe. Used by the
               Innerloop Text widget's "Gradient" heading style (and reusable
               anywhere). */
            .il-text-gradient {
                background: linear-gradient(115deg,
                    var(--color-base-content),
                    color-mix(in oklch, var(--color-base-content) 70%, var(--color-primary)) 55%,
                    var(--color-accent) 90%);
                -webkit-background-clip: text;
                background-clip: text;
                -webkit-text-fill-color: transparent;
                color: transparent;
            }

            /* Robust joined button-group corners. Sets border-radius directly (not just
               the --join-* vars) so the first/last buttons round the outer corners
               and middle buttons square off on the shared edges — regardless of
               @scope support or other border-radius overrides. */
            .join:not(.join-vertical) > .btn.join-item:first-child:not(:last-child) {
                border-radius: var(--radius-field) 0 0 var(--radius-field) !important;
            }
            .join:not(.join-vertical) > .btn.join-item:last-child:not(:first-child) {
                border-radius: 0 var(--radius-field) var(--radius-field) 0 !important;
            }
            .join:not(.join-vertical) > .btn.join-item:not(:first-child):not(:last-child) {
                border-radius: 0 !important;
            }
            .join:not(.join-vertical) > .btn.join-item:only-child {
                border-radius: var(--radius-field) !important;
            }
            .join.join-vertical > .btn.join-item:first-child:not(:last-child) {
                border-radius: var(--radius-field) var(--radius-field) 0 0 !important;
            }
            .join.join-vertical > .btn.join-item:last-child:not(:first-child) {
                border-radius: 0 0 var(--radius-field) var(--radius-field) !important;
            }
            .join.join-vertical > .btn.join-item:not(:first-child):not(:last-child) {
                border-radius: 0 !important;
            }
            .join.join-vertical > .btn.join-item:only-child {
                border-radius: var(--radius-field) !important;
            }

            /* Floating Shell Layout Mode — "Floating Island" panel kit.
               Sidebar, top bar and footer each become a floating, rounded
               "island" over the base background (like Filament PHP). */
            
            /* Classic collapsed rail: keep the logo mark on top and put the
               expand control below it instead of squeezing both onto one line.
               Declared inline with the Design System so it survives static CSS
               caches. */
            @media (min-width: 1024px) {
                .il-shell-classic .il-sb-collapsed #app-sidebar > div:first-child {
                    flex-direction: column;
                    align-items: center;
                    justify-content: center;
                    height: auto !important;
                    min-height: 7.5rem;
                    padding-top: 1rem;
                    padding-bottom: 1rem;
                    gap: 0.75rem;
                }
                .il-shell-classic .il-sb-collapsed #app-sidebar > div:first-child > div {
                    justify-content: center;
                }
            }


            /* Header Style (glass / solid / minimal) — driven by the Design System.
               #topbar is an ID, so it beats the Tailwind utilities on the element. */
            #topbar {
                            }