/*
 * Thingy theme stylesheet.
 *
 * Served from /static/themes.css and linked by Theme.apply() in themes.py.
 * Colour tokens (--brand, --text-primary, ...) are NOT defined here: they are
 * emitted as :root custom properties by Theme.apply() from the constants at
 * the top of themes.py, which stay the single source of truth.
 *
 * Everything lives in the `components` cascade layer (declared by NiceGUI's
 * index.html: theme, base, quasar, nicegui, components, utilities, ...):
 * it beats Quasar/NiceGUI defaults, while Tailwind utilities on an element
 * still beat it. Breakpoint 768px must stay in sync with Tailwind's md:.
 */

@layer components {
    :root {
        --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system,
            "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
        --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo,
            Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    }

    /* ---------- Base ---------- */

    html {
        height: 100%;
        -webkit-text-size-adjust: 100%;
        text-size-adjust: 100%;
        background: var(--bg-page);
    }

    body {
        height: 100%;
        background: var(--bg-page);
        color: var(--text-primary);
        font-family: var(--font-sans);
        line-height: 1.65;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }

    /* Complete the height:100% chain so only the panel scrolls (the header,
       sidebar and mobile tab strip stay put). NiceGUI's structure is
       #app → .q-layout.nicegui-layout → .q-page-container → .q-page →
       .nicegui-content. Without these, Quasar's .q-page only has a
       min-height, every height:100% below it resolves to auto, and the whole
       document scrolls instead. The container's inline padding-top (header
       height) is included by box-sizing: border-box. */
    #app,
    .nicegui-layout,
    .nicegui-layout > .q-page-container,
    .nicegui-layout > .q-page-container > .q-page {
        height: 100%;
    }

    .nicegui-layout > .q-page-container > .q-page {
        /* Quasar's inline min-height (≈ 100vh − header) can exceed the visible
           mobile viewport and would bring back a document-level scroll */
        min-height: 0 !important;
    }

    ::selection {
        background: var(--brand-ring);
        color: var(--text-primary);
    }

    .font-mono {
        font-family: var(--font-mono);
    }

    .nicegui-content {
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        align-items: stretch;
        height: 100%;
        min-height: 0;
        overflow-y: auto;
    }

    /* ---------- Header ---------- */

    .app-header {
        background: var(--bg-surface);
        color: var(--text-primary);
        border-bottom: 1px solid var(--border);
        box-shadow: none;
        padding: 0 1.5rem;
    }

    .app-header-inner {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        width: 100%;
        height: 4rem;
    }

    .brand-link {
        display: inline-flex;
        align-items: center;
        gap: 0.625rem;
        color: var(--text-primary);
        text-decoration: none;
    }

    .brand-link:hover {
        opacity: 1;
    }

    .brand-mark {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 1.875rem;
        height: 1.875rem;
        border-radius: 0.5rem;
        background: linear-gradient(135deg, #6366f1 0%, var(--brand-hover) 100%);
        color: #ffffff;
        font-weight: 700;
        font-size: 0.95rem;
        line-height: 1;
        box-shadow:
            0 1px 2px rgba(67, 56, 202, 0.35),
            inset 0 1px 0 rgba(255, 255, 255, 0.2);
    }

    .brand-name {
        font-size: 1.125rem;
        font-weight: 700;
        letter-spacing: -0.015em;
        line-height: 1;
    }

    .app-header-actions {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        flex-shrink: 0;
    }

    .avatar-btn {
        width: 2.25rem;
        height: 2.25rem;
        min-width: 2.25rem;
        min-height: 2.25rem;
        padding: 0;
        background: var(--brand-tint);
        color: var(--brand);
        border: 1px solid var(--brand-ring);
        font-size: 0.875rem;
        font-weight: 600;
    }

    .user-menu {
        min-width: 15rem;
        max-width: 18rem;
        padding: 0.375rem;
        background: var(--bg-surface);
        border: 1px solid var(--border);
        border-radius: 0.75rem;
        box-shadow:
            0 12px 32px -12px rgba(15, 23, 42, 0.25),
            0 2px 6px rgba(15, 23, 42, 0.06);
    }

    .user-menu-header {
        display: flex;
        flex-direction: column;
        padding: 0.5rem 0.625rem;
        line-height: 1.35;
    }

    .user-menu-caption {
        font-size: 0.75rem;
        color: var(--text-muted);
    }

    .user-menu-email {
        font-size: 0.875rem;
        font-weight: 600;
        color: var(--text-primary);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .user-menu .q-separator {
        margin: 0.375rem 0;
        background: var(--border);
    }

    .user-menu-item {
        display: flex;
        align-items: center;
        gap: 0.625rem;
        min-height: 2.25rem;
        padding: 0 0.625rem;
        border-radius: 0.5rem;
        font-size: 0.875rem;
        color: var(--text-secondary);
    }

    .user-menu-item .q-icon {
        font-size: 1.125rem;
        color: var(--text-muted);
    }

    .user-menu-item-danger,
    .user-menu-item-danger .q-icon {
        color: var(--danger);
    }

    /* ---------- Buttons ---------- */

    .btn {
        border-radius: 0.5rem;
        font-weight: 600;
        letter-spacing: 0;
        transition:
            background-color 0.15s ease,
            border-color 0.15s ease,
            box-shadow 0.15s ease,
            transform 0.15s ease;
    }

    .btn .q-focus-helper {
        display: none;
    }

    .btn:focus-visible {
        outline: 2px solid var(--brand);
        outline-offset: 2px;
    }

    .btn-sm {
        min-height: 2.25rem;
        padding: 0 0.875rem;
        font-size: 0.875rem;
    }

    .btn-md {
        min-height: 2.5rem;
        padding: 0 1.125rem;
        font-size: 0.9375rem;
    }

    .btn-lg {
        min-height: 2.875rem;
        padding: 0 1.5rem;
        font-size: 1rem;
    }

    .btn-primary {
        color: #ffffff;
        box-shadow:
            0 1px 2px rgba(79, 70, 229, 0.25),
            0 4px 12px -4px rgba(79, 70, 229, 0.45);
    }

    .btn-primary:hover {
        background-color: var(--brand-hover) !important;
        transform: translateY(-1px);
    }

    .btn-secondary {
        background: var(--bg-surface);
        color: var(--text-primary);
        border: 1px solid var(--border);
        box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    }

    .btn-secondary:hover {
        border-color: #cbd5e1;
        background: var(--bg-page);
    }

    .btn-ghost {
        color: var(--text-secondary);
    }

    .btn-ghost:hover {
        color: var(--text-primary);
        background: rgba(15, 23, 42, 0.05);
    }

    .btn-danger {
        color: #ffffff;
    }

    .btn-danger:hover {
        background-color: #b91c1c !important;
    }

    /* ---------- Sidebar (desktop: vertical nav) ---------- */

    .sidebar {
        width: 15rem;
        flex-shrink: 0;
        height: 100%;
        gap: 0;
        background: var(--bg-sidebar);
        border-right: 1px solid var(--border);
        padding: 1.25rem 0.75rem;
        overflow-x: hidden;
        overflow-y: auto;
    }

    .sidebar .q-tabs,
    .sidebar .q-tabs__content {
        display: flex;
        flex-flow: column nowrap;
        align-items: stretch;
        width: 100%;
        max-width: 100%;
    }

    .sidebar .q-tabs {
        height: 100%;
        max-height: 100%;
    }

    .sidebar .q-tabs__content {
        flex: 1 1 auto;
        min-width: 0;
        min-height: 0;
        overflow-x: hidden;
        overflow-y: auto;
    }

    .sidebar .q-tabs__arrow {
        display: none !important;
    }

    .nav-group-label {
        flex: 0 0 auto;
        padding: 1.25rem 0.75rem 0.375rem;
        font-family: var(--font-mono);
        font-size: 0.6875rem;
        font-weight: 500;
        letter-spacing: 0.08em;
        line-height: 1rem;
        text-transform: uppercase;
        color: var(--text-muted);
    }

    .nav-group-label:first-child {
        padding-top: 0.25rem;
    }

    .sidebar .q-tabs__content .q-tab {
        position: relative;
        flex: 0 0 auto;
        justify-content: flex-start;
        min-height: 2.25rem;
        margin: 1px 0;
        padding: 0 0.75rem;
        border-radius: 0.5rem;
        color: var(--text-secondary);
        text-transform: none;
        opacity: 1;
        transition:
            background-color 0.15s ease,
            color 0.15s ease;
    }

    .sidebar .q-tabs__content .q-tab:hover {
        background: rgba(15, 23, 42, 0.04);
        color: var(--text-primary);
    }

    .sidebar .q-tab .q-focus-helper {
        display: none;
    }

    .sidebar .q-tab:focus-visible {
        outline: 2px solid var(--brand);
        outline-offset: -2px;
    }

    .sidebar .q-tab__icon {
        width: 1.125rem;
        height: 1.125rem;
        font-size: 1.125rem;
        color: var(--text-muted);
    }

    .sidebar .q-tab__content--inline .q-tab__icon + .q-tab__label {
        padding-left: 0.625rem;
    }

    .sidebar .q-tab__label {
        font-size: 0.875rem;
        font-weight: 500;
        line-height: 1.25rem;
    }

    .sidebar .q-tab--active {
        background-color: var(--brand-tint) !important;
    }

    .sidebar .q-tab--active .q-tab__label {
        font-weight: 600;
    }

    .sidebar .q-tab--active .q-tab__icon {
        color: var(--brand);
    }

    .sidebar .q-tab--active::before {
        content: "";
        position: absolute;
        left: 0;
        top: 0.5rem;
        bottom: 0.5rem;
        width: 3px;
        border-radius: 0 3px 3px 0;
        background: var(--brand);
    }

    .sidebar .q-tab__indicator {
        display: none;
    }

    /* ---------- Content area ---------- */

    .page-body {
        /* NiceGUI rows default to align-items: flex-start, which sizes
           .content-area to its content height on desktop; stretch makes it
           exactly the row's height, so only its .q-tab-panel scrolls.
           Only works because the row is ui.row(wrap=False): in a wrapping
           row, stretch fills the flex *line* (as tall as the tallest
           item), not the row, so it would be a no-op. */
        align-items: stretch;
    }

    .content-area {
        flex: 1 1 0;
        min-height: 0;
        min-width: 0;
        overflow-y: hidden;
        padding: 2rem;
        background: var(--bg-surface);
    }

    .content-area .q-tab-panel {
        height: 100%;
        overflow-y: auto;
        scrollbar-width: thin;
        scrollbar-color: #cbd5e1 transparent;
    }

    .centered-page {
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        padding: 2rem;
        overflow-y: auto;
    }

    .centered-page > * {
        margin-block: auto;
    }

    /* ---------- Typography helpers ---------- */

    .eyebrow {
        font-family: var(--font-mono);
        font-size: 0.75rem;
        font-weight: 500;
        letter-spacing: 0.04em;
        color: var(--brand);
    }

    .doc-section {
        padding-top: 2rem;
        border-top: 1px solid var(--border);
    }

    .doc-section-heading {
        display: flex;
        align-items: center;
        gap: 0.75rem;
    }

    .doc-section-number {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        min-width: 1.75rem;
        height: 1.75rem;
        padding: 0 0.375rem;
        border-radius: 0.5rem;
        background: var(--brand-tint);
        color: var(--brand);
        font-family: var(--font-mono);
        font-size: 0.8125rem;
        font-weight: 600;
    }

    .field-text {
        overflow-wrap: anywhere;
    }

    .prose-text {
        max-width: 100%;
        font-size: 1rem;
        line-height: 1.75;
        color: var(--text-secondary);
    }

    .subheading {
        margin-top: 0.25rem;
        font-size: 1.0625rem;
        font-weight: 600;
        letter-spacing: -0.01em;
        color: var(--text-primary);
    }

    .text-link {
        color: var(--brand);
        font-weight: 500;
        text-decoration: none;
    }

    .text-link:hover {
        text-decoration: underline;
        text-underline-offset: 3px;
        opacity: 1;
    }

    /* ---------- Cards ---------- */

    .surface-card {
        background: var(--bg-surface);
        border: 1px solid var(--border);
        border-radius: 0.875rem;
        box-shadow:
            0 1px 2px rgba(15, 23, 42, 0.04),
            0 1px 3px rgba(15, 23, 42, 0.03);
    }

    /* ---------- Code window ---------- */

    .code-window {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        overflow: hidden;
        background: var(--bg-code);
        border: 1px solid var(--bg-code-header);
        border-radius: 0.75rem;
    }

    .code-window-header {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        height: 2.5rem;
        padding: 0 0.375rem 0 0.875rem;
        background: var(--bg-code-header);
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
        color: #94a3b8;
        font-family: var(--font-mono);
        font-size: 0.75rem;
    }

    .code-window-icon {
        font-size: 1rem;
        color: #64748b;
    }

    .code-window-title {
        flex: 1 1 auto;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .code-window-copy {
        color: #94a3b8;
    }

    .code-window-copy:hover {
        color: #ffffff;
    }

    .code-block {
        width: 100%;
        padding: 0.875rem 1rem;
        background: transparent;
        color: #e2e8f0;
        font-family: var(--font-mono);
        font-size: 0.8125rem;
        line-height: 1.65;
        white-space: pre-wrap;
        overflow-wrap: break-word;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        scrollbar-color: #334155 transparent;
    }

    /* ---------- Callout ---------- */

    .callout {
        display: flex;
        flex-direction: column;
        gap: 0.375rem;
        width: 100%;
        padding: 0.875rem 1rem;
        background: #f5f7ff;
        border: 1px solid #e0e7ff;
        border-left: 3px solid var(--brand);
        border-radius: 0.5rem;
    }

    .callout-header {
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    .callout-icon {
        font-size: 1.125rem;
        color: var(--brand);
    }

    .callout-title {
        font-size: 0.875rem;
        font-weight: 600;
        color: var(--text-primary);
    }

    .callout-item {
        font-size: 0.875rem;
        line-height: 1.6;
        color: var(--text-secondary);
        white-space: pre-wrap;
    }

    /* ---------- How-to overview ---------- */

    .overview-list {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        width: 100%;
        padding: 1.25rem;
        background: var(--bg-page);
        border: 1px solid var(--border);
        border-radius: 0.75rem;
    }

    .overview-item {
        display: flex;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .overview-marker {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        min-width: 2rem;
        height: 1.5rem;
        padding: 0 0.375rem;
        border: 1px solid var(--brand-ring);
        border-radius: 9999px;
        background: var(--bg-surface);
        color: var(--brand);
        font-family: var(--font-mono);
        font-size: 0.75rem;
        font-weight: 600;
        line-height: 1;
    }

    .overview-text {
        min-width: 0;
        font-size: 0.9375rem;
        line-height: 1.5rem;
        color: var(--text-secondary);
    }

    /* ---------- Reference (API / CLI) ---------- */

    .ref-group {
        padding-top: 1.5rem;
        /* pull the first entry closer than the panel's gap-8 */
        margin-bottom: -1rem;
    }

    .ref-entry {
        padding-top: 1.5rem;
        border-top: 1px solid var(--border);
    }

    .ref-entry-heading {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.5rem 0.75rem;
        min-width: 0;
    }

    .ref-entry-title {
        min-width: 0;
        font-family: var(--font-mono);
        font-size: 1.125rem;
        font-weight: 600;
        letter-spacing: -0.01em;
        color: var(--text-primary);
        overflow-wrap: anywhere;
    }

    .ref-entry-kind {
        padding: 0.125rem 0.5rem;
        border: 1px solid var(--brand-ring);
        border-radius: 9999px;
        background: var(--brand-tint);
        color: var(--brand);
        font-size: 0.6875rem;
        font-weight: 500;
        letter-spacing: 0.04em;
        line-height: 1.25rem;
        text-transform: uppercase;
    }

    /* Parameter table: one DOM; a 3-column grid here, stacked rows under
       768px. Tracks have rem minimums so name/type never get crushed, and
       the description track is minmax(0, …) so it can always shrink. */
    .param-table {
        width: 100%;
        min-width: 0;
        border: 1px solid var(--border);
        border-radius: 0.75rem;
        overflow: hidden;
        background: var(--bg-surface);
    }

    .param-row {
        display: grid;
        grid-template-columns:
            minmax(7rem, 1.5fr)
            minmax(5.5rem, 1fr)
            minmax(0, 5fr);
        align-items: start;
        gap: 0.375rem 1rem;
        padding: 0.875rem 1rem;
    }

    .param-row + .param-row {
        border-top: 1px solid var(--border);
    }

    .param-head {
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
        background: var(--bg-page);
        font-family: var(--font-mono);
        font-size: 0.6875rem;
        font-weight: 500;
        letter-spacing: 0.08em;
        line-height: 1rem;
        text-transform: uppercase;
        color: var(--text-muted);
    }

    .param-name {
        min-width: 0;
        font-family: var(--font-mono);
        font-size: 0.8125rem;
        font-weight: 600;
        line-height: 1.5rem;
        color: var(--text-primary);
    }

    .param-type {
        min-width: 0;
    }

    .type-pill {
        display: inline-flex;
        align-items: center;
        max-width: 100%;
        margin-top: 0.125rem;
        padding: 0 0.4375rem;
        border: 1px solid var(--border);
        border-radius: 0.375rem;
        background: #f1f5f9;
        color: var(--text-secondary);
        font-family: var(--font-mono);
        font-size: 0.75rem;
        line-height: 1.25rem;
        white-space: nowrap;
    }

    .param-desc {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        min-width: 0;
        font-size: 0.875rem;
        line-height: 1.5rem;
        color: var(--text-secondary);
    }

    .param-constraints {
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
        min-width: 0;
    }

    .param-constraint {
        position: relative;
        min-width: 0;
        padding-left: 0.875rem;
        font-size: 0.8125rem;
        line-height: 1.375rem;
        color: var(--text-muted);
    }

    .param-constraint::before {
        content: "";
        position: absolute;
        left: 0.125rem;
        top: 0.5625rem;
        width: 0.3125rem;
        height: 0.3125rem;
        border-radius: 9999px;
        background: var(--brand-ring);
    }

    /* ui.label renders a <div>: make key + value flow as one line */
    .param-constraint > * {
        display: inline;
    }

    .param-constraint-key {
        font-weight: 500;
    }

    .param-constraint-value {
        margin-left: 0.3125rem;
        font-family: var(--font-mono);
        font-size: 0.75rem;
        color: var(--text-secondary);
    }

    /* ---------- Home ---------- */

    .hero {
        position: relative;
        isolation: isolate;
        padding: 2rem 0 0.5rem;
    }

    .hero::before {
        content: "";
        position: absolute;
        z-index: -1;
        inset: -2rem 0 auto;
        height: calc(100% + 4rem);
        pointer-events: none;
        background:
            radial-gradient(
                60% 55% at 50% 0%,
                rgba(99, 102, 241, 0.14) 0%,
                rgba(99, 102, 241, 0) 100%
            );
    }

    .hero-badge {
        display: inline-flex;
        align-items: center;
        gap: 0.5rem;
        padding: 0.3rem 0.75rem;
        border: 1px solid var(--brand-ring);
        border-radius: 9999px;
        background: var(--brand-tint);
        color: var(--brand);
        font-family: var(--font-mono);
        font-size: 0.75rem;
        font-weight: 500;
        line-height: 1.25;
    }

    .hero-badge::before {
        content: "";
        width: 0.375rem;
        height: 0.375rem;
        border-radius: 9999px;
        background: var(--brand);
        box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.18);
    }

    .hero-title {
        background: linear-gradient(
            180deg,
            var(--text-primary) 35%,
            var(--brand-hover) 140%
        );
        -webkit-background-clip: text;
        background-clip: text;
        color: transparent;
        /* background-clip only paints inside the box: give descenders and
           the "y" overhang room, cancelled out so layout is unchanged */
        padding: 0.05em 0.12em 0.18em;
        margin: -0.05em -0.12em -0.18em;
    }

    .hero-actions {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.75rem;
        margin-top: 0.5rem;
    }

    .feature-card {
        display: flex;
        flex-direction: column;
        gap: 0.625rem;
        min-width: 0;
        padding: 1.5rem;
        background: var(--bg-surface);
        border: 1px solid var(--border);
        border-radius: 0.875rem;
        transition:
            border-color 0.2s ease,
            box-shadow 0.2s ease,
            transform 0.2s ease;
    }

    .feature-card:hover {
        border-color: var(--brand-ring);
        box-shadow: 0 12px 28px -16px rgba(79, 70, 229, 0.35);
        transform: translateY(-2px);
    }

    .feature-card-top {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        margin-bottom: 0.5rem;
    }

    .feature-icon {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 2.5rem;
        height: 2.5rem;
        border-radius: 0.625rem;
        background: var(--brand-tint);
        color: var(--brand);
        font-size: 1.375rem;
    }

    .feature-index {
        font-family: var(--font-mono);
        font-size: 0.75rem;
        color: #cbd5e1;
    }

    .feature-title {
        font-size: 1.0625rem;
        font-weight: 600;
        letter-spacing: -0.01em;
        color: var(--text-primary);
    }

    .feature-text {
        font-size: 0.9375rem;
        line-height: 1.65;
        color: var(--text-secondary);
    }

    .home-footer {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.375rem;
        width: 100%;
        padding: 1.5rem 0 0.5rem;
        border-top: 1px solid var(--border);
        font-size: 0.875rem;
        color: var(--text-muted);
    }

    /* ---------- Forms ---------- */

    .q-field--outlined .q-field__control {
        border-radius: 0.5rem;
    }

    .q-field--outlined .q-field__control:before {
        border-color: var(--border);
    }

    .q-field--outlined .q-field__control:hover:before {
        border-color: #cbd5e1;
    }

    .q-field__label {
        color: var(--text-muted);
    }

    /* ---------- Standalone (auth) pages ---------- */

    .auth-heading {
        margin-bottom: 0.25rem;
    }

    .brand-mark-lg {
        width: 2.75rem;
        height: 2.75rem;
        border-radius: 0.75rem;
        font-size: 1.25rem;
    }

    .status-icon {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        width: 3rem;
        height: 3rem;
        border-radius: 0.875rem;
        font-size: 1.5rem;
    }

    .status-icon-brand {
        background: var(--brand-tint);
        color: var(--brand);
        box-shadow: inset 0 0 0 1px var(--brand-ring);
    }

    .status-icon-success {
        background: var(--success-tint);
        color: var(--success);
        box-shadow: inset 0 0 0 1px rgba(22, 163, 74, 0.2);
    }

    .status-icon-warning {
        background: var(--warning-tint);
        color: var(--warning);
        box-shadow: inset 0 0 0 1px rgba(217, 119, 6, 0.2);
    }

    .status-icon-danger {
        background: var(--danger-tint);
        color: var(--danger);
        box-shadow: inset 0 0 0 1px rgba(220, 38, 38, 0.2);
    }

    .status-pill {
        display: inline-flex;
        align-items: center;
        align-self: center;
        gap: 0.375rem;
        padding: 0.375rem 0.875rem;
        border-radius: 9999px;
        font-size: 0.875rem;
        font-weight: 600;
    }

    .status-pill .q-icon {
        font-size: 1.125rem;
    }

    .status-pill-success {
        background: var(--success-tint);
        color: var(--success);
        border: 1px solid rgba(22, 163, 74, 0.2);
    }

    .auth-hint {
        font-size: 0.8125rem;
        line-height: 1.5;
        color: var(--text-muted);
        text-align: center;
    }

    .auth-footer {
        display: flex;
        justify-content: center;
        width: 100%;
        font-size: 0.875rem;
    }

    .callout-danger {
        background: var(--danger-tint);
        border-color: rgba(220, 38, 38, 0.2);
        border-left-color: var(--danger);
    }

    .confirm-message {
        min-height: 1.5rem;
        font-size: 1rem;
        font-weight: 600;
        text-align: center;
    }

    /* ---------- Payment ---------- */

    .payment-heading {
        display: flex;
        align-items: center;
        gap: 0.875rem;
        min-width: 0;
    }

    .payment-heading .status-icon {
        width: 2.5rem;
        height: 2.5rem;
        border-radius: 0.625rem;
        font-size: 1.25rem;
    }

    .payment-secure {
        display: flex;
        align-items: center;
        gap: 0.375rem;
        font-size: 0.8125rem;
        color: var(--text-muted);
    }

    .payment-secure .q-icon {
        flex-shrink: 0;
        font-size: 0.875rem;
    }

    /* ---------- Setup stepper ---------- */

    .stepper {
        display: flex;
        flex-direction: column;
        width: 100%;
    }

    .step {
        display: grid;
        grid-template-columns: 2.25rem minmax(0, 1fr);
        column-gap: 1rem;
    }

    /* padding-top centres the marker on the body's first (title) line */
    .step-rail {
        position: relative;
        display: flex;
        justify-content: center;
        padding-top: 0.875rem;
    }

    /* connector line down to the next step's marker */
    .step-rail::after {
        content: "";
        position: absolute;
        top: 3.625rem;
        bottom: -0.375rem;
        left: 50%;
        width: 2px;
        transform: translateX(-50%);
        border-radius: 1px;
        background: var(--border);
    }

    .step:last-child .step-rail::after {
        display: none;
    }

    .step-marker {
        position: relative;
        z-index: 1;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 2.25rem;
        height: 2.25rem;
        border-radius: 9999px;
        background: var(--brand);
        color: #ffffff;
        font-family: var(--font-mono);
        font-size: 0.875rem;
        font-weight: 600;
        box-shadow: 0 0 0 4px var(--brand-tint);
    }

    .step-body {
        min-width: 0;
        margin-bottom: 1.25rem;
        padding: 1.25rem 1.5rem;
        background: var(--bg-surface);
        border: 1px solid var(--border);
        border-radius: 0.875rem;
        box-shadow:
            0 1px 2px rgba(15, 23, 42, 0.04),
            0 1px 3px rgba(15, 23, 42, 0.03);
    }

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

    .step-title {
        font-size: 1.125rem;
        font-weight: 600;
        letter-spacing: -0.01em;
        line-height: 1.5rem;
        color: var(--text-primary);
    }

    .certificate-upload {
        max-width: 100%;
        border-radius: 0.75rem;
        overflow: hidden;
    }

    .certificate-upload.q-uploader--bordered {
        border-color: var(--border);
    }

    /* ---------- Dashboard ---------- */

    .dashboard-table {
        background: var(--bg-surface);
        color: var(--text-primary);
        border: 1px solid var(--border);
        border-radius: 0.625rem;
        overflow: hidden;
    }

    .dashboard-table .q-table__middle {
        max-width: 100%;
        overflow-x: auto;
    }

    .dashboard-table th,
    .dashboard-table td {
        white-space: nowrap;
    }

    .dashboard-table thead th {
        background: var(--bg-page);
        border-bottom: 1px solid var(--border);
        font-size: 0.75rem;
        font-weight: 600;
        letter-spacing: 0.04em;
        text-transform: uppercase;
        color: var(--text-muted);
    }

    .dashboard-table tbody td {
        border-color: var(--border);
        font-size: 0.875rem;
        font-variant-numeric: tabular-nums;
        color: var(--text-secondary);
    }

    .dashboard-table tbody td:first-child {
        font-weight: 600;
        color: var(--text-primary);
    }

    .dashboard-table .q-table__bottom {
        border-top: 1px solid var(--border);
        font-size: 0.8125rem;
        color: var(--text-muted);
    }

    .dashboard-list {
        display: none !important;
    }

    .dashboard-list-entry {
        padding: 0.875rem 0;
    }

    .dashboard-list-entry:first-child {
        padding-top: 0;
    }

    .dashboard-list-entry:last-child {
        padding-bottom: 0;
    }

    .dashboard-list-entry + .dashboard-list-entry {
        border-top: 1px solid var(--border);
    }

    .dashboard-list-name {
        font-size: 1rem;
        font-weight: 600;
        color: var(--text-primary);
        overflow-wrap: anywhere;
    }

    .dashboard-list-label {
        font-size: 0.8125rem;
        color: var(--text-muted);
    }

    .dashboard-list-value {
        font-size: 0.875rem;
        font-weight: 500;
        color: var(--text-primary);
        text-align: right;
        font-variant-numeric: tabular-nums;
    }

    @media (max-width: 1024px) {
        .dashboard-table table {
            min-width: 34rem;
        }
    }

    /* ---------- Mobile (keep in sync with Tailwind md:) ---------- */

    @media (max-width: 768px) {
        .app-header {
            padding: 0 1rem;
        }

        .app-header-inner {
            height: 3.5rem;
        }

        .page-body {
            flex-direction: column !important;
            flex-wrap: nowrap !important;
        }

        .page-body .sidebar {
            width: 100%;
            height: auto;
            flex: 0 0 auto;
            background: var(--bg-surface);
            border-right: none;
            border-bottom: 1px solid var(--border);
            padding: 0 0.5rem;
            overflow-x: hidden;
            overflow-y: hidden;
            -webkit-overflow-scrolling: touch;
        }

        .page-body .sidebar .q-tabs,
        .page-body .sidebar .q-tabs__content {
            flex-flow: row nowrap;
            height: auto;
            max-height: none;
            align-items: center;
        }

        .page-body .sidebar .q-tabs {
            width: 100%;
            max-width: 100%;
            align-self: stretch;
        }

        .page-body .sidebar .q-tabs__content {
            flex: 1 1 auto;
            align-self: center;
            width: 100%;
            min-width: 0;
            overflow-x: auto;
            overflow-y: hidden;
            -webkit-overflow-scrolling: touch;
            scrollbar-width: none;
        }

        .page-body .sidebar .q-tabs__content::-webkit-scrollbar {
            display: none;
        }

        .page-body .sidebar .nav-group-label,
        .page-body .sidebar .q-tab__icon {
            display: none;
        }

        .page-body .sidebar .q-tabs .q-tab {
            justify-content: center;
            flex: 0 0 auto;
            width: auto !important;
            max-width: none;
            height: auto !important;
            min-height: 2.75rem;
            min-width: max-content;
            margin: 0;
            padding: 0 0.75rem;
            border-radius: 0;
            background: transparent !important;
        }

        .page-body .sidebar .q-tab__content--inline .q-tab__label {
            padding-left: 0;
        }

        .page-body .sidebar .q-tab--active::before {
            display: none;
        }

        .page-body .sidebar .q-tab__indicator {
            display: block;
            height: 2px;
        }

        .page-body .sidebar .q-tab__label {
            white-space: nowrap;
        }

        .page-body .content-area {
            flex: 1 1 auto !important;
            width: 100%;
            height: auto;
            min-height: 0;
            overflow-y: auto !important;
        }

        .page-body .content-area > *,
        .page-body .content-area > * > *,
        .page-body .content-area .nicegui-tab-panel {
            height: auto !important;
            max-height: none !important;
            overflow: visible !important;
        }

        .content-area {
            padding: 1rem;
        }

        .centered-page {
            padding: 1rem;
        }

        .code-block {
            white-space: pre;
        }

        .prose-text {
            font-size: 0.9375rem;
        }

        .overview-list {
            padding: 1rem;
        }

        /* Parameter table: stacked rows. Row 1 = name + type pill,
           row 2 = description + constraints across the full width. */
        .param-head {
            display: none;
        }

        /* the hidden head still matches `.param-row + .param-row` */
        .param-head + .param-row {
            border-top: none;
        }

        .param-row {
            grid-template-columns: auto minmax(0, 1fr);
            align-items: center;
            gap: 0.375rem 0.625rem;
            padding: 0.875rem;
        }

        .param-desc {
            grid-column: 1 / -1;
        }

        .type-pill {
            margin-top: 0;
        }

        .hero {
            padding-top: 0.5rem;
        }

        .hero::before {
            inset: -1rem 0 auto;
            background:
                radial-gradient(
                    90% 50% at 0% 0%,
                    rgba(99, 102, 241, 0.14) 0%,
                    rgba(99, 102, 241, 0) 100%
                );
        }

        .hero-actions {
            flex-direction: column;
            align-items: stretch;
            width: 100%;
        }

        .hero-actions .q-btn {
            width: 100%;
        }

        .step {
            grid-template-columns: 1.75rem minmax(0, 1fr);
            column-gap: 0.75rem;
        }

        .step-rail::after {
            top: 3.125rem;
        }

        .step-marker {
            width: 1.75rem;
            height: 1.75rem;
            font-size: 0.75rem;
            box-shadow: 0 0 0 3px var(--brand-tint);
        }

        .step-body {
            margin-bottom: 1rem;
            padding: 1rem;
        }

        .step-title {
            font-size: 1rem;
        }

        .dashboard-table {
            display: none !important;
        }

        .dashboard-list {
            display: flex !important;
        }
    }
}
