/* ==========================================================================
   Skylearn Design System — Mauqe
   White-label: set --brand-color on :root (injected per tenant in head_assets)
   ========================================================================== */

:root {
    /* Brand — maps to Sky palette; overridden per tenant via --brand-color */
    --brand-color: #3B82F6;
    --brand: var(--brand-color);
    --brand-hover: color-mix(in srgb, var(--brand-color) 85%, #0F172A);
    --brand-active: color-mix(in srgb, var(--brand-color) 75%, #0F172A);
    --brand-soft: color-mix(in srgb, var(--brand-color) 12%, white);
    --brand-ring: color-mix(in srgb, var(--brand-color) 25%, transparent);

    /* Sky */
    --sky: #3B82F6;
    --sky-bright: #60A5FA;
    --sky-deep: #1D4ED8;
    --sky-soft: #DBEAFE;

    /* Sun */
    --sun: #FBBF24;
    --sun-bright: #FCD34D;
    --sun-deep: #D97706;

    /* Leaf */
    --leaf: #22C55E;
    --leaf-soft: #DCFCE7;
    --leaf-deep: #16A34A;

    /* Coral */
    --coral: #F87171;
    --coral-soft: #FEE2E2;

    /* Berry */
    --berry: #A855F7;
    --berry-soft: #F3E8FF;

    /* Surfaces & ink */
    --background: #FFFFFF;
    --surface: #F8FAFC;
    --surface-sunken: #F1F5F9;
    --surface-elevated: #FFFFFF;

    --ink: #0F172A;
    --ink-muted: #475569;
    --ink-subtle: #94A3B8;
    --ink-faint: #CBD5E1;

    --outline: #E2E8F0;
    --outline-strong: #94A3B8;

    /* Semantic aliases */
    --text: var(--ink);
    --text-secondary: var(--ink-muted);
    --text-muted: var(--ink-muted);
    --text-subtle: var(--ink-subtle);
    --text-placeholder: var(--ink-faint);
    --text-inverse: #FFFFFF;
    --text-on-brand: #FFFFFF;

    --border: var(--outline);
    --border-strong: var(--outline-strong);
    --border-focus: var(--brand-color);

    --surface-page: var(--surface);
    --surface-muted: var(--surface-sunken);

    --color-success: var(--leaf-deep);
    --color-success-bg: var(--leaf-soft);
    --color-info: var(--sky-deep);
    --color-info-bg: var(--sky-soft);
    --color-warning: var(--sun-deep);
    --color-warning-bg: color-mix(in srgb, var(--sun) 15%, white);
    --color-danger: #B91C1C;
    --color-danger-bg: var(--coral-soft);
    --color-purple: var(--berry);
    --color-purple-bg: var(--berry-soft);
    --color-amber: var(--sun-deep);
    --color-amber-bg: color-mix(in srgb, var(--sun) 15%, white);
    --color-blue: var(--sky-deep);
    --color-blue-bg: var(--sky-soft);

    /* Elevation */
    --shadow-card: 0 0 0 1px var(--outline);
    --shadow-card-hover: 0 8px 24px rgba(15, 23, 42, 0.06);
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.08);
    --shadow-xl: 0 20px 40px rgba(15, 23, 42, 0.1);

    /* Radius */
    --radius-input: 12px;
    --radius-btn: 16px;
    --radius-card: 20px;
    --radius-modal: 28px;
    --radius-pill: 999px;

    /* Legacy radius aliases */
    --radius-sm: var(--radius-input);
    --radius-md: var(--radius-input);
    --radius-lg: var(--radius-btn);
    --radius-xl: var(--radius-card);
    --radius-2xl: var(--radius-modal);
    --radius-full: var(--radius-pill);

    /* Typography */
    --font-sans: 'Atkinson Hyperlegible', 'IBM Plex Sans Arabic', system-ui, -apple-system, sans-serif;
    --font-display: 'Nunito', 'IBM Plex Sans Arabic', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Code', monospace;

    /* Layout */
    --nav-height: 3.5rem;
    --main-max-width: 80rem;
    --main-wide-max-width: 120rem;

    /* Motion */
    --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
    --transition-fast: 150ms var(--ease-bounce);
    --transition-base: 240ms var(--ease-bounce);
}


/* ==========================================================================
   Base & Typography
   ========================================================================== */

*,
*::before,
*::after {
    box-sizing: border-box;
}

body.t-app {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font-sans);
    font-size: 1.125rem;
    line-height: 1.55;
    color: var(--ink);
    background: var(--surface);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

@media (max-width: 639px) {
    body.t-app {
        font-size: 1rem;
    }
}

body.t-app h1,
body.t-app h2,
body.t-app h3,
body.t-app h4 {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.25;
    color: var(--ink);
}

body.t-app a:not(.t-btn) {
    color: var(--brand-color);
    text-decoration: none;
}

body.t-app a:not(.t-btn):hover {
    text-decoration: underline;
}

/* Anchor buttons must keep variant text colors (global link rule is more specific than .t-btn-*) */
body.t-app a.t-btn {
    text-decoration: none;
}

body.t-app a.t-btn-primary,
body.t-app a.t-btn-nav {
    color: var(--text-on-brand);
}

body.t-app a.t-btn-primary:hover:not(:disabled):not([disabled]),
body.t-app a.t-btn-nav:hover {
    color: var(--text-on-brand);
}

body.t-app a.t-btn-secondary {
    color: var(--ink-muted);
}

body.t-app a.t-btn-secondary:hover:not(:disabled):not([disabled]) {
    color: var(--ink);
}

body.t-app a.t-btn-ghost {
    color: var(--ink-muted);
}

body.t-app a.t-btn-ghost:hover:not(:disabled):not([disabled]) {
    color: var(--ink);
}

body.t-app img,
body.t-app svg {
    display: block;
    max-width: 100%;
}

body.t-app code,
body.t-app pre,
body.t-app .font-mono {
    font-family: var(--font-mono);
}

body.t-app-builder,
body.builder-mode.t-app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

[dir="rtl"] body.t-app,
[dir="rtl"] .t-login-page,
[dir="rtl"] .t-share-page {
    font-family: 'IBM Plex Sans Arabic', 'Atkinson Hyperlegible', system-ui, sans-serif;
}

[dir="rtl"] body.t-app h1,
[dir="rtl"] body.t-app h2,
[dir="rtl"] body.t-app h3,
[dir="rtl"] body.t-app h4 {
    font-family: 'IBM Plex Sans Arabic', 'Nunito', system-ui, sans-serif;
}

[dir="rtl"] input,
[dir="rtl"] select,
[dir="rtl"] textarea {
    text-align: right;
}

.t-text-small {
    font-size: 0.875rem;
    color: var(--ink-muted);
    line-height: 1.45;
}


/* ==========================================================================
   Navigation — Skylearn surface bar with sky pill active states
   ========================================================================== */

.t-nav {
    position: sticky;
    top: 0;
    z-index: 40;
    background: var(--background);
    color: var(--ink);
    border-bottom: 1px solid var(--outline);
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
}

.t-nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    max-width: var(--main-wide-max-width);
    margin: 0 auto;
    padding: 0 1rem;
    min-height: 4rem;
    position: relative;
}

@media (min-width: 1024px) {
    .t-nav-inner {
        padding: 0 1.25rem;
    }
}

.t-nav-start,
.t-nav-end {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.t-nav-start {
    flex: 1;
    min-width: 0;
}

.t-nav-links {
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
    position: absolute;
    top: calc(100% + 1px);
    inset-inline: 0;
    padding: 0.75rem 1rem 1rem;
    background: var(--background);
    border-bottom: 1px solid var(--outline);
    box-shadow: var(--shadow-card-hover);
}

.t-nav-links.is-open {
    display: flex;
}

@media (min-width: 1024px) {
    .t-nav-links {
        display: flex;
        flex-direction: row;
        align-items: center;
        position: static;
        inset: auto;
        padding: 0;
        margin-inline-start: 0.75rem;
        border: none;
        box-shadow: none;
        background: transparent;
        gap: 0.25rem;
        flex: 1;
        min-width: 0;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .t-nav-links::-webkit-scrollbar {
        display: none;
    }
}

.t-nav-toggle {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 2.75rem;
    height: 2.75rem;
    margin-inline-start: auto;
    padding: 0;
    border: 1px solid var(--outline);
    border-radius: var(--radius-btn);
    background: var(--surface);
    cursor: pointer;
    transition: background var(--transition-fast), border-color var(--transition-fast);
}

.t-nav-toggle:hover {
    background: var(--sky-soft);
    border-color: var(--sky-bright);
}

.t-nav-toggle-bar {
    display: block;
    width: 1.125rem;
    height: 2px;
    margin: 0 auto;
    border-radius: 999px;
    background: var(--ink);
    transition: transform var(--transition-fast), opacity var(--transition-fast);
}

.t-nav-toggle[aria-expanded="true"] .t-nav-toggle-bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.t-nav-toggle[aria-expanded="true"] .t-nav-toggle-bar:nth-child(2) {
    opacity: 0;
}

.t-nav-toggle[aria-expanded="true"] .t-nav-toggle-bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

@media (min-width: 1024px) {
    .t-nav-toggle {
        display: none;
    }
}

.t-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    color: var(--ink);
    text-decoration: none;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.125rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.t-brand:hover {
    text-decoration: none;
    color: var(--sky-deep);
}

.t-brand-logo {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: var(--radius-btn);
    object-fit: contain;
    flex-shrink: 0;
}

.t-brand-text {
    letter-spacing: -0.01em;
}

.t-nav-link {
    display: inline-flex;
    align-items: center;
    min-height: 2.75rem;
    padding: 0.5rem 0.875rem;
    border-radius: var(--radius-btn);
    color: var(--ink-muted);
    font-family: var(--font-display);
    font-size: 0.9375rem;
    font-weight: 600;
    text-decoration: none;
    transition: background var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast);
    white-space: nowrap;
}

.t-nav-link:hover {
    background: var(--surface-sunken);
    color: var(--ink);
    text-decoration: none;
}

.t-nav-link-active,
.t-nav-link[aria-current="page"] {
    background: var(--sky-soft);
    color: var(--sky-deep);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--sky) 18%, transparent);
}

.t-nav-ghost {
    display: inline-flex;
    align-items: center;
    min-height: 2.25rem;
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-pill);
    color: var(--ink-muted);
    font-size: 0.8125rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid var(--outline);
    background: var(--surface);
    transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.t-nav-ghost:hover {
    background: var(--sky-soft);
    border-color: var(--sky-bright);
    color: var(--sky-deep);
    text-decoration: none;
}

.t-user-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-pill);
    background: var(--surface-sunken);
    font-size: 0.8125rem;
    color: var(--ink-muted);
    border: 1px solid var(--outline);
}

.t-user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    border-radius: var(--radius-pill);
    background: var(--sky-soft);
    color: var(--sky-deep);
    font-size: 0.5rem;
    line-height: 1;
}

.t-user-name {
    max-width: 10rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}


/* ==========================================================================
   Main Layout
   ========================================================================== */

.t-main {
    flex: 1;
    width: 100%;
    max-width: var(--main-max-width);
    margin: 0 auto;
    padding: 2rem 1rem;
}

.t-main-wide {
    max-width: var(--main-wide-max-width);
    padding: 0.75rem 0.75rem;
}

.t-main-full {
    max-width: none;
    width: 100%;
    padding: 0;
}

@media (min-width: 1024px) {
    .t-main-wide {
        padding: 0.75rem 1.25rem;
    }
}

.t-main-builder {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: var(--main-wide-max-width);
    width: 100%;
    margin: 0 auto;
    padding: 0.75rem;
    min-height: 0;
    overflow: hidden;
}

@media (min-width: 1024px) {
    .t-main-builder {
        padding: 0.75rem 1.25rem;
    }
}


/* ==========================================================================
   Page Headers
   ========================================================================== */

.t-page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.t-page-title {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--ink);
    letter-spacing: -0.02em;
}

.t-page-subtitle {
    margin-top: 0.25rem;
    font-size: 1rem;
    color: var(--ink-muted);
    font-weight: 400;
}

.t-page-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.t-eyebrow {
    margin: 0 0 0.35rem;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--brand-color);
}

.t-hero-panel {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    padding: clamp(1.25rem, 3vw, 2rem);
    border: 1px solid color-mix(in srgb, var(--brand-color) 20%, var(--outline));
    border-radius: var(--radius-modal);
    background:
        radial-gradient(circle at top inline-start, var(--brand-soft), transparent 42%),
        var(--background);
    box-shadow: var(--shadow-card);
}

.t-hero-title {
    max-width: 44rem;
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    letter-spacing: -0.04em;
}

.t-hero-copy {
    max-width: 42rem;
    margin: 0.65rem 0 0;
    color: var(--ink-muted);
    font-size: 1rem;
}

.t-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.t-card-subtitle {
    margin: 0.25rem 0 0;
    color: var(--ink-muted);
    font-size: 0.875rem;
}

.t-stat-helper {
    margin: 0.4rem 0 0;
    color: var(--ink-muted);
    font-size: 0.8125rem;
    line-height: 1.35;
}

.t-business-stat-grid .t-stat {
    min-height: 9rem;
}


/* ==========================================================================
   Buttons
   ========================================================================== */

.t-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    min-height: 48px;
    padding: 0.625rem 1.25rem;
    border: 1px solid transparent;
    border-radius: var(--radius-btn);
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.25;
    text-decoration: none;
    cursor: pointer;
    transition: background var(--transition-base), border-color var(--transition-base),
                color var(--transition-base), box-shadow var(--transition-base), transform var(--transition-base);
    white-space: nowrap;
}

.t-btn:hover {
    text-decoration: none;
}

.t-btn:active {
    transform: scale(0.98);
}

.t-btn:disabled,
.t-btn[disabled] {
    opacity: 1;
    cursor: not-allowed;
    transform: none;
    background: var(--ink-faint);
    border-color: var(--outline-strong);
    color: var(--ink-muted);
}

.t-btn-primary:disabled,
.t-btn-primary[disabled] {
    background: var(--ink-faint);
    border-color: var(--outline-strong);
    color: var(--ink-muted);
}

.t-btn-primary {
    background: var(--brand-color);
    color: var(--text-on-brand);
    border-color: var(--brand-color);
}

.t-btn-primary:hover:not(:disabled):not([disabled]) {
    background: var(--brand-hover);
    border-color: var(--brand-hover);
    color: var(--text-on-brand);
}

.t-btn-primary:active:not(:disabled):not([disabled]) {
    background: var(--brand-active);
    border-color: var(--brand-active);
}

.t-btn-lg {
    min-height: 56px;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

@media (min-width: 768px) {
    .t-btn-lg {
        min-height: 64px;
        padding: 0.875rem 1.75rem;
        font-size: 1.0625rem;
    }
}

.t-btn-secondary {
    background: var(--background);
    color: var(--ink-muted);
    border-color: var(--outline-strong);
}

.t-btn-secondary:hover:not(:disabled):not([disabled]) {
    background: var(--surface-sunken);
    border-color: var(--outline);
    color: var(--ink);
}

.t-btn-ghost {
    background: transparent;
    color: var(--ink-muted);
    border-color: transparent;
}

.t-btn-ghost:hover:not(:disabled):not([disabled]) {
    background: var(--surface-sunken);
    color: var(--ink);
}

.t-btn-sm {
    min-height: 40px;
    padding: 0.375rem 0.875rem;
    font-size: 0.8125rem;
    border-radius: var(--radius-btn);
}

.t-btn-link {
    min-height: auto;
    padding: 0;
    background: none;
    border: none;
    color: var(--brand-color);
    font-weight: 600;
}

.t-btn-link:hover {
    text-decoration: underline;
    background: none;
}

.t-btn-link-danger {
    min-height: auto;
    padding: 0;
    background: none;
    border: none;
    color: var(--color-danger);
    font-weight: 600;
}

.t-btn-link-danger:hover:not(:disabled):not([disabled]) {
    text-decoration: underline;
    background: none;
    color: color-mix(in srgb, var(--color-danger) 80%, #000);
}

.t-btn-icon-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    border: 1px solid color-mix(in srgb, var(--color-danger) 22%, transparent);
    border-radius: var(--radius-btn);
    background: transparent;
    color: var(--color-danger);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    transition: background var(--transition-base), border-color var(--transition-base), color var(--transition-base);
}

.t-btn-icon-danger:hover:not(:disabled):not([disabled]) {
    background: var(--color-danger-bg);
    border-color: color-mix(in srgb, var(--color-danger) 35%, transparent);
    color: color-mix(in srgb, var(--color-danger) 85%, #000);
}

.t-table-actions {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    flex-wrap: wrap;
}

.t-table-actions form {
    display: inline-flex;
    margin: 0;
}

.t-btn-nav {
    min-height: 2.5rem;
    padding: 0.5rem 1rem;
    background: var(--brand-color);
    color: var(--text-on-brand);
    border-color: transparent;
    font-size: 0.875rem;
    font-weight: 700;
    box-shadow: 0 2px 8px color-mix(in srgb, var(--brand-color) 35%, transparent);
}

.t-btn-nav:hover {
    background: var(--brand-hover);
    color: var(--text-on-brand);
    box-shadow: 0 4px 12px color-mix(in srgb, var(--brand-color) 40%, transparent);
}


/* ==========================================================================
   Cards
   ========================================================================== */

.t-card {
    background: var(--background);
    border: 1px solid var(--outline);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    transition: box-shadow var(--transition-base), border-color var(--transition-base), transform var(--transition-base);
}

.t-card:hover {
    box-shadow: var(--shadow-card-hover);
}

.t-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--outline);
    font-weight: 600;
    font-size: 0.9375rem;
}

.t-card-body {
    padding: 1rem 1.25rem;
}

.t-card-title {
    font-family: var(--font-display);
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--ink);
    margin: 0;
}

.t-lesson-card {
    border-radius: var(--radius-card);
}

.t-lesson-card.is-active,
.t-grid-card.is-active {
    border: 3px solid var(--brand-color);
    box-shadow: var(--shadow-card-hover);
}

/* Legacy Tailwind card upgrade */
body.t-app main .bg-white.rounded-xl.shadow {
    background: var(--background) !important;
    border: 1px solid var(--outline) !important;
    border-radius: var(--radius-card) !important;
    box-shadow: var(--shadow-card) !important;
    transition: box-shadow var(--transition-base);
}

body.t-app main .bg-white.rounded-xl.shadow:hover {
    box-shadow: var(--shadow-card-hover) !important;
}


/* ==========================================================================
   Stats
   ========================================================================== */

.t-stat-grid {
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

@media (min-width: 640px) {
    .t-stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .t-stat-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.t-stat {
    background: var(--background);
    border: 1px solid var(--outline);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    padding: 1.5rem;
    border-inline-end-width: 4px;
    border-inline-end-style: solid;
    transition: box-shadow var(--transition-base);
}

.t-stat:hover {
    box-shadow: var(--shadow-card-hover);
}

.t-stat-label {
    font-size: 0.8125rem;
    color: var(--ink-muted);
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.t-stat-value {
    font-family: var(--font-display);
    font-size: 1.875rem;
    font-weight: 800;
    line-height: 1.1;
}

/* Skylearn stat variants */
.t-stat--sky,
.t-stat-brand,
.t-stat-info,
.t-stat-blue {
    border-inline-end-color: var(--sky);
}

.t-stat--sky .t-stat-value,
.t-stat-brand .t-stat-value,
.t-stat-info .t-stat-value,
.t-stat-blue .t-stat-value {
    color: var(--sky-deep);
}

.t-stat--leaf,
.t-stat-success {
    border-inline-end-color: var(--leaf);
}

.t-stat--leaf .t-stat-value,
.t-stat-success .t-stat-value {
    color: var(--leaf-deep);
}

.t-stat--sun,
.t-stat-warning,
.t-stat-amber {
    border-inline-end-color: var(--sun);
}

.t-stat--sun .t-stat-value,
.t-stat-warning .t-stat-value,
.t-stat-amber .t-stat-value {
    color: var(--sun-deep);
}

.t-stat--berry,
.t-stat-purple {
    border-inline-end-color: var(--berry);
}

.t-stat--berry .t-stat-value,
.t-stat-purple .t-stat-value {
    color: var(--berry);
}

.t-stat--coral {
    border-inline-end-color: var(--coral);
}

.t-stat--coral .t-stat-value {
    color: #DC2626;
}


/* ==========================================================================
   Tables
   ========================================================================== */

.t-table-wrap {
    background: var(--background);
    border: 1px solid var(--outline);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

.t-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.t-table thead {
    background: var(--surface-sunken);
}

.t-table th {
    padding: 0.75rem 1rem;
    text-align: inherit;
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--ink-muted);
    border-bottom: 1px solid var(--outline);
}

.t-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--outline);
    color: var(--ink-muted);
    vertical-align: middle;
}

.t-table tbody tr:last-child td {
    border-bottom: none;
}

.t-table tbody tr:hover {
    background: var(--surface);
}

.t-table-title {
    font-weight: 600;
    color: var(--ink);
    margin: 0;
}

.t-table-meta {
    font-size: 0.8125rem;
    color: var(--ink-subtle);
    margin: 0.125rem 0 0;
}

.t-table-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--outline);
    background: var(--surface);
}

.t-table-toolbar-start {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}

.t-table-toolbar-grid {
    margin-bottom: 1rem;
    border: 1px solid var(--outline);
    border-radius: var(--radius-card);
    background: var(--background);
}

.t-table-search {
    min-width: min(100%, 14rem);
    max-width: 20rem;
    min-height: 2.5rem;
    padding: 0.5rem 0.875rem;
    font-size: 0.875rem;
}

.t-table-col-filter,
.t-grid-sort {
    min-height: 2.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    max-width: 12rem;
}

.t-table-count {
    color: var(--ink-subtle);
    white-space: nowrap;
}

.t-table-sortable {
    cursor: pointer;
    user-select: none;
    transition: color var(--transition-fast), background var(--transition-fast);
}

.t-table-sortable:hover {
    color: var(--ink);
    background: color-mix(in srgb, var(--sky-soft) 50%, transparent);
}

.t-table-sortable::after {
    content: '↕';
    display: inline-block;
    margin-inline-start: 0.35rem;
    font-size: 0.75rem;
    opacity: 0.35;
}

.t-table-sort-asc::after {
    content: '↑';
    opacity: 1;
    color: var(--sky-deep);
}

.t-table-sort-desc::after {
    content: '↓';
    opacity: 1;
    color: var(--sky-deep);
}

.t-table-row-hidden {
    display: none !important;
}

[data-enhance-grid] .t-table-row-hidden {
    display: none !important;
}


/* ==========================================================================
   Badges
   ========================================================================== */

.t-badge,
[class*="t-badge-"] {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.625rem;
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}

.t-badge-success {
    background: var(--leaf-soft);
    color: var(--leaf-deep);
}

.t-badge-muted {
    background: var(--surface-sunken);
    color: var(--ink-muted);
}

.t-badge-info {
    background: var(--sky-soft);
    color: var(--sky-deep);
}

.t-badge-purple {
    background: var(--berry-soft);
    color: #7E22CE;
}

.t-badge-sun {
    background: color-mix(in srgb, var(--sun) 18%, white);
    color: var(--sun-deep);
}


/* ==========================================================================
   Inputs & Forms
   ========================================================================== */

.t-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--ink-muted);
    margin-bottom: 0.375rem;
}

.t-input,
body.t-app input[type="text"]:not([class*="border-0"]),
body.t-app input[type="email"]:not([class*="border-0"]),
body.t-app input[type="password"]:not([class*="border-0"]),
body.t-app input[type="number"]:not([class*="border-0"]),
body.t-app input[type="tel"]:not([class*="border-0"]),
body.t-app input[type="url"]:not([class*="border-0"]),
body.t-app input[type="date"]:not([class*="border-0"]),
body.t-app input[type="time"]:not([class*="border-0"]),
body.t-app input[type="datetime-local"]:not([class*="border-0"]),
body.t-app input[type="search"]:not([class*="border-0"]),
body.t-app select:not([class*="border-0"]),
body.t-app textarea:not([class*="border-0"]) {
    width: 100%;
    min-height: 48px;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--outline-strong);
    border-radius: var(--radius-input);
    font-family: inherit;
    font-size: 1rem;
    color: var(--ink);
    background: var(--background);
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.t-input:focus,
body.t-app input:focus:not([class*="border-0"]),
body.t-app select:focus:not([class*="border-0"]),
body.t-app textarea:focus:not([class*="border-0"]) {
    outline: none;
    border-color: var(--brand-color);
    box-shadow: 0 0 0 3px var(--brand-ring);
}

.t-input::placeholder,
body.t-app input::placeholder,
body.t-app textarea::placeholder {
    color: var(--ink-faint);
    opacity: 1;
}

.form-field label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--ink-muted);
    margin-bottom: 0.375rem;
}

.form-field input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="color"]):not([type="range"]),
.form-field select,
.form-field textarea {
    width: 100%;
    min-height: 48px;
    padding: 1rem 1.25rem;
    border: 1px solid var(--outline);
    border-radius: var(--radius-input);
    font-family: inherit;
    font-size: 1.125rem;
    color: var(--ink);
    background: var(--background);
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
    outline: none;
    border-color: var(--brand-color);
    box-shadow: 0 0 0 4px var(--brand-soft);
}

.form-field .text-sm {
    font-size: 0.8125rem;
}

.form-field input.form-calculated {
    background: var(--sky-soft);
    border-color: var(--sky-mid);
    color: var(--sky-deep);
    font-weight: 600;
    cursor: default;
}

.form-field input.form-calculated[data-calculated-manual="1"] {
    cursor: text;
}

.form-field input.form-calculated-updated {
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25);
}

/* Read-only submission rendered inside the original form layout (e.g. the
   approvals task view). Strips default fieldset chrome and keeps disabled
   fields fully legible instead of the browser's grayed-out look. */
.t-readonly-form {
    border: 0;
    margin: 0;
    padding: 0;
    min-width: 0;
}

.t-readonly-form input,
.t-readonly-form select,
.t-readonly-form textarea {
    opacity: 1 !important;
    color: var(--ink) !important;
    background: var(--surface-sunken) !important;
    cursor: default;
}


/* ==========================================================================
   Lists & Action Tiles
   ========================================================================== */

.t-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid var(--outline);
}

.t-list-item:last-child {
    border-bottom: none;
}

.t-action-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    padding: 1rem 1.25rem;
}

.t-action-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    min-height: 56px;
    padding: 1rem;
    border: 1px solid var(--outline);
    border-radius: var(--radius-card);
    background: var(--background);
    color: var(--ink-muted);
    text-decoration: none;
    text-align: center;
    transition: background var(--transition-base), border-color var(--transition-base),
                box-shadow var(--transition-base), transform var(--transition-base);
}

.t-action-tile:hover {
    background: var(--brand-soft);
    border-color: color-mix(in srgb, var(--brand-color) 35%, var(--outline));
    box-shadow: var(--shadow-card-hover);
    text-decoration: none;
    color: var(--ink);
    transform: translateY(-2px);
}

.t-action-tile-icon {
    font-size: 1.5rem;
    line-height: 1;
}

.t-action-tile-label {
    font-size: 0.8125rem;
    font-weight: 600;
}

.t-guided-intro {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(14rem, 0.8fr);
    gap: 1rem;
    padding: 1rem;
    border: 1px solid var(--outline);
    border-radius: var(--radius-card);
    background: var(--surface);
}

.t-guided-intro-title {
    font-size: 1rem;
    font-weight: 800;
}

.t-guided-intro-copy {
    margin: 0.35rem 0 0;
    color: var(--ink-muted);
    font-size: 0.875rem;
}

.t-step-list {
    display: grid;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: guided-step;
}

.t-step-list li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--ink-muted);
    font-size: 0.8125rem;
}

.t-step-list li::before {
    counter-increment: guided-step;
    content: counter(guided-step);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: var(--radius-pill);
    background: var(--brand-soft);
    color: var(--brand-color);
    font-weight: 800;
    flex: 0 0 auto;
}

.t-choice-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.t-choice-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
    min-height: 10rem;
    padding: 1.25rem;
    border: 1px solid var(--outline);
    border-radius: var(--radius-card);
    background: var(--background);
    color: inherit;
    text-decoration: none;
    transition: border-color var(--transition-base), box-shadow var(--transition-base), transform var(--transition-base);
}

button.t-choice-card {
    width: 100%;
    font: inherit;
    cursor: pointer;
}

.t-choice-card:hover {
    border-color: color-mix(in srgb, var(--brand-color) 40%, var(--outline));
    box-shadow: var(--shadow-card-hover);
    text-decoration: none;
    transform: translateY(-2px);
}

.t-choice-card-primary {
    border-color: color-mix(in srgb, var(--brand-color) 45%, var(--outline));
    background: linear-gradient(180deg, var(--brand-soft), var(--background));
}

.t-choice-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: var(--radius-input);
    background: var(--surface-sunken);
    color: var(--brand-color);
    font-size: 0.8125rem;
    font-weight: 800;
}

.t-choice-title {
    font-weight: 800;
    color: var(--ink);
}

.t-choice-desc {
    color: var(--ink-muted);
    font-size: 0.875rem;
    line-height: 1.4;
}

.t-choice-badge {
    position: absolute;
    top: 0.85rem;
    inset-inline-end: 0.85rem;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-pill);
    background: var(--brand-color);
    color: var(--text-on-brand);
    font-size: 0.6875rem;
    font-weight: 800;
}

.t-template-hero {
    margin-bottom: 1.25rem;
}

.t-template-hero-header .t-page-subtitle {
    margin-top: 0.35rem;
    color: var(--ink-muted);
    font-size: 0.9375rem;
    max-width: 42rem;
}

.t-template-gallery {
    padding: 1.25rem;
    border: 1px solid var(--outline);
    border-radius: var(--radius-card);
    background: color-mix(in srgb, var(--surface-sunken) 55%, var(--background));
}

.t-template-toolbar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.t-template-search-wrap {
    position: relative;
    display: block;
    width: 100%;
    max-width: none;
}

.t-template-search-icon {
    position: absolute;
    inset-inline-start: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    color: var(--ink-muted);
    pointer-events: none;
}

.t-template-search {
    width: 100%;
    padding-inline-start: 2.5rem;
    min-height: 2.75rem;
    border-color: var(--outline);
    background: var(--background);
    box-shadow: inset 0 1px 2px color-mix(in srgb, var(--ink) 4%, transparent);
}

.t-template-search:focus {
    border-color: var(--brand-color);
    box-shadow: 0 0 0 3px var(--brand-soft);
}

/* Category tabs (picker + marketplace filter) */
.t-cat-tabs {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.t-cat-tabs__list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
}

.t-cat-tabs--filter .t-cat-tabs__list,
.t-cat-tabs--inline .t-cat-tabs__list {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: thin;
    gap: 0.75rem 1.25rem;
    padding-bottom: 0.15rem;
}

.t-cat-tabs__tab {
    display: inline-flex;
    align-items: center;
    min-height: 2.125rem;
    padding: 0.35rem 0.15rem;
    border: none;
    border-radius: var(--radius-input);
    background: transparent;
    color: var(--ink-muted);
    font: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    transition: background var(--transition-base), color var(--transition-base), box-shadow var(--transition-base);
}

.t-cat-tabs--filter .t-cat-tabs__tab,
.t-marketplace-type-tabs .t-cat-tabs__tab,
.t-cat-tabs:not(.t-cat-tabs--inline) .t-cat-tabs__tab {
    padding: 0.45rem 1rem;
}

.t-cat-tabs__tab:hover {
    color: var(--ink);
}

.t-cat-tabs--filter .t-cat-tabs__tab:hover,
.t-marketplace-type-tabs .t-cat-tabs__tab:hover {
    background: transparent;
}

.t-cat-tabs__tab--active {
    background: var(--brand-color);
    color: var(--text-on-brand);
    font-weight: 700;
    box-shadow: 0 2px 8px color-mix(in srgb, var(--brand-color) 35%, transparent);
}

.t-cat-tabs--filter .t-cat-tabs__tab--active:hover,
.t-marketplace-type-tabs .t-cat-tabs__tab--active:hover {
    color: var(--text-on-brand);
}

.t-cat-tabs__panels {
    min-height: 0;
}

.t-cat-tabs__panel {
    display: none;
    padding: 0.85rem 1rem;
    border: 1px solid var(--outline);
    border-radius: var(--radius-input);
    background: var(--background);
}

.t-cat-tabs__panel--active {
    display: block;
}

.t-cat-tabs__panel-text {
    margin: 0;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: var(--ink-muted);
}

.t-cat-tabs--filter .t-cat-tabs__panel-text {
    padding: 0 0.125rem;
    border: none;
    background: transparent;
}

.t-category-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0;
    background: transparent;
    color: var(--ink-muted);
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.t-template-card-pages-count {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--ink-muted);
}

.t-template-grid {
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 1rem;
    align-items: stretch;
}

@media (min-width: 640px) {
    .t-template-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1280px) {
    .t-template-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.t-template-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    border: 1px solid var(--outline);
    border-radius: var(--radius-card);
    background: var(--background);
    overflow: hidden;
    transition: border-color var(--transition-base), box-shadow var(--transition-base), transform var(--transition-base);
}

.t-template-card:hover {
    border-color: color-mix(in srgb, var(--brand-color) 28%, var(--outline));
    box-shadow: 0 8px 24px color-mix(in srgb, var(--ink) 8%, transparent);
    transform: translateY(-2px);
}

.t-template-card-featured {
    border-color: color-mix(in srgb, #f59e0b 35%, var(--outline));
}

.t-template-card-accent {
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    flex-shrink: 0;
    height: 6.75rem;
    padding: 0.65rem 0.75rem 0;
    overflow: hidden;
    background: color-mix(in srgb, var(--surface-sunken) 70%, var(--background));
}

.t-template-card-accent[data-category="hr"] {
    background: linear-gradient(180deg, #eff6ff 0%, color-mix(in srgb, var(--surface-sunken) 70%, var(--background)) 100%);
}

.t-template-card-accent[data-category="finance"] {
    background: linear-gradient(180deg, #ecfdf5 0%, color-mix(in srgb, var(--surface-sunken) 70%, var(--background)) 100%);
}

.t-template-card-accent[data-category="construction"],
.t-template-card-accent[data-category="safety"] {
    background: linear-gradient(180deg, #fff7ed 0%, color-mix(in srgb, var(--surface-sunken) 70%, var(--background)) 100%);
}

.t-template-card-accent[data-category="sales"],
.t-template-card-accent[data-category="customer-service"] {
    background: linear-gradient(180deg, #fdf4ff 0%, color-mix(in srgb, var(--surface-sunken) 70%, var(--background)) 100%);
}

.t-template-card-preview {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.t-template-card-preview__frame {
    width: 72%;
    max-width: 9.5rem;
    height: 4.75rem;
    padding: 0.45rem;
    border-radius: 0.55rem 0.55rem 0 0;
    background: var(--background);
    box-shadow: 0 -2px 12px color-mix(in srgb, var(--ink) 6%, transparent), 0 8px 20px color-mix(in srgb, var(--ink) 10%, transparent);
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    overflow: hidden;
}

.t-template-card-preview__bar {
    display: block;
    height: 0.45rem;
    width: 42%;
    border-radius: 999px;
    background: color-mix(in srgb, var(--brand-color) 75%, #fff);
}

.t-template-card-preview__bar--sm {
    width: 55%;
    height: 0.35rem;
}

.t-template-card-preview__hero {
    display: block;
    height: 1.65rem;
    flex-shrink: 0;
    border-radius: 0.35rem;
    background: linear-gradient(135deg, color-mix(in srgb, var(--brand-color) 18%, #fff), color-mix(in srgb, var(--brand-color) 8%, var(--surface-sunken)));
}

.t-template-card-preview__line {
    display: block;
    height: 0.3rem;
    width: 100%;
    border-radius: 999px;
    background: var(--surface-sunken);
}

.t-template-card-preview__line--short {
    width: 68%;
}

.t-template-card-preview__split {
    display: grid;
    grid-template-columns: 0.85fr 1.65fr;
    gap: 0.3rem;
    height: 2.35rem;
    flex-shrink: 0;
}

.t-template-card-preview__side {
    border-radius: 0.35rem;
    background: color-mix(in srgb, var(--brand-color) 12%, var(--surface-sunken));
}

.t-template-card-preview__main {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.t-template-card-preview__dash {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 0.3rem;
    height: 2.35rem;
    flex-shrink: 0;
}

.t-template-card-preview__chart {
    border-radius: 0.35rem;
    background: linear-gradient(180deg, color-mix(in srgb, var(--brand-color) 22%, #fff), color-mix(in srgb, var(--brand-color) 8%, var(--surface-sunken)));
}

.t-template-card-preview__stats {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.t-template-card-preview__stat {
    flex: 1;
    border-radius: 0.3rem;
    background: var(--surface-sunken);
}

.t-template-card-preview__field {
    display: block;
    height: 0.55rem;
    border-radius: 0.25rem;
    background: var(--surface-sunken);
}

.t-template-card-preview__btn {
    display: block;
    width: 42%;
    height: 0.55rem;
    margin-top: 0.1rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--brand-color) 70%, #fff);
}

.t-template-card-category {
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: color-mix(in srgb, var(--ink) 55%, transparent);
}

.t-template-card-featured-badge {
    position: absolute;
    top: 0.65rem;
    inset-inline-end: 0.65rem;
    padding: 0.15rem 0.45rem;
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.9);
    color: #b45309;
    font-size: 0.6875rem;
    font-weight: 800;
}

.t-template-card-body {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding: 0.85rem 1rem 1rem;
    flex: 1;
    min-height: 0;
}

.t-template-card-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    min-height: 1.125rem;
}

.t-template-card-title {
    font-size: 0.9375rem;
    font-weight: 800;
    color: var(--ink);
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: calc(2 * 1.35 * 0.9375rem);
}

.t-template-card-desc {
    color: var(--ink-muted);
    font-size: 0.8125rem;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: calc(2 * 1.45 * 0.8125rem);
}

.t-template-card-pages {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.t-template-page-pill {
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-pill);
    background: var(--surface-sunken);
    color: var(--ink-muted);
    font-size: 0.6875rem;
    font-weight: 700;
}

.t-template-card-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: auto;
    padding-top: 0.65rem;
    border-top: 1px solid var(--outline);
}

.t-template-installs {
    color: var(--ink-muted);
    font-size: 0.75rem;
}

.t-template-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-inline-start: auto;
}

.t-template-delete-btn {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.t-template-delete-btn:hover {
    background: #fee2e2;
    border-color: #fca5a5;
}

.t-template-edit-details summary {
    list-style: none;
}

.t-template-edit-details summary::-webkit-details-marker {
    display: none;
}

.t-template-empty {
    grid-column: 1 / -1;
}

/* Sidebar category layout (create app modal) */
.t-template-gallery--sidebar {
    display: flex;
    flex: 1;
    min-height: 0;
    gap: 0;
    padding: 0;
    border: none;
    background: transparent;
}

.t-template-sidebar {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    width: 11.5rem;
    padding: 0.75rem 0.75rem 0.75rem 0;
    border-inline-end: 1px solid var(--outline);
    overflow-y: auto;
}

.t-template-sidebar__label {
    margin: 0 0 0.65rem;
    padding: 0 0.65rem;
    font-size: 0.6875rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-muted);
}

.t-cat-sidebar__list {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.t-cat-sidebar__item {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    width: 100%;
    min-height: 2.375rem;
    padding: 0.45rem 0.75rem;
    border: none;
    border-radius: var(--radius-input);
    background: transparent;
    color: var(--ink-muted);
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    text-align: start;
    cursor: pointer;
    transition: background var(--transition-base), color var(--transition-base);
}

.t-cat-sidebar__item:hover {
    background: var(--surface-sunken);
    color: var(--ink);
}

.t-cat-sidebar__item--active {
    background: var(--brand-color);
    color: var(--text-on-brand);
    font-weight: 700;
    box-shadow: 0 2px 8px color-mix(in srgb, var(--brand-color) 30%, transparent);
}

.t-cat-sidebar__item--active:hover {
    color: var(--text-on-brand);
}

.t-cat-sidebar__icon {
    flex-shrink: 0;
    width: 1.25rem;
    font-size: 1rem;
    line-height: 1;
    text-align: center;
}

.t-cat-sidebar__label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.t-cat-sidebar__desc {
    margin: 0.75rem 0 0;
    padding: 0 0.65rem;
    font-size: 0.75rem;
    line-height: 1.45;
    color: var(--ink-muted);
}

@media (max-width: 720px) {
    .t-template-gallery--sidebar {
        flex-direction: column;
    }

    .t-template-sidebar {
        width: 100%;
        padding: 0 0 0.75rem;
        border-inline-end: none;
        border-bottom: 1px solid var(--outline);
    }

    .t-cat-sidebar__list {
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: thin;
        padding-bottom: 0.15rem;
    }

    .t-cat-sidebar__item {
        width: auto;
        flex-shrink: 0;
    }

    .t-template-main {
        padding: 0.75rem 0 0;
    }

    .Mauqe-modal-panel--app-create {
        height: min(820px, 96vh);
    }

    .t-template-browser-modal--sidebar .t-template-grid {
        grid-template-columns: 1fr;
    }
}

.t-template-main {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    min-height: 0;
    padding: 0 0 0 1rem;
}

.t-template-browser-modal .t-template-gallery {
    padding: 0;
    border: none;
    background: transparent;
}

.t-template-browser-modal .t-template-toolbar {
    margin-bottom: 0.75rem;
}

.t-template-browser-modal--sidebar {
    display: flex;
    flex: 1;
    min-height: 0;
}

.t-template-browser-modal--sidebar .t-template-gallery--sidebar {
    width: 100%;
}

.t-template-browser-modal--sidebar .t-template-grid {
    max-height: none;
    flex: 1;
    overflow-y: auto;
    padding-inline-end: 0.25rem;
    grid-template-columns: repeat(2, minmax(11.5rem, 1fr));
}

@media (min-width: 1280px) {
    .t-template-browser-modal--sidebar .t-template-grid {
        grid-template-columns: repeat(3, minmax(11.5rem, 1fr));
    }
}

.t-template-browser-modal:not(.t-template-browser-modal--sidebar) .t-template-grid {
    max-height: 22rem;
    overflow-y: auto;
    padding-inline-end: 0.15rem;
}

/* Admin edit panel expands card — keep preview/body sizing stable */
.t-template-card .t-template-edit-details {
    margin-top: 0.25rem;
}

.t-template-preview-pages {
    padding: 0.85rem;
    border: 1px solid var(--outline);
    border-radius: var(--radius-card);
    background: var(--surface-sunken);
}

.t-template-preview-page-card {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.65rem 0.75rem;
    border-radius: var(--radius-input);
    background: var(--background);
    border: 1px solid var(--outline);
}

.t-template-preview-page-kind {
    font-size: 0.6875rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--brand-color);
}

.t-template-preview-page-title {
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--ink);
}

.t-guidance-card,
.t-advanced-details {
    padding: 1rem;
    border: 1px solid var(--outline);
    border-radius: var(--radius-card);
    background: var(--surface);
}

.t-advanced-details summary {
    cursor: pointer;
    color: var(--ink);
    font-weight: 700;
    font-size: 0.875rem;
}

@media (max-width: 767px) {
    .t-guided-intro,
    .t-choice-grid {
        grid-template-columns: 1fr;
    }
}


/* ==========================================================================
   Grid Cards
   ========================================================================== */

.t-grid-cards {
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 1rem;
}

@media (min-width: 640px) {
    .t-grid-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .t-grid-cards {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.t-grid-card {
    display: flex;
    flex-direction: column;
    padding: 1.25rem;
    background: var(--background);
    border: 1px solid var(--outline);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    color: inherit;
    text-decoration: none;
    transition: box-shadow var(--transition-base), border-color var(--transition-base), transform var(--transition-base);
}

.t-grid-card:hover {
    box-shadow: var(--shadow-card-hover);
    border-color: color-mix(in srgb, var(--brand-color) 30%, var(--outline));
    text-decoration: none;
    transform: translateY(-3px);
}

.t-grid-card-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 0.25rem;
    color: var(--ink);
}

.t-grid-card-desc {
    font-size: 0.8125rem;
    color: var(--ink-muted);
}

.t-grid-card-meta {
    font-size: 0.8125rem;
    color: var(--ink-subtle);
    margin: 0.25rem 0 0.75rem;
}

.t-grid-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: auto;
}


/* ==========================================================================
   Filter Pills
   ========================================================================== */

.t-filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.t-filter-pill {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0.375rem 0.875rem;
    border: 1px solid var(--outline-strong);
    border-radius: var(--radius-pill);
    background: var(--background);
    color: var(--ink-muted);
    font-size: 0.8125rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background var(--transition-base), border-color var(--transition-base), color var(--transition-base);
}

.t-filter-pill:hover {
    background: var(--surface-sunken);
    color: var(--ink);
    text-decoration: none;
}

.t-filter-pill-active {
    background: var(--sky-soft);
    border-color: var(--brand-color);
    color: var(--sky-deep);
    font-weight: 700;
}


/* ==========================================================================
   Empty States & Alerts
   ========================================================================== */

.t-empty {
    padding: 2.5rem 1.5rem;
    text-align: center;
    color: var(--ink-muted);
    font-size: 0.9375rem;
}

.t-empty-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    opacity: 0.6;
}

.t-empty-title {
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--ink-muted);
    margin-bottom: 0.25rem;
}

.t-alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-btn);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.t-alert-error {
    background: var(--coral-soft);
    color: #9A3412;
    border: 1px solid color-mix(in srgb, var(--coral) 45%, white);
}

.t-alert-success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.t-toast-stack {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 80;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: min(24rem, calc(100vw - 2rem));
    pointer-events: none;
}

[dir="rtl"] .t-toast-stack {
    right: auto;
    left: 1rem;
}

.t-toast {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: start;
    gap: 0.75rem;
    padding: 0.875rem 0.95rem;
    border-radius: var(--radius-btn);
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(203, 213, 225, 0.9);
    box-shadow: var(--shadow-lg);
    color: var(--ink);
    font-size: 0.875rem;
    line-height: 1.45;
    pointer-events: auto;
    opacity: 0;
    transform: translateX(1rem);
    transition: opacity var(--transition-base), transform var(--transition-base);
    backdrop-filter: blur(14px);
}

[dir="rtl"] .t-toast {
    transform: translateX(-1rem);
}

.t-toast.is-visible {
    opacity: 1;
    transform: translateX(0);
}

.t-toast-icon {
    width: 1.5rem;
    height: 1.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    font-weight: 800;
    font-size: 0.8rem;
}

.t-toast-success .t-toast-icon {
    background: #dcfce7;
    color: #15803d;
}

.t-toast-error .t-toast-icon {
    background: var(--coral-soft);
    color: #b91c1c;
}

.t-toast-info .t-toast-icon {
    background: var(--sky-soft);
    color: var(--sky-deep);
}

.t-toast-close {
    color: var(--ink-subtle);
    font-size: 1.2rem;
    line-height: 1;
    border: 0;
    background: transparent;
    cursor: pointer;
    padding: 0;
}

.t-toast-close:hover {
    color: var(--ink);
}

@media (max-width: 640px) {
    .t-toast-stack {
        top: auto;
        right: 1rem;
        left: 1rem;
        bottom: 1rem;
        width: auto;
    }

    [dir="rtl"] .t-toast-stack {
        right: 1rem;
        left: 1rem;
    }
}


/* ==========================================================================
   Progress Bar
   ========================================================================== */

.t-progress {
    width: 100%;
}

.t-progress-track {
    width: 100%;
    height: 8px;
    border-radius: var(--radius-pill);
    background: var(--sky-soft);
    overflow: hidden;
}

.t-progress-fill {
    height: 100%;
    border-radius: var(--radius-pill);
    background: var(--leaf);
    transition: width var(--transition-base);
}


/* ==========================================================================
   Tag Pills
   ========================================================================== */

.t-tag-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}

.t-tag-pill--sky {
    background: var(--sky-soft);
    color: var(--sky-deep);
}

.t-tag-pill--sun {
    background: color-mix(in srgb, var(--sun) 18%, white);
    color: var(--sun-deep);
}

.t-tag-pill--leaf {
    background: var(--leaf-soft);
    color: var(--leaf-deep);
}

.t-tag-pill--berry {
    background: var(--berry-soft);
    color: #7E22CE;
}


/* ==========================================================================
   Login Page
   ========================================================================== */

.t-login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--sky-deep) 0%, var(--brand-color) 45%, var(--sky-bright) 100%);
    font-family: var(--font-sans);
}

.t-login-card {
    width: 100%;
    max-width: 28rem;
    background: var(--background);
    border-radius: var(--radius-modal);
    box-shadow: var(--shadow-xl);
    padding: 2rem;
}

.t-login-brand {
    text-align: center;
    margin-bottom: 1.5rem;
}

.t-login-logo-img {
    display: block;
    width: 4.5rem;
    height: 4.5rem;
    margin: 0 auto 0.75rem;
    object-fit: contain;
}

.t-login-title,
.t-login-card h1 {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--brand-color);
    text-align: center;
    margin: 0;
}

.t-login-tagline,
.t-login-card .t-login-tagline {
    text-align: center;
    color: var(--ink-muted);
    margin-top: 0.25rem;
    font-size: 0.9375rem;
}

.t-login-demo {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--outline);
}

.t-login-demo-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--ink-subtle);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.5rem;
}

.t-demo-account,
.demo-account {
    display: block;
    width: 100%;
    text-align: start;
    padding: 0.375rem 0.5rem;
    border: none;
    border-radius: var(--radius-input);
    background: transparent;
    color: var(--ink-muted);
    font-family: inherit;
    font-size: 0.75rem;
    cursor: pointer;
    transition: background var(--transition-base), color var(--transition-base);
}

.t-demo-account:hover,
.demo-account:hover {
    background: var(--brand-soft);
    color: var(--brand-color);
}


/* ==========================================================================
   Public Share
   ========================================================================== */

.t-share-page {
    min-height: 100vh;
    background: var(--surface);
    padding: 2rem 1rem;
    font-family: var(--font-sans);
}

.t-share-page.t-share-iframe {
    padding: 1rem;
}

.t-share-card {
    max-width: 42rem;
    margin: 0 auto;
    background: var(--background);
    border: 1px solid var(--outline);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

.t-share-card-header {
    padding: 1.25rem 1.5rem 0.5rem;
}

.t-share-card-title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--brand-color);
}

.t-share-tabs {
    display: flex;
    border-bottom: 1px solid var(--outline);
    padding: 0 1rem;
}

.share-tab,
.t-share-tab {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--ink-muted);
    border: none;
    border-bottom: 2px solid transparent;
    background: none;
    cursor: pointer;
    transition: color var(--transition-base), border-color var(--transition-base), background var(--transition-base);
}

.share-tab:hover,
.t-share-tab:hover {
    color: var(--ink);
}

.share-tab-active,
.t-share-tab-active {
    color: var(--brand-color);
    border-bottom-color: var(--brand-color);
    background: var(--sky-soft);
}

.t-share-panel {
    padding: 1.5rem;
}

.t-share-submit {
    display: block;
    width: 100%;
    min-height: 48px;
    margin-top: 1rem;
    padding: 0.625rem 1rem;
    border: none;
    border-radius: var(--radius-btn);
    background: var(--brand-color);
    color: var(--text-on-brand);
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition-base);
}

.t-share-submit:hover {
    background: var(--brand-hover);
}

/* Share page designer — per-form public page theming */
.t-share-page.t-share-designed .t-share-shell {
    width: 100%;
    margin-inline: auto;
    padding-inline: 1rem;
}

.t-share-page.t-share-designed .t-share-card {
    max-width: none;
    width: 100%;
}

.t-share-page.t-share-designed.t-share-w-narrow .t-share-shell { max-width: 28rem; }
.t-share-page.t-share-designed.t-share-w-medium .t-share-shell { max-width: 42rem; }
.t-share-page.t-share-designed.t-share-w-wide .t-share-shell { max-width: 72rem; }

.t-share-page.t-share-designed:not(.t-share-w-full) {
    margin-inline: auto;
    padding-left: 0;
    padding-right: 0;
}

.t-share-page.t-share-designed.t-share-w-full:not(.t-share-iframe) {
    padding: 0;
}

.t-share-page.t-share-designed.t-share-w-full.t-share-iframe {
    padding-left: 0;
    padding-right: 0;
}

.t-share-page.t-share-designed.t-share-w-full .t-share-shell {
    max-width: none;
    padding-inline: 0;
}

.t-share-page.t-share-designed.t-share-w-full:not(.t-share-iframe) .t-share-shell {
    min-height: 100vh;
}

.t-share-page.t-share-designed.t-share-w-full .t-share-card {
    min-height: inherit;
    border-left: none;
    border-right: none;
}

.t-share-page.t-share-iframe.t-share-designed.t-share-w-full .t-share-shell {
    min-height: 100%;
}

/* Legacy width helpers (preview / fallback) */
.t-share-w-narrow { max-width: 28rem; }
.t-share-w-medium { max-width: 42rem; }
.t-share-w-wide { max-width: 72rem; }
.t-share-w-full { max-width: none; width: 100%; }

.t-share-designed .t-share-logo {
    height: var(--share-logo-h, 40px);
    width: auto;
    max-width: 100%;
    object-fit: contain;
}

.t-share-header-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.t-share-header-centered .t-share-header-brand,
.t-share-header-banner .t-share-header-brand {
    justify-content: center;
}

.t-share-page-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--brand-color);
    line-height: 1.2;
}

.t-share-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1.5rem 0.5rem;
}

.t-share-header-centered {
    flex-direction: column;
    text-align: center;
    justify-content: center;
}

.t-share-header-banner {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    padding: 1.5rem;
    margin: 0;
    background: color-mix(in srgb, var(--brand-color) 10%, var(--share-card, white));
    border-bottom: 1px solid color-mix(in srgb, var(--brand-color) 15%, var(--outline));
}

.t-share-hide-title .t-share-card-title { display: none !important; }

.t-share-radius-none .t-share-card { border-radius: 0; }
.t-share-radius-sm .t-share-card { border-radius: 0.375rem; }
.t-share-radius-md .t-share-card { border-radius: 0.5rem; }
.t-share-radius-lg .t-share-card { border-radius: var(--radius-card); }
.t-share-radius-xl .t-share-card { border-radius: 1rem; }

.t-share-shadow-none .t-share-card { box-shadow: none; }
.t-share-shadow-sm .t-share-card { box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08); }
.t-share-shadow-md .t-share-card { box-shadow: var(--shadow-card); }
.t-share-shadow-lg .t-share-card { box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12); }

.t-share-pad-compact .t-share-panel { padding: 1rem; }
.t-share-pad-normal .t-share-panel { padding: 1.5rem; }
.t-share-pad-spacious .t-share-panel { padding: 2rem; }

.share-submissions-table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.share-submissions-table .t-table th,
.share-submissions-table .t-table td {
    white-space: nowrap;
    max-width: 16rem;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: top;
}

.share-submissions-table .t-table td:hover {
    white-space: normal;
    overflow: visible;
    word-break: break-word;
}

.submissions-data-table {
    overflow-x: auto;
}

.submissions-data-table .t-table th,
.submissions-data-table .t-table td {
    white-space: nowrap;
    max-width: 14rem;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: top;
}

.submissions-data-table .t-table td:hover {
    white-space: normal;
    overflow: visible;
    word-break: break-word;
}

.field-readonly {
    opacity: 0.85;
}

.field-readonly input,
.field-readonly select,
.field-readonly textarea {
    background: var(--surface-sunken);
    cursor: not-allowed;
}

.field-rules-panel {
    background: var(--surface-sunken);
    border-radius: var(--radius-md);
    padding: 0.625rem;
}

.field-rules-section {
    border: 1px solid var(--outline);
    border-radius: var(--radius-sm);
    margin-top: 0.5rem;
    background: var(--surface);
}

.field-rules-summary {
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--ink);
    padding: 0.5rem 0.625rem;
    list-style: none;
}

.field-rules-summary::-webkit-details-marker {
    display: none;
}

.field-rules-body {
    padding: 0 0.625rem 0.625rem;
}

.field-access-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.field-access-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.6875rem;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--outline-strong);
    border-radius: var(--radius-pill);
    background: var(--surface);
    cursor: pointer;
}

.field-access-chip--builtin {
    border-color: var(--sky-mid);
    background: var(--sky-soft);
}

.field-access-chip input {
    margin: 0;
}

.t-share-font-system { font-family: var(--font-sans); }
.t-share-font-serif { font-family: Georgia, 'Times New Roman', serif; }
.t-share-font-rounded { font-family: 'Segoe UI', system-ui, sans-serif; }

.t-share-btn-radius-sm .t-share-submit { border-radius: 0.25rem; }
.t-share-btn-radius-md .t-share-submit { border-radius: var(--radius-btn); }
.t-share-btn-radius-lg .t-share-submit { border-radius: 0.75rem; }
.t-share-btn-radius-full .t-share-submit { border-radius: 9999px; }

.t-share-btn-outline .t-share-submit {
    background: transparent;
    color: var(--brand-color);
    border: 2px solid var(--brand-color);
}
.t-share-btn-outline .t-share-submit:hover {
    background: var(--brand-soft);
}

.t-share-btn-soft .t-share-submit {
    background: color-mix(in srgb, var(--brand-color) 14%, white);
    color: var(--brand-color);
}
.t-share-btn-soft .t-share-submit:hover {
    background: color-mix(in srgb, var(--brand-color) 22%, white);
}

.t-share-menu-none .t-share-tabs { display: none; }

.t-share-tabs-pills {
    display: flex;
    gap: 0.35rem;
    padding: 0.75rem 1rem 0;
    border-bottom: none;
}
.t-share-menu-pills .t-share-tab,
.t-share-tabs-pills .t-share-tab {
    border-radius: 9999px;
    border-bottom: none;
    padding: 0.4rem 0.9rem;
    background: var(--surface);
}
.t-share-menu-pills .share-tab-active,
.t-share-tabs-pills .share-tab-active {
    background: var(--brand-color);
    color: var(--text-on-brand);
}

.t-share-tabs-underline { border-bottom: 1px solid var(--outline); }
.t-share-menu-underline .t-share-tab { border-bottom-width: 3px; }

/* Share settings — page designer sidebar */
.share-design-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 0.25rem;
}
.share-design-input {
    width: 100%;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 0.375rem 0.5rem;
    font-size: 0.8125rem;
}
.share-design-preview-wrap {
    background: #f1f5f9;
    min-height: 280px;
}
.share-preview-root {
    border-radius: 0.5rem;
    transform: scale(0.92);
    transform-origin: top center;
}
.share-preview-root:not(.t-share-w-full) {
    margin-inline: auto;
}
.share-designer-scroll {
    scrollbar-width: thin;
}

.t-share-settings-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--outline);
    background: var(--surface-muted, #F8FAFC);
}

.t-share-settings-tab {
    flex: 1;
    padding: 0.875rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--ink-muted, #64748B);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
}

.t-share-settings-tab:hover {
    color: var(--ink, #0F172A);
    background: color-mix(in srgb, var(--brand-color) 6%, white);
}

.t-share-settings-tab.share-settings-tab-active {
    color: var(--brand-color);
    border-bottom-color: var(--brand-color);
    background: white;
}

.share-menu-item .hidden {
    display: none;
}

.t-share-tab-link {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.t-share-html-content {
    line-height: 1.6;
}

.t-share-html-content img {
    max-width: 100%;
    height: auto;
}

.t-share-tools {
    padding: 0 0 0.25rem;
}

.t-share-tools-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.t-share-tool-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.4rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 500;
    border: 1px solid color-mix(in srgb, var(--brand-color) 25%, var(--outline, #E2E8F0));
    border-radius: 0.5rem;
    background: var(--share-card, #fff);
    color: var(--brand-color);
    cursor: pointer;
    text-decoration: none;
    line-height: 1.2;
}

.t-share-tool-btn:hover:not(:disabled) {
    background: color-mix(in srgb, var(--brand-color) 8%, var(--share-card, #fff));
}

.t-share-tool-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.t-share-tool-btn.t-share-tool-primary {
    background: var(--brand-color);
    color: #fff;
    border-color: var(--brand-color);
}

.t-share-tool-btn.t-share-tool-primary:hover:not(:disabled) {
    filter: brightness(1.05);
}

.t-share-tool-upload {
    cursor: pointer;
}

.t-share-tool-meta {
    font-size: 0.8125rem;
    color: var(--ink-muted, #64748B);
    min-width: 5rem;
    text-align: center;
}

.t-share-tool-hint {
    margin: 0.5rem 0 0;
    font-size: 0.75rem;
    color: var(--ink-muted, #64748B);
}

.t-share-tool-hint.t-share-tool-error {
    color: #DC2626;
}

@media print {
    body.t-share-printing > *:not(.t-share-shell),
    body.t-share-printing .t-share-header,
    body.t-share-printing .t-share-tabs,
    body.t-share-printing .t-share-tools,
    body.t-share-printing .t-share-submit,
    body.t-share-printing [role="tabpanel"]:not(.t-share-print-target) {
        display: none !important;
    }

    body.t-share-printing .t-share-print-target {
        display: block !important;
    }

    body.t-share-printing .t-share-card {
        box-shadow: none;
        border: none;
    }
}

.share-menu-sort {
    display: inline-flex;
    gap: 0.25rem;
}

.share-menu-sort button {
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
    border: 1px solid var(--outline, #E2E8F0);
    border-radius: 0.375rem;
    background: white;
    color: var(--ink-muted, #64748B);
}

.share-menu-sort button:hover:not(:disabled) {
    background: #F8FAFC;
    color: var(--ink, #0F172A);
}

.share-menu-sort button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}


/* ==========================================================================
   Modals
   ========================================================================== */

.Mauqe-modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.45);
}

.Mauqe-modal.hidden {
    display: none;
}

.Mauqe-modal-panel {
    background: var(--background);
    border-radius: var(--radius-modal);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-height: calc(100vh - 2rem);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.Mauqe-modal-panel--app-create {
    max-width: min(72rem, 96vw);
    height: min(820px, 92vh);
}

.Mauqe-modal-body {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.full-table-modal-panel {
    width: min(96vw, 96rem);
    height: min(92vh, 900px);
}

.full-table-modal-body {
    overflow: hidden;
}

.full-table-modal-content,
.full-table-modal-table-wrap {
    height: 100%;
    min-height: 0;
}

.full-table-modal-table-wrap {
    overflow: auto;
}

.Mauqe-modal-body--app-create {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
}

.Mauqe-modal-tab-panel {
    flex: 1;
    min-height: 0;
}

.Mauqe-modal-tab-panel--templates {
    display: flex;
    flex-direction: column;
    padding: 1rem 1.25rem 1.25rem;
    overflow: hidden;
}

.t-app-templates-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.85rem;
    flex-shrink: 0;
}

.t-app-templates-header__title {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--ink);
}

.t-app-templates-header__subtitle {
    margin: 0.2rem 0 0;
    font-size: 0.8125rem;
    color: var(--ink-muted);
}

.Mauqe-modal-footer {
    background: var(--background);
    border-top: 1px solid var(--outline);
}

@supports (height: 100dvh) {
    .Mauqe-modal-panel {
        max-height: calc(100dvh - 2rem);
    }

    .Mauqe-modal-panel--app-create {
        height: min(820px, 92dvh);
    }
}

.modal-tab-active {
    color: var(--brand-color);
    border-color: var(--brand-color);
    font-weight: 700;
}


/* ==========================================================================
   Form Builder
   ========================================================================== */

.form-builder-page {
    height: 100%;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.form-builder-grid {
    flex: 1;
    min-height: 0;
    align-items: stretch;
}

.form-builder-panel,
.form-builder-canvas {
    min-height: 0;
}

.builder-mode .form-builder-scroll {
    scrollbar-width: thin;
}

#form-canvas.drag-over {
    border-color: var(--brand-color) !important;
    background: var(--surface-sunken) !important;
}

.palette-section-title {
    margin-bottom: 0.5rem;
    color: var(--ink-muted);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.palette-field-btn {
    padding: 0.75rem 0.625rem;
    min-height: 3rem;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.25;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    background: var(--surface);
    border-radius: var(--radius-input);
    position: relative;
    transition: background var(--transition-base), border-color var(--transition-base);
}

.palette-field-btn[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    top: calc(100% + 0.35rem);
    left: 0;
    width: max-content;
    max-width: min(16rem, calc(100vw - 2rem));
    padding: 0.45rem 0.6rem;
    background: var(--ink);
    color: #fff;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    font-size: 0.72rem;
    font-weight: 500;
    line-height: 1.35;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-0.15rem);
    transition: opacity var(--transition-base), transform var(--transition-base);
    white-space: normal;
    z-index: 40;
}

.palette-field-btn[data-tooltip]:hover::after,
.palette-field-btn[data-tooltip]:focus-visible::after {
    opacity: 1;
    transform: translateY(0);
}

.palette-field-btn:active {
    transform: scale(0.98);
}

.palette-tab {
    color: var(--ink-subtle);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background var(--transition-base), color var(--transition-base);
}

.palette-tab:hover {
    color: var(--ink);
}

.palette-tab.active {
    background: var(--brand-color);
    color: #fff;
}

.field-item {
    border: 1px solid var(--outline);
    border-radius: var(--radius-input);
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    cursor: grab;
    transition: border-color var(--transition-base), box-shadow var(--transition-base),
                opacity var(--transition-base), background var(--transition-base);
}

.field-item:active {
    cursor: grabbing;
}

.field-item.dragging {
    opacity: 0.45;
}

.field-item.drag-over-top {
    box-shadow: inset 0 3px 0 var(--brand-color);
}

.field-item.drag-over-bottom {
    box-shadow: inset 0 -3px 0 var(--brand-color);
}

.field-drag-handle {
    color: var(--ink-subtle);
    font-size: 1rem;
    line-height: 1;
    user-select: none;
    flex-shrink: 0;
}

.field-item:hover,
.field-item.selected {
    border-color: var(--brand-color);
    background: var(--brand-soft);
}

.field-row-group .field-item-in-row,
.field-row-cols .field-item {
    margin-bottom: 0;
}

.field-repeat-group .field-item {
    margin-bottom: 0;
}

.field-repeat-children {
    min-height: 2rem;
}

.form-repeat-group {
    padding: 0.75rem;
    border-radius: var(--radius-card);
    border: 1px dashed var(--outline-subtle);
    background: var(--surface-sunken);
}

.form-repeat-item:last-child {
    border-bottom: none !important;
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

.form-duplicate-group {
    padding: 0.75rem;
    border-radius: var(--radius-card);
    border: 1px dashed var(--outline-subtle);
    background: var(--surface-sunken);
}

.form-duplicate-item:last-child {
    border-bottom: none !important;
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

.field-duplicate-group {
    min-height: 2rem;
}

.field-duplicate-children {
    min-height: 2rem;
}

/* Form multi-column layout (used by renderer) */
.form-grid-12 {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 1rem 1rem;
}

.form-col-full {
    grid-column: 1 / -1;
}

@media (min-width: 768px) {
    .form-col-half {
        grid-column: span 6 / span 6;
    }

    .form-col-third {
        grid-column: span 4 / span 4;
    }

    .form-col-quarter {
        grid-column: span 3 / span 3;
    }

    .form-row-2 {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1rem;
    }

    .form-row-3 {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 1rem;
    }

    .form-row-4 {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 1rem;
    }
}

@media (max-width: 767px) {
    .form-col-half,
    .form-col-third,
    .form-col-quarter {
        grid-column: 1 / -1;
    }

    .form-row-2,
    .form-row-3,
    .form-row-4 {
        display: grid;
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}


/* Public website blocks (form builder website tab) */
.web-block {
    grid-column: 1 / -1;
}

.web-hero {
    text-align: center;
    padding: 3rem 1.5rem;
    border-radius: var(--radius-card);
    background: linear-gradient(135deg, var(--brand-soft) 0%, var(--surface-sunken) 100%);
}

.web-hero-title {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 800;
    color: var(--ink);
    margin-bottom: 0.75rem;
}

.web-hero-subtitle {
    font-size: 1.125rem;
    color: var(--ink-muted);
    max-width: 36rem;
    margin: 0 auto 1.5rem;
}

.web-btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-btn);
    font-weight: 600;
    text-decoration: none;
    transition: opacity var(--transition-base);
}

.web-btn-primary {
    background: var(--brand-color);
    color: #fff;
}

/* Global body.t-app a:not(.t-btn) link color overrides filled website buttons. */
body.t-app a.web-btn,
body.t-app a.web-btn:hover {
    text-decoration: none;
}

body.t-app a.web-btn-primary,
body.t-app a.web-btn-primary:hover {
    color: #fff;
}

body.t-app a.web-btn-banner,
body.t-app a.web-btn-banner:hover {
    color: var(--text-on-brand);
}

.form-field .web-btn-primary {
    color: #fff;
}

.form-field.elem-btn-outline .web-btn-primary,
.form-field.elem-btn-ghost .web-btn-primary {
    color: var(--elem-accent, var(--brand-color));
}

.form-field[style*="--elem-text"] .web-hero-title,
.form-field[style*="--elem-text"] .web-hero-subtitle,
.form-field[style*="--elem-text"] .web-nav-brand,
.form-field[style*="--elem-text"] .web-newsletter-title,
.form-field[style*="--elem-text"] .web-newsletter-sub,
.form-field[style*="--elem-text"] .web-banner-text,
.form-field[style*="--elem-text"] .web-section-title,
.form-field[style*="--elem-text"] > label,
.form-field[style*="--elem-text"] .dash-heading-title,
.form-field[style*="--elem-text"] .dash-info {
    color: var(--elem-text);
}

.web-btn-primary:hover {
    opacity: 0.9;
}

.web-paragraph p {
    font-size: 1.0625rem;
    line-height: 1.7;
    color: var(--ink-muted);
}

.web-section-title {
    font-size: 1.375rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--ink);
}

.web-image {
    width: 100%;
    border-radius: var(--radius-card);
    object-fit: cover;
    max-height: 28rem;
}

.web-image-caption {
    text-align: center;
    font-size: 0.875rem;
    color: var(--ink-muted);
    margin-top: 0.5rem;
}

.web-video-frame,
.web-map-frame {
    width: 100%;
    aspect-ratio: 16 / 9;
    border: 0;
    border-radius: var(--radius-card);
}

.web-video-placeholder,
.web-map-placeholder {
    padding: 2rem;
    text-align: center;
    background: var(--surface-sunken);
    border-radius: var(--radius-card);
    color: var(--ink-muted);
}

.web-cta {
    text-align: center;
    padding: 1rem 0;
}

.web-feature-grid,
.web-testimonial-grid,
.web-stat-grid,
.web-gallery-grid,
.web-pricing-grid {
    display: grid;
    gap: 1rem;
}

@media (min-width: 640px) {
    .web-feature-grid,
    .web-pricing-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .web-testimonial-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .web-stat-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .web-gallery-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.web-feature-card,
.web-testimonial,
.web-pricing-card {
    padding: 1.25rem;
    border: 1px solid var(--outline);
    border-radius: var(--radius-card);
    background: var(--surface);
}

.web-feature-icon {
    font-size: 1.75rem;
    display: block;
    margin-bottom: 0.5rem;
}

.web-feature-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.web-feature-desc {
    font-size: 0.875rem;
    color: var(--ink-muted);
}

.web-testimonial-quote {
    font-style: italic;
    margin-bottom: 0.5rem;
}

.web-testimonial-author {
    font-size: 0.875rem;
    color: var(--ink-muted);
    font-style: normal;
}

.web-faq-item {
    border: 1px solid var(--outline);
    border-radius: var(--radius-input);
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
}

.web-faq-question {
    font-weight: 600;
    cursor: pointer;
}

.web-faq-answer {
    margin-top: 0.5rem;
    font-size: 0.9375rem;
    color: var(--ink-muted);
}

.web-stat {
    text-align: center;
    padding: 1rem;
}

.web-stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--brand-color);
}

.web-stat-label {
    font-size: 0.875rem;
    color: var(--ink-muted);
}

.web-gallery-item img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: var(--radius-input);
}

.web-gallery-item figcaption {
    font-size: 0.8125rem;
    color: var(--ink-muted);
    margin-top: 0.25rem;
}

.gallery-upload-list {
    margin-bottom: 0.5rem;
}

.gallery-upload-row {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.5rem;
    border: 1px solid var(--outline);
    border-radius: var(--radius-md);
    background: var(--surface-sunken);
}

.gallery-upload-thumb {
    width: 3rem;
    height: 3rem;
    border-radius: var(--radius-sm);
    object-fit: cover;
    flex-shrink: 0;
    background: var(--surface);
    border: 1px solid var(--outline);
}

.gallery-upload-thumb--empty {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: var(--ink-muted);
}

.gallery-upload-fields {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.gallery-upload-btn,
.gallery-upload-add {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-top: 0.25rem;
    padding: 0.35rem 0.5rem;
    border: 1px dashed var(--sky-mid, #38bdf8);
    border-radius: var(--radius-sm);
    color: var(--sky-deep, #0369a1);
    background: var(--sky-soft, #eff6ff);
    cursor: pointer;
    font-weight: 600;
}

.gallery-upload-add {
    margin-top: 0.5rem;
}

.gallery-upload-btn:hover,
.gallery-upload-add:hover {
    background: #dbeafe;
}

.web-navbar {
    border: 1px solid var(--outline);
    border-radius: var(--radius-card);
    padding: 0.75rem 1rem;
    background: var(--surface);
}

.web-navbar-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.web-nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    color: var(--ink);
}

.web-nav-logo {
    height: 2rem;
    width: auto;
}

.web-nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.web-nav-link {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--ink-muted);
    text-decoration: none;
}

.web-nav-link:hover {
    color: var(--brand-color);
}

.web-footer {
    text-align: center;
    padding: 1.5rem 1rem;
    border-top: 1px solid var(--outline);
    margin-top: 1rem;
}

.web-footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.web-footer-link {
    font-size: 0.875rem;
    color: var(--ink-muted);
    text-decoration: none;
}

.web-footer-copy {
    font-size: 0.8125rem;
    color: var(--ink-subtle);
}

.web-social-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.web-social-link {
    padding: 0.5rem 1rem;
    border: 1px solid var(--outline);
    border-radius: var(--radius-btn);
    font-size: 0.875rem;
    text-decoration: none;
    color: var(--ink);
}

.web-contact-list {
    display: grid;
    gap: 0.5rem;
}

.web-contact-item {
    padding: 0.75rem 1rem;
    background: var(--surface-sunken);
    border-radius: var(--radius-input);
    font-size: 0.9375rem;
}

.web-pricing-plan {
    font-weight: 700;
    font-size: 1.125rem;
}

.web-pricing-price {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--brand-color);
    margin: 0.5rem 0 1rem;
}

.web-pricing-features {
    list-style: disc;
    padding-inline-start: 1.25rem;
    font-size: 0.875rem;
    color: var(--ink-muted);
}

.web-quote {
    border-inline-start: 4px solid var(--brand-color);
    padding: 1rem 1.25rem;
    background: var(--surface-sunken);
    border-radius: 0 var(--radius-card) var(--radius-card) 0;
}

.web-quote-text {
    font-size: 1.125rem;
    font-style: italic;
    margin-bottom: 0.5rem;
}

.web-quote-author {
    font-size: 0.875rem;
    color: var(--ink-muted);
}

.web-list-items {
    list-style: disc;
    padding-inline-start: 1.5rem;
    line-height: 1.8;
    color: var(--ink-muted);
}

/* Team */
.web-team-grid {
    display: grid;
    gap: 1.25rem;
    grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
}

.web-team-card {
    text-align: center;
    padding: 1rem;
    border-radius: var(--radius-card);
    background: var(--surface-elevated);
    box-shadow: var(--shadow-card);
}

.web-team-photo {
    width: 5rem;
    height: 5rem;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 0.75rem;
    display: block;
}

.web-team-name {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 0.25rem;
}

.web-team-role {
    font-size: 0.875rem;
    color: var(--ink-muted);
    margin: 0;
}

/* Steps */
.web-steps-list {
    display: grid;
    gap: 1rem;
}

.web-step {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.web-step-num {
    flex-shrink: 0;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    background: var(--brand-soft);
    color: var(--brand-color);
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
}

.web-step-title {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 0.25rem;
}

.web-step-desc {
    font-size: 0.875rem;
    color: var(--ink-muted);
    margin: 0;
    line-height: 1.5;
}

/* Logo cloud */
.web-logo-subtitle {
    text-align: center;
    color: var(--ink-muted);
    font-size: 0.875rem;
    margin: -0.5rem 0 1rem;
}

.web-logo-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: center;
    justify-content: center;
}

.web-logo-img {
    max-height: 2.5rem;
    max-width: 7rem;
    object-fit: contain;
    opacity: 0.75;
    filter: grayscale(100%);
    transition: opacity var(--transition-fast), filter var(--transition-fast);
}

.web-logo-item:hover .web-logo-img {
    opacity: 1;
    filter: none;
}

/* Banner */
.web-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 0.875rem 1.25rem;
    border-radius: var(--radius-btn);
    background: var(--brand-color);
    color: var(--text-on-brand);
    text-align: center;
}

.web-banner-text {
    margin: 0;
    font-weight: 600;
    font-size: 0.9375rem;
}

.web-btn-banner {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-on-brand);
    border: 1px solid rgba(255, 255, 255, 0.35);
    padding: 0.375rem 0.875rem;
    font-size: 0.8125rem;
}

.web-btn-banner:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Timeline */
.web-timeline-list {
    position: relative;
    padding-inline-start: 1.5rem;
    border-inline-start: 2px solid var(--outline);
}

.web-timeline-item {
    position: relative;
    padding-bottom: 1.5rem;
}

.web-timeline-item:last-child {
    padding-bottom: 0;
}

.web-timeline-marker {
    position: absolute;
    inset-inline-start: -1.625rem;
    top: 0.35rem;
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
    background: var(--brand-color);
    box-shadow: 0 0 0 3px var(--brand-soft);
}

.web-timeline-title {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 0.25rem;
}

.web-timeline-desc {
    font-size: 0.875rem;
    color: var(--ink-muted);
    margin: 0;
    line-height: 1.5;
}

/* Newsletter */
.web-newsletter {
    text-align: center;
    padding: 2rem;
    border-radius: var(--radius-card);
    background: var(--surface-sunken);
}

.web-newsletter-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0 0 0.5rem;
    color: var(--ink);
}

.web-newsletter-sub {
    color: var(--ink-muted);
    font-size: 0.9375rem;
    margin: 0 0 1.25rem;
}

.web-newsletter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    max-width: 28rem;
    margin: 0 auto;
}

.web-newsletter-input {
    flex: 1 1 12rem;
    min-width: 0;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--outline);
    border-radius: var(--radius-input);
    font-size: 0.9375rem;
}

/* Content cards */
.web-cards-grid {
    display: grid;
    gap: 1.25rem;
    grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
}

.web-content-card {
    border-radius: var(--radius-card);
    overflow: hidden;
    background: var(--surface-elevated);
    box-shadow: var(--shadow-card);
}

.web-card-img {
    width: 100%;
    height: 10rem;
    object-fit: cover;
    display: block;
}

.web-card-body {
    padding: 1rem 1.25rem 1.25rem;
}

.web-card-title {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 0.375rem;
}

.web-card-desc {
    font-size: 0.875rem;
    color: var(--ink-muted);
    margin: 0;
    line-height: 1.5;
}

/* Comparison table */
.web-comparison-wrap {
    overflow-x: auto;
}

.web-comparison-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.web-comparison-table th,
.web-comparison-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--outline);
    text-align: center;
}

.web-comparison-table th {
    font-weight: 700;
    background: var(--surface-sunken);
}

.web-compare-feature-col,
.web-compare-feature {
    text-align: start;
    font-weight: 600;
}

.web-compare-yes {
    color: var(--leaf-deep);
    font-weight: 700;
}

.web-compare-no {
    color: var(--ink-faint);
}

.comparison-editor {
    font-size: 0.8125rem;
}

.comparison-plan-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.comparison-plan-chip {
    display: flex;
    align-items: center;
    gap: 0.15rem;
    padding: 0.15rem;
    border: 1px solid var(--outline);
    border-radius: var(--radius-sm);
    background: var(--surface-sunken);
}

.comparison-plan-input {
    width: 5.5rem;
    border: none;
    background: transparent;
    padding: 0.2rem 0.35rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.comparison-plan-input:focus {
    outline: none;
}

.comparison-plan-remove {
    color: var(--ink-faint);
    padding: 0 0.25rem;
    line-height: 1;
}

.comparison-plan-remove:hover {
    color: #dc2626;
}

.comparison-grid {
    border: 1px solid var(--outline);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--surface);
}

.comparison-grid-header,
.comparison-feature-row {
    display: grid;
    grid-template-columns: minmax(6rem, 1.4fr) repeat(var(--compare-cols, 3), minmax(2.5rem, 1fr)) 1.5rem;
    gap: 0.25rem;
    align-items: center;
    padding: 0.35rem 0.5rem;
}

.comparison-grid-header {
    background: var(--surface-sunken);
    border-bottom: 1px solid var(--outline);
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--ink-muted);
}

.comparison-feature-row {
    border-bottom: 1px solid var(--outline);
}

.comparison-feature-row:last-child {
    border-bottom: none;
}

.comparison-grid-feature-label {
    text-align: start;
}

.comparison-grid-plan {
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.comparison-feature-input {
    width: 100%;
    border: 1px solid var(--outline);
    border-radius: var(--radius-sm);
    padding: 0.25rem 0.4rem;
    font-size: 0.75rem;
}

.comparison-cell-toggle {
    width: 2rem;
    height: 2rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--outline);
    font-size: 0.875rem;
    font-weight: 700;
    cursor: pointer;
    justify-self: center;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.comparison-cell-toggle.is-yes {
    background: #ecfdf5;
    border-color: #6ee7b7;
    color: var(--leaf-deep, #047857);
}

.comparison-cell-toggle.is-no {
    background: var(--surface-sunken);
    color: var(--ink-faint);
}

.comparison-cell-toggle:hover {
    border-color: var(--sky-mid, #38bdf8);
}

.comparison-feature-remove {
    justify-self: center;
}


/* ==========================================================================
   Workflow Builder
   ========================================================================== */

.workflow-node {
    position: absolute;
    min-width: 150px;
    padding: 0.85rem 2.5rem 0.85rem 1rem;
    border-radius: var(--radius-btn);
    border: 2px solid var(--outline-strong);
    background: var(--background);
    cursor: move;
    user-select: none;
    font-size: 0.875rem;
    z-index: 10;
    transition: box-shadow var(--transition-base), border-color var(--transition-base), transform var(--transition-base);
}

.workflow-node.selected {
    border-color: var(--brand-color);
    box-shadow: 0 0 0 3px var(--brand-ring);
}

.workflow-node.linking-source {
    border-color: var(--sky);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--sky) 30%, transparent);
}

.workflow-node.link-target {
    border-color: var(--leaf);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--leaf) 25%, transparent);
    cursor: pointer;
    animation: pulse-target 1s ease infinite;
}

.workflow-node.link-ready {
    cursor: pointer;
}

.workflow-node.link-ready:hover {
    border-color: var(--sky);
    transform: scale(1.03);
}

@keyframes pulse-target {
    0%, 100% {
        box-shadow: 0 0 0 4px color-mix(in srgb, var(--leaf) 25%, transparent);
    }
    50% {
        box-shadow: 0 0 0 8px color-mix(in srgb, var(--leaf) 15%, transparent);
    }
}

.workflow-node[data-type="start"] {
    border-color: var(--leaf);
    background: var(--leaf-soft);
}

.workflow-node[data-type="end"] {
    border-color: var(--coral);
    background: var(--coral-soft);
}

.workflow-node[data-type="human_task"] {
    border-color: var(--sky);
}

.workflow-node[data-type="condition"] {
    border-color: var(--sun);
}

.workflow-node[data-type="form_data"] {
    border-color: #8b5cf6;
    background: color-mix(in srgb, #8b5cf6 8%, var(--background));
}

.node-add-btn {
    position: absolute;
    right: -14px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border-radius: var(--radius-pill);
    background: var(--brand-color);
    color: var(--text-on-brand);
    border: 2px solid var(--background);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
    transition: background var(--transition-base), transform var(--transition-base);
}

.node-add-btn:hover {
    background: var(--brand-hover);
    transform: translateY(-50%) scale(1.1);
}

[dir="rtl"] .node-add-btn {
    right: auto;
    left: -14px;
}

.wf-mode-btn {
    padding: 0.4rem 0.85rem;
    border-radius: var(--radius-input);
    border: 1px solid var(--outline-strong);
    background: var(--background);
    color: var(--ink-muted);
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
    transition: background var(--transition-base), border-color var(--transition-base), color var(--transition-base);
}

.wf-mode-btn.active {
    background: var(--brand-color);
    color: var(--text-on-brand);
    border-color: var(--brand-color);
}

.wf-mode-btn:hover:not(.active) {
    background: var(--brand-soft);
}

#workflow-canvas.connect-mode .workflow-node {
    cursor: pointer;
}

.quick-add-menu {
    position: fixed;
    z-index: 100;
    background: var(--background);
    border: 1px solid var(--outline);
    border-radius: var(--radius-btn);
    padding: 0.75rem;
    box-shadow: var(--shadow-lg);
    min-width: 160px;
}

.quick-add-menu button {
    display: block;
    width: 100%;
    text-align: inherit;
    padding: 0.5rem 0.75rem;
    border: none;
    border-radius: var(--radius-input);
    background: none;
    font-family: inherit;
    font-size: 0.875rem;
    cursor: pointer;
}

.quick-add-menu button:hover {
    background: var(--brand-soft);
}

.edge-label {
    font-size: 11px;
    fill: var(--ink-muted);
    font-family: var(--font-sans);
}


/* ==========================================================================
   WCAG 2.1 AA contrast — legacy Tailwind utilities & edge cases
   Normal text ≥ 4.5:1 · Large/bold ≥ 3:1 · UI components ≥ 3:1
   ========================================================================== */

/* Tailwind gray-400 (#9ca3af) fails AA on white — remap to ink-subtle */
body.t-app .text-gray-400,
.t-login-page .text-gray-400,
.t-share-page .text-gray-400 {
    color: var(--ink-subtle) !important;
}

/* Tailwind gray-500 on small labels — bump to ink-muted */
body.t-app .text-gray-500,
.t-login-page .text-gray-500,
.t-share-page .text-gray-500 {
    color: var(--ink-muted) !important;
}

/* Close / icon-only controls */
button.text-gray-400,
[data-modal-close] {
    color: var(--ink-subtle) !important;
}

button.text-gray-400:hover,
[data-modal-close]:hover {
    color: var(--ink-muted) !important;
}

/* Modal & builder inactive tabs */
[data-tab-group] button.border-transparent.text-gray-500 {
    color: var(--ink-muted) !important;
}

/* Form builder palette section labels (uppercase xs) */
#field-palette .text-gray-400 {
    color: var(--ink-muted) !important;
    letter-spacing: 0.05em;
}

#form-canvas .text-gray-400,
#field-props .text-gray-400 {
    color: var(--ink-muted) !important;
}

/* Stat & accent colors on white cards — use darker shades */
.text-green-600 { color: var(--leaf-deep) !important; }
.text-blue-600 { color: var(--sky-deep) !important; }
.text-red-600 { color: #B91C1C !important; }
.text-amber-600 { color: var(--sun-deep) !important; }
.text-purple-600 { color: #7E22CE !important; }
.text-purple-700 { color: #6D28D9 !important; }
.text-amber-700 { color: var(--sun-deep) !important; }
.text-blue-700 { color: var(--sky-deep) !important; }

/* Public form rendered summary labels */
.form-field + dl dt.text-gray-500,
dl .text-gray-500 {
    color: var(--ink-muted) !important;
}

/* Focus visibility — 3:1 against adjacent colors */
:focus-visible {
    outline: 2px solid var(--brand-color);
    outline-offset: 2px;
}

.t-btn:focus-visible,
.t-nav-link:focus-visible,
.t-filter-pill:focus-visible,
.t-cat-tabs__tab:focus-visible,
.t-cat-sidebar__item:focus-visible {
    outline: 2px solid var(--brand-color);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px var(--brand-soft);
}

.t-nav-ghost:focus-visible {
    outline: 2px solid var(--brand-color);
    outline-offset: 2px;
}

body.t-app .t-btn-primary:focus-visible,
body.t-app .t-share-submit:focus-visible {
    outline-color: var(--brand-color);
    box-shadow: 0 0 0 4px var(--brand-ring);
}


/* ==========================================================================
   Accessibility — prefers-contrast & reduced-motion
   ========================================================================== */

@media (prefers-contrast: more) {
    :root {
        --ink-muted: #334155;
        --ink-subtle: #475569;
        --text-placeholder: #475569;
        --outline-strong: #64748B;
    }

    .t-nav-link,
    .t-nav-ghost,
    .t-user-chip {
        font-weight: 700;
    }

    .t-card,
    body.t-app main .bg-white.rounded-xl.shadow {
        border-color: var(--outline-strong) !important;
        border-width: 2px;
    }

    .t-btn:disabled,
    .t-btn[disabled],
    .t-btn-primary:disabled,
    .t-btn-primary[disabled] {
        border-width: 2px;
        color: var(--ink);
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .t-btn:active,
    .t-grid-card:hover,
    .t-action-tile:hover,
    .palette-field-btn:active,
    .workflow-node.link-ready:hover,
    .node-add-btn:hover {
        transform: none;
    }
}

@media (forced-colors: active) {
    .t-btn-primary,
    .t-share-submit,
    .t-nav {
        forced-color-adjust: none;
    }
}

/* ==========================================================================
   Help & FAQ
   ========================================================================== */

.t-help-hint {
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: var(--surface-sunken);
    border: 1px solid var(--outline);
    border-radius: var(--radius-card);
    color: var(--ink-muted);
    font-size: 0.875rem;
}

.t-help-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.t-help-tab {
    padding: 0.5rem 1rem;
    border: 1px solid var(--outline);
    border-radius: 9999px;
    background: var(--background);
    color: var(--ink-muted);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background var(--transition-base), color var(--transition-base), border-color var(--transition-base);
}

.t-help-tab:hover {
    border-color: var(--sky);
    color: var(--sky);
}

.t-help-tab.is-active {
    background: var(--sky);
    border-color: var(--sky);
    color: #fff;
}

.t-help-panel {
    display: none;
}

.t-help-panel.is-active {
    display: block;
}

.t-help-role-desc {
    margin-bottom: 1.5rem;
    color: var(--ink-muted);
    font-size: 0.9375rem;
}

.t-help-layout {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.t-help-block-wide {
    width: 100%;
}

.t-help-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.75rem;
    height: 1.75rem;
    padding: 0 0.5rem;
    border-radius: var(--radius-pill);
    background: var(--sky-soft);
    color: var(--sky-deep);
    font-size: 0.75rem;
    font-weight: 700;
}

.t-help-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 1024px) {
    .t-help-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.t-help-block .t-card-body {
    padding: 0;
}

.t-help-faq {
    display: flex;
    flex-direction: column;
}

.t-help-faq-item {
    border-bottom: 1px solid var(--outline);
}

.t-help-faq-item:last-child {
    border-bottom: none;
}

.t-help-faq-item summary {
    padding: 1rem 1.25rem;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
    color: var(--ink);
}

.t-help-faq-item summary::-webkit-details-marker {
    display: none;
}

.t-help-faq-item summary::after {
    content: "+";
    float: inline-end;
    font-weight: 700;
    color: var(--sky);
}

.t-help-faq-item[open] summary::after {
    content: "−";
}

.t-help-faq-item p {
    margin: 0;
    padding: 0 1.25rem 1rem;
    color: var(--ink-muted);
    font-size: 0.9375rem;
    line-height: 1.6;
}

.t-help-howto {
    padding: 0;
}

.t-help-guide {
    border-bottom: 1px solid var(--outline);
}

.t-help-guide:last-child {
    border-bottom: none;
}

.t-help-guide-title {
    padding: 1rem 1.25rem;
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    color: var(--ink);
    cursor: pointer;
    list-style: none;
}

.t-help-guide-title::-webkit-details-marker {
    display: none;
}

.t-help-guide-title::after {
    content: "+";
    float: inline-end;
    font-weight: 700;
    color: var(--sky);
}

.t-help-guide[open] .t-help-guide-title::after {
    content: "−";
}

.t-help-guide-body {
    padding: 0 1.25rem 1.25rem;
}

.t-help-guide-intro {
    margin: 0 0 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--surface-sunken);
    border-radius: var(--radius-card);
    border-inline-start: 3px solid var(--sky);
    color: var(--ink-muted);
    font-size: 0.9375rem;
    line-height: 1.6;
}

.t-help-guide article,
.t-help-guide:not(details) {
    margin-bottom: 1.5rem;
}

.t-help-guide:not(details) .t-help-guide-title {
    margin: 0 0 0.5rem;
    padding: 0;
    cursor: default;
}

.t-help-guide:not(details) .t-help-guide-title::after {
    display: none;
}

.t-help-steps {
    margin: 0;
    padding-inline-start: 1.25rem;
    color: var(--ink-muted);
    font-size: 0.9375rem;
    line-height: 1.7;
}

.t-help-step-text {
    margin-bottom: 0.5rem;
}

.t-help-step-ui {
    margin-top: 0.75rem;
    margin-bottom: 0.25rem;
}

.t-help-steps li {
    margin-bottom: 1.25rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px dashed var(--outline);
}

.t-help-steps li:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

/* UI mockup snippets in help steps */
.t-ui-snippet {
    margin-top: 0.5rem;
    border: 1px solid var(--outline);
    border-radius: var(--radius-card);
    background: var(--surface-sunken);
    overflow: hidden;
}

.t-ui-snippet-label {
    padding: 0.35rem 0.75rem;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ink-muted);
    background: color-mix(in srgb, var(--sky) 8%, var(--background));
    border-bottom: 1px solid var(--outline);
}

.t-ui-snippet-body {
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.t-ui-path {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8125rem;
}

.t-ui-path-seg {
    color: var(--ink-muted);
}

.t-ui-path-seg.is-current {
    color: var(--sky-deep);
    font-weight: 700;
}

.t-ui-path-sep {
    color: var(--ink-muted);
    opacity: 0.6;
}

.t-ui-nav,
.t-ui-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.t-ui-nav-item,
.t-ui-tab {
    padding: 0.25rem 0.65rem;
    border-radius: var(--radius-pill);
    border: 1px solid var(--outline);
    background: var(--background);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--ink-muted);
}

.t-ui-nav-item.is-active,
.t-ui-tab.is-active {
    background: var(--sky-soft);
    border-color: var(--sky);
    color: var(--sky-deep);
}

.t-ui-url {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.65rem;
    border-radius: var(--radius-btn);
    border: 1px solid var(--outline);
    background: var(--background);
    font-size: 0.75rem;
}

.t-ui-url code {
    font-family: var(--font-mono);
    color: var(--ink);
}

.t-ui-page-title {
    margin: 0;
    font-family: var(--font-display);
    font-size: 1.125rem;
    font-weight: 800;
    color: var(--ink);
}

.t-ui-page-sub {
    margin: 0.25rem 0 0;
    font-size: 0.8125rem;
    color: var(--ink-muted);
}

.t-ui-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.t-ui-btn {
    padding: 0.35rem 0.85rem;
    border-radius: var(--radius-btn);
    border: 1px solid var(--outline);
    background: var(--background);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--ink);
}

.t-ui-btn.is-primary {
    background: var(--sky);
    border-color: var(--sky);
    color: #fff;
}

.t-ui-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.t-ui-field {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.t-ui-field-label {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--ink-muted);
}

.t-ui-req {
    color: #dc2626;
}

.t-ui-input {
    padding: 0.4rem 0.6rem;
    border-radius: var(--radius-btn);
    border: 1px solid var(--outline);
    background: #fff;
    font-size: 0.8125rem;
    color: var(--ink);
}

.t-ui-input.is-password {
    letter-spacing: 0.15em;
}

.t-ui-select {
    padding: 0.4rem 0.6rem;
    border-radius: var(--radius-btn);
    border: 1px solid var(--outline);
    background: #fff;
    font-size: 0.8125rem;
}

.t-ui-opt.is-selected {
    font-weight: 700;
    color: var(--sky-deep);
}

.t-ui-check {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
}

.t-ui-check-box {
    width: 1.1rem;
    height: 1.1rem;
    border-radius: 0.25rem;
    border: 1px solid var(--outline);
    background: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    color: transparent;
}

.t-ui-check.is-on .t-ui-check-box {
    background: var(--sky);
    border-color: var(--sky);
    color: #fff;
}

.t-ui-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
}

.t-ui-table th,
.t-ui-table td {
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--outline);
    text-align: start;
}

.t-ui-table th {
    background: var(--background);
    font-weight: 700;
}

.t-ui-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr));
    gap: 0.5rem;
}

.t-ui-stat {
    padding: 0.5rem 0.65rem;
    border-radius: var(--radius-card);
    border: 1px solid var(--outline);
    background: var(--background);
    border-inline-end: 3px solid var(--sky);
}

.t-ui-stat-label {
    display: block;
    font-size: 0.6875rem;
    color: var(--ink-muted);
}

.t-ui-stat-value {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--ink);
}

.t-ui-term {
    margin: 0;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius-btn);
    background: #1e293b;
    color: #e2e8f0;
    font-size: 0.75rem;
    overflow-x: auto;
}

.t-ui-term code {
    font-family: var(--font-mono);
}

.t-ui-menu {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    max-width: 14rem;
}

.t-ui-menu-item {
    padding: 0.35rem 0.65rem;
    border-radius: var(--radius-btn);
    font-size: 0.8125rem;
    color: var(--ink-muted);
}

.t-ui-menu-item.is-active {
    background: var(--sky-soft);
    color: var(--sky-deep);
}

/* Task inbox & decision */
.t-table-inbox .t-task-group + .t-task-group tr:first-child td {
    border-top: 1px solid var(--outline);
}

.t-task-inbox-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    justify-content: flex-end;
}

.t-task-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    justify-content: flex-end;
    position: relative;
}

.t-task-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.65rem;
    height: 1.65rem;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--ink-muted);
    font-size: 0.8rem;
    line-height: 1;
    cursor: pointer;
    position: relative;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.t-task-action-btn:hover {
    background: var(--surface-sunken);
    color: var(--ink);
    border-color: var(--outline);
}

.t-task-action-btn:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 1px;
}

.t-task-action-btn[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    padding: 0.2rem 0.45rem;
    background: var(--ink);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 500;
    line-height: 1.3;
    white-space: nowrap;
    border-radius: var(--radius-sm);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.12s;
    z-index: 20;
}

.t-task-action-btn[data-tooltip]:hover::after,
.t-task-action-btn[data-tooltip]:focus-visible::after {
    opacity: 1;
}

.t-task-action-review {
    color: var(--ink-muted);
}

.t-task-action-approve {
    color: #15803d;
    border-color: #bbf7d0;
    background: #f0fdf4;
}

.t-task-action-approve:hover {
    background: #dcfce7;
    color: #166534;
    border-color: #86efac;
}

.t-task-action-reject {
    color: #b91c1c;
    border-color: #fecaca;
    background: #fef2f2;
}

.t-task-action-reject:hover {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fca5a5;
}

.t-task-action-forward {
    color: #1d4ed8;
    border-color: #bfdbfe;
    background: #eff6ff;
}

.t-task-action-forward:hover {
    background: #dbeafe;
    color: #1e40af;
    border-color: #93c5fd;
}

.t-task-action-revert {
    color: #b45309;
    border-color: #fde68a;
    background: #fffbeb;
}

.t-task-action-revert:hover {
    background: #fef3c7;
    color: #92400e;
    border-color: #fcd34d;
}

.t-task-forward-wrap {
    position: relative;
    display: inline-flex;
}

.t-task-forward-pop {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.35rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    min-width: 10rem;
}

.t-task-forward-pop .t-input {
    flex: 1;
    min-width: 0;
}

.t-task-quick-decide {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.t-task-quick-decide .t-input {
    width: auto;
    min-width: 6.5rem;
    max-width: 9rem;
}

.t-table-inbox td:last-child,
.t-table-inbox th:last-child {
    white-space: nowrap;
}

.t-task-panel-row td {
    padding: 0 !important;
    background: var(--surface-sunken);
}

.t-task-panel-slot {
    padding: 0.75rem 1rem;
}

.t-task-panel {
    display: grid;
    gap: 1rem;
}

.t-task-panel-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--surface-sunken);
    border-radius: var(--radius-md);
}

.t-task-panel-meta-item {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.t-task-panel-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--ink-muted);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.t-task-panel-value {
    font-size: 0.875rem;
    color: var(--ink);
}

.t-task-panel-data {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.75rem;
}

.t-task-panel-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--ink-muted);
    margin: 0 0 0.35rem;
}

.t-readonly-form-compact {
    font-size: 0.8125rem;
}

.t-readonly-form-compact .t-field,
.t-readonly-form-compact .form-group,
.t-readonly-form-compact label {
    margin-bottom: 0.35rem;
}

.t-task-decision {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.t-task-decision-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    align-items: end;
}

.t-task-decision-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.t-task-decision-form,
.t-task-decision-forward,
.t-task-decision-revert {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.t-task-decision-comment {
    grid-column: span 1;
}

.t-task-decision-actions {
    display: inline-flex;
    gap: 0.5rem;
    grid-column: 1 / -1;
}

.t-task-decision-extra-body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
}

.t-task-decision-forward,
.t-task-decision-revert {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
}

.t-task-decision-extra {
    font-size: 0.8125rem;
}

.t-task-decision-extra-toggle {
    cursor: pointer;
    color: var(--ink-muted);
    user-select: none;
}

.t-task-decision-extra-toggle:hover {
    color: var(--ink);
}

.t-input-sm {
    padding: 0.3rem 0.5rem;
    font-size: 0.8125rem;
    min-height: 1.75rem;
}

.t-btn-danger {
    background: var(--color-danger);
    color: #fff;
    border-color: var(--color-danger);
}

.t-btn.t-btn-danger {
    background: var(--color-danger);
    color: #fff;
    border-color: var(--color-danger);
}

.t-btn-danger:hover:not(:disabled):not([disabled]),
.t-btn.t-btn-danger:hover:not(:disabled):not([disabled]) {
    background: color-mix(in srgb, var(--color-danger) 85%, #000);
    border-color: color-mix(in srgb, var(--color-danger) 85%, #000);
    color: #fff;
}

.t-btn-warning {
    background: var(--color-warning);
    color: #fff;
    border-color: var(--color-warning);
}

.t-btn-warning:hover:not(:disabled):not([disabled]) {
    background: color-mix(in srgb, var(--color-warning) 85%, #000);
}

.t-ui-card {
    border: 1px solid var(--outline);
    border-radius: var(--radius-card);
    background: var(--background);
    overflow: hidden;
}

.t-ui-card-head {
    padding: 0.5rem 0.75rem;
    font-weight: 700;
    font-size: 0.8125rem;
    border-bottom: 1px solid var(--outline);
}

.t-ui-card-body {
    margin: 0;
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    color: var(--ink-muted);
}

.t-ui-task {
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--outline);
    border-radius: var(--radius-card);
    background: var(--background);
}

.t-ui-task-title {
    font-weight: 700;
    font-size: 0.875rem;
}

.t-ui-task-meta {
    font-size: 0.75rem;
    color: var(--ink-muted);
    margin-top: 0.15rem;
}

.t-help-steps li {
    margin-bottom: 0.35rem;
}

.t-help-steps li::marker {
    color: var(--sky);
    font-weight: 700;
}

/* Admin settings hub & sub-nav */
.t-admin-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-bottom: 1.25rem;
    padding: 0.25rem;
    background: var(--surface-sunken);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.t-admin-nav-link {
    display: inline-flex;
    align-items: center;
    padding: 0.45rem 0.85rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--ink-muted);
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: background 0.12s, color 0.12s;
}

.t-admin-nav-link:hover {
    color: var(--ink);
    background: var(--surface);
}

.t-admin-nav-link.is-active {
    color: var(--ink);
    background: var(--surface);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
    font-weight: 600;
}

.t-admin-hub {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
    gap: 1rem;
}

.t-admin-hub-card {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.t-admin-hub-card:hover {
    border-color: var(--sky);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.t-admin-hub-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: var(--radius-md);
    background: var(--surface-sunken);
    color: var(--sky);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.t-admin-hub-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--ink);
}

.t-admin-hub-desc {
    font-size: 0.8125rem;
    color: var(--ink-muted);
    line-height: 1.4;
}

/* Form chatbot widget */
.form-chatbot {
    border: 1px solid var(--outline-strong);
    border-radius: var(--radius-card);
    background: var(--background);
    overflow: hidden;
}

.form-chatbot-disabled {
    min-height: 4rem;
}

.chatbot-header {
    display: flex;
    justify-content: flex-end;
    padding: 0.375rem 0.75rem;
    border-bottom: 1px solid var(--outline-strong);
    background: var(--background);
}

.chatbot-reset {
    padding: 0.25rem 0.5rem;
    border: none;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--ink-muted);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
}

.chatbot-reset:hover {
    color: var(--sky);
    background: var(--surface-sunken);
}

.chatbot-reset:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chatbot-messages {
    max-height: 16rem;
    overflow-y: auto;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    background: var(--surface-sunken);
}

.chatbot-msg {
    max-width: 85%;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
}

.chatbot-msg-user {
    align-self: flex-end;
    background: var(--sky);
    color: #fff;
}

.chatbot-msg-bot {
    align-self: flex-start;
    background: var(--background);
    border: 1px solid var(--outline-strong);
    color: var(--ink);
}

.chatbot-msg-bot.thinking {
    opacity: 0.7;
    font-style: italic;
}

.chatbot-msg-bot.error {
    border-color: #fca5a5;
    background: #fef2f2;
    color: #b91c1c;
}

.chatbot-input-row {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem;
    border-top: 1px solid var(--outline-strong);
}

.chatbot-input {
    flex: 1;
    min-width: 0;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--outline-strong);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
}

.chatbot-send {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--radius-md);
    background: var(--sky);
    color: #fff;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
}

.chatbot-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.chatbot-source-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    min-height: 1.5rem;
}

.chatbot-source-chip {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    font-size: 0.6875rem;
    background: var(--sky-soft);
    color: var(--sky-deep);
    border-radius: var(--radius-pill);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chatbot-modal-section-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ink-muted);
    margin-bottom: 0.5rem;
}

.chatbot-modal-list {
    border: 1px solid var(--outline-strong);
    border-radius: var(--radius-md);
    max-height: 10rem;
    overflow-y: auto;
}

.chatbot-modal-row {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--outline);
    cursor: pointer;
}

.chatbot-modal-row:last-child {
    border-bottom: none;
}

.chatbot-modal-row:hover:not(.opacity-50) {
    background: var(--surface-sunken);
}

.chatbot-modal-row input {
    margin-top: 0.2rem;
    flex-shrink: 0;
}

/* Formula builder tab (calculated field) */
.formula-tab-panel .formula-editor-bar {
    min-height: 0;
}

.formula-tab-panel .formula-editor-textarea {
    min-height: 8rem;
    max-height: 14rem;
}

.formula-tab-panel .formula-palette {
    max-height: 22vh;
}

.chatbot-sources-panel .chatbot-modal-list {
    max-height: none;
}

/* Formula builder modal (Power BI–style calculated field) */
.formula-modal {
    min-height: min(88vh, 52rem);
}

.formula-modal .formula-palette {
    max-height: min(42vh, 24rem);
}

.formula-modal .formula-palette-content {
    max-height: min(38vh, 22rem);
    overflow-y: auto;
    border: 1px solid var(--outline);
    border-radius: var(--radius-md);
    background: var(--surface);
}

.formula-palette-subtabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.formula-palette-subtab {
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 0.3rem 0.65rem;
    border: 1px solid var(--outline);
    border-radius: 9999px;
    background: var(--surface);
    color: var(--ink-muted);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.formula-palette-subtab:hover {
    background: var(--sky-soft);
    border-color: var(--sky-mid);
    color: var(--sky-deep);
}

.formula-palette-subtab.is-active {
    background: var(--sky-soft);
    border-color: var(--sky-mid);
    color: var(--sky-deep);
}

.formula-modal .formula-editor-bar {
    min-height: 0;
}

.formula-modal .formula-editor-textarea {
    min-height: 12rem;
}

.calculated-value-panel .formula-preview-expr {
    word-break: break-all;
}

.formula-editor-bar {
    min-height: min(46vh, 22rem);
}

.formula-editor-textarea {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    background: var(--surface-sunken);
    border-color: var(--outline-strong);
    resize: vertical;
    min-height: 16rem;
    line-height: 1.5;
}

.formula-editor-textarea:focus {
    outline: 2px solid var(--sky-mid);
    outline-offset: 1px;
    border-color: var(--sky-mid);
}

.formula-op-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.formula-op-btn {
    min-width: 2rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-family: ui-monospace, monospace;
    border: 1px solid var(--outline-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--ink);
    cursor: pointer;
}

.formula-op-btn:hover {
    background: var(--sky-soft);
    border-color: var(--sky-mid);
    color: var(--sky-deep);
}

.formula-palette-section {
    min-height: 0;
}

.formula-cat-label {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--ink-muted);
    margin: 0.5rem 0 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.formula-palette-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.125rem;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: none;
    border-bottom: 1px solid var(--outline);
    background: transparent;
    text-align: start;
    cursor: pointer;
}

.formula-palette-item:last-child {
    border-bottom: none;
}

.formula-palette-item:hover {
    background: var(--surface-sunken);
}

.formula-field-name {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--ink);
}

.formula-field-id {
    font-size: 0.6875rem;
    color: var(--sky-deep);
    background: var(--sky-soft);
    padding: 0.0625rem 0.375rem;
    border-radius: var(--radius-sm);
}

.formula-fn-sig {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--sky-deep);
}

.formula-fn-desc,
.formula-tpl-label {
    font-size: 0.6875rem;
    color: var(--ink-muted);
    line-height: 1.3;
}

.formula-tpl-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--ink);
}

.formula-preview-box {
    padding: 0.75rem 0.875rem;
    background: var(--surface-sunken);
    border: 1px solid var(--outline);
    border-radius: var(--radius-md);
    min-height: 8rem;
    max-height: 14rem;
    overflow-y: auto;
}

.formula-preview-expr {
    display: block;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.8125rem;
    line-height: 1.55;
    color: var(--ink);
    white-space: pre-wrap;
    word-break: break-word;
}

.formula-field-lookup.is-expanded {
    background: var(--sky-soft);
}

.formula-lookup-tag {
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--sky-deep);
    background: var(--sky-soft);
    padding: 0.0625rem 0.375rem;
    border-radius: var(--radius-sm);
    margin-inline-start: 0.25rem;
}

.formula-lookup-panel {
    padding: 0.5rem 0.75rem 0.75rem;
    margin: 0 0 0.25rem;
    background: var(--surface-sunken);
    border-inline-start: 3px solid var(--sky-mid);
}

.formula-lookup-label {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--ink-muted);
    margin: 0.5rem 0 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.formula-lookup-actions {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.formula-lookup-action {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.125rem;
    width: 100%;
    padding: 0.375rem 0.5rem;
    border: 1px solid var(--outline);
    border-radius: var(--radius-sm);
    background: var(--surface);
    text-align: start;
    cursor: pointer;
    font-size: 0.75rem;
}

.formula-lookup-action:hover {
    border-color: var(--sky-mid);
    background: var(--sky-soft);
}

.formula-lookup-action code {
    font-size: 0.6875rem;
    color: var(--sky-deep);
}

.formula-lookup-value-row {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    margin-bottom: 0.375rem;
}

.formula-lookup-value-col {
    font-size: 0.6875rem;
    color: var(--ink-muted);
}

.formula-lookup-value-select {
    width: 100%;
    border: 1px solid var(--outline);
    border-radius: var(--radius-sm);
    padding: 0.25rem 0.375rem;
    font-size: 0.75rem;
    background: var(--surface);
}

/* Content variable palette (page builder text fields) */
.content-var-palette {
    max-height: 28vh;
    overflow-y: auto;
}

.content-var-section-label {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ink-muted);
    margin: 0.5rem 0 0.35rem;
}

.content-var-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.content-var-chip {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.1rem;
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--outline);
    border-radius: var(--radius-sm);
    background: var(--surface-muted, #f9fafb);
    font-size: 0.7rem;
    cursor: grab;
    text-align: start;
    max-width: 100%;
}

.content-var-chip:hover {
    border-color: var(--accent, #0ea5e9);
    background: var(--accent-muted, #f0f9ff);
}

.content-var-chip:active {
    cursor: grabbing;
}

.content-var-chip-label {
    font-weight: 600;
    color: var(--ink);
    line-height: 1.2;
}

.content-var-chip-token {
    font-size: 0.65rem;
    color: var(--ink-muted);
}

.content-var-target.content-var-drop-active {
    outline: 2px solid var(--accent, #0ea5e9);
    outline-offset: 1px;
    background: var(--accent-muted, #f0f9ff);
}

.prefill-panel,
.form-action-panel {
    line-height: 1.45;
}

.passed-field-select {
    font-size: 0.75rem;
}

.form-action-steps {
    list-style: decimal;
    padding-inline-start: 1.25rem;
    margin: 0;
}

.form-action-steps li {
    padding-inline-start: 0.15rem;
}

/* Dashboard widgets (form builder dashboard tab) */
.dash-block {
    grid-column: 1 / -1;
}

.dash-widget {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--outline);
    border-radius: var(--radius-card);
    padding: 1rem 1.25rem;
    min-height: 8rem;
}

.dash-widget-header {
    margin-bottom: 0.75rem;
}

.dash-widget-title {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--ink);
    margin: 0;
}

.dash-widget-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.85);
    border-radius: var(--radius-card);
    font-size: 0.875rem;
    color: var(--ink-muted);
}

.dash-widget-loading.hidden {
    display: none;
}

.dash-widget-error {
    margin-top: 0.5rem;
    font-size: 0.8125rem;
    color: #DC2626;
}

.dash-kpi-card {
    text-align: center;
    padding: 0.5rem 0;
}

.dash-kpi-label {
    font-size: 0.8125rem;
    color: var(--ink-muted);
    margin-bottom: 0.25rem;
}

.dash-kpi-value {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 800;
    color: var(--ink);
    line-height: 1.1;
}

.dash-kpi-meta {
    font-size: 0.75rem;
    color: var(--ink-subtle);
    margin-top: 0.25rem;
}

.dash-chart-wrap {
    width: 100%;
    overflow-x: auto;
}

.dash-chart-canvas {
    width: 100%;
    display: block;
}

.dash-table-wrap {
    overflow-x: auto;
}

.dash-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.dash-table th,
.dash-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--outline);
    text-align: start;
}

.dash-table th {
    font-weight: 600;
    color: var(--ink-muted);
    background: var(--surface-sunken);
}

.dash-table-empty {
    text-align: center;
    color: var(--ink-subtle);
    padding: 1.5rem !important;
}

.dash-heading-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--ink);
    margin: 0.5rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--brand-color);
}

.dash-filter {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--surface-sunken);
    border-radius: var(--radius-card);
    margin-bottom: 0.5rem;
}

.dash-filter-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--ink-muted);
}

.dash-filter-control {
    border: 1px solid var(--outline);
    border-radius: var(--radius-btn);
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    background: var(--surface);
}

.dash-gauge-wrap {
    position: relative;
    text-align: center;
}

.dash-gauge-canvas {
    width: 100%;
    display: block;
    max-width: 280px;
    margin: 0 auto;
}

.dash-gauge-value {
    font-size: 0.8125rem;
    color: var(--ink-muted);
    margin: 0.25rem 0 0;
}

.dash-progress-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.dash-progress-item {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.dash-progress-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
    font-size: 0.8125rem;
}

.dash-progress-label {
    color: var(--ink);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dash-progress-value {
    color: var(--ink-muted);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.dash-progress-track {
    height: 0.5rem;
    background: var(--surface-sunken);
    border-radius: 999px;
    overflow: hidden;
}

.dash-progress-bar {
    height: 100%;
    border-radius: 999px;
    transition: width 0.3s ease;
}

.dash-progress-empty {
    text-align: center;
    color: var(--ink-subtle);
    font-size: 0.875rem;
    padding: 1rem 0;
}

.dash-kanban-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.dash-kanban-hint {
    margin: 0.2rem 0 0;
    font-size: 0.75rem;
    color: var(--ink-subtle);
}

.dash-kanban-board {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(15rem, 1fr);
    gap: 0.875rem;
    overflow-x: auto;
    padding-bottom: 0.25rem;
}

.dash-kanban-column {
    background: var(--surface-sunken);
    border: 1px solid var(--outline);
    border-radius: var(--radius-card);
    min-height: 10rem;
    display: flex;
    flex-direction: column;
}

.dash-kanban-column-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.75rem 0.875rem;
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--ink);
    border-bottom: 1px solid var(--outline);
}

.dash-kanban-count {
    min-width: 1.5rem;
    padding: 0.1rem 0.4rem;
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink-muted);
    text-align: center;
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
}

.dash-kanban-dropzone {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    padding: 0.75rem;
    border-radius: 0 0 var(--radius-card) var(--radius-card);
    transition: background 0.15s ease, outline-color 0.15s ease;
}

.dash-kanban-dropzone.is-over {
    background: rgba(59, 130, 246, 0.08);
    outline: 2px dashed var(--brand-color);
    outline-offset: -0.35rem;
}

.dash-kanban-card {
    background: var(--surface);
    border: 1px solid var(--outline);
    border-radius: 0.875rem;
    padding: 0.75rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
    cursor: grab;
}

.dash-kanban-card[draggable="false"] {
    cursor: default;
}

.dash-kanban-card.is-dragging {
    opacity: 0.55;
}

.dash-kanban-card.is-saving {
    opacity: 0.7;
    pointer-events: none;
}

.dash-kanban-card-title {
    font-weight: 700;
    color: var(--ink);
    font-size: 0.875rem;
    line-height: 1.35;
}

.dash-kanban-card-meta {
    color: var(--ink-subtle);
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

.dash-kanban-card-fields {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--outline);
}

.dash-kanban-card-field {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.75rem;
}

.dash-kanban-card-field span {
    color: var(--ink-subtle);
}

.dash-kanban-card-field strong {
    color: var(--ink-muted);
    font-weight: 600;
    text-align: end;
}

.dash-kanban-empty {
    margin: auto 0;
    text-align: center;
    color: var(--ink-subtle);
    font-size: 0.8125rem;
    padding: 1rem 0.25rem;
}

.dash-info {
    background: var(--surface-sunken);
    border: 1px solid var(--outline);
    border-radius: var(--radius-card);
    padding: 0.875rem 1rem;
    border-inline-start: 3px solid var(--brand-color);
}

.dash-info-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--ink);
    margin: 0 0 0.35rem;
}

.dash-info-body {
    font-size: 0.8125rem;
    color: var(--ink-muted);
    margin: 0;
    line-height: 1.5;
}

.dash-divider-line {
    border: none;
    border-top: 1px solid var(--outline);
    margin: 0.75rem 0;
}

.dash-props {
    background: #ecfdf5;
    border-radius: 0.5rem;
    padding: 0.75rem;
}

/* Element design system (form builder) */
.props-tab {
    color: var(--ink-muted, #64748b);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.props-tab:hover {
    color: var(--ink, #0f172a);
}

.props-tab-bar .props-tab.active {
    background: var(--brand-soft, #eff6ff);
    color: var(--brand-color, #3b82f6);
}

.design-preset-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.design-chip {
    padding: 0.25rem 0.625rem;
    font-size: 0.6875rem;
    font-weight: 600;
    border: 1px solid var(--outline, #e2e8f0);
    border-radius: 999px;
    background: var(--surface, #fff);
    color: var(--ink-muted, #64748b);
    cursor: pointer;
    transition: all 0.15s ease;
}

.design-chip:hover {
    border-color: var(--brand-color, #3b82f6);
    color: var(--brand-color, #3b82f6);
}

.design-chip.active {
    background: var(--brand-color, #3b82f6);
    border-color: var(--brand-color, #3b82f6);
    color: #fff;
}

.design-section-title {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ink-muted, #64748b);
    margin-bottom: 0.5rem;
}

.design-section + .design-section {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--outline, #f1f5f9);
}

.design-range {
    accent-color: var(--brand-color, #3b82f6);
    height: 0.375rem;
}

.design-color-swatch {
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 1px solid var(--outline, #e2e8f0);
    border-radius: 0.375rem;
    cursor: pointer;
    background: none;
}

.elem-align-start { text-align: start; }
.elem-align-center { text-align: center; }
.elem-align-end { text-align: end; }

.elem-text-sm { font-size: 0.875rem; }
.elem-text-base { font-size: 1rem; }
.elem-text-lg { font-size: 1.125rem; }
.elem-text-xl { font-size: 1.25rem; }
.elem-text-2xl { font-size: 1.5rem; }

.elem-weight-normal { font-weight: 400; }
.elem-weight-medium { font-weight: 500; }
.elem-weight-semibold { font-weight: 600; }
.elem-weight-bold { font-weight: 700; }

.elem-radius-none { border-radius: 0; overflow: hidden; }
.elem-radius-sm { border-radius: 0.375rem; overflow: hidden; }
.elem-radius-md { border-radius: 0.5rem; overflow: hidden; }
.elem-radius-lg { border-radius: 0.75rem; overflow: hidden; }
.elem-radius-xl { border-radius: 1rem; overflow: hidden; }
.elem-radius-full { border-radius: 9999px; overflow: hidden; }

.elem-shadow-none { box-shadow: none; }
.elem-shadow-sm { box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06); }
.elem-shadow-md { box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08); }
.elem-shadow-lg { box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12); }

.elem-border-none { border: none; }
.elem-border-subtle { border: 1px solid var(--outline, #e2e8f0); }
.elem-border-strong { border: 2px solid var(--outline-strong, #cbd5e1); }

.elem-max-full { max-width: 100%; margin-inline: auto; }
.elem-max-prose { max-width: 42rem; margin-inline: auto; }
.elem-max-narrow { max-width: 28rem; margin-inline: auto; }

.elem-preset-card > .web-block,
.elem-preset-card {
    background: var(--surface, #fff);
}

.elem-preset-highlight {
    background: var(--brand-soft, #eff6ff);
}

.elem-preset-hero .web-hero,
.elem-preset-hero {
    background: linear-gradient(135deg, var(--brand-soft) 0%, var(--surface-sunken) 100%);
}

.form-page-shell {
    padding: 1rem 0;
}

.form-page-canvas {
    flex: 1;
    width: 100%;
    min-height: calc(100dvh - var(--form-page-chrome, 4.75rem));
    margin-inline: calc(-1 * var(--main-inline-pad, 1rem));
    padding-inline: var(--main-inline-pad, 1rem);
    padding-bottom: 1.5rem;
}

body.t-app:has(main .form-page-canvas) {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
}

body.t-app:has(main .form-page-canvas) main.t-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding-bottom: 0;
}

main.t-main > .form-page-canvas {
    display: flex;
    flex-direction: column;
}

.t-main-wide > .form-page-canvas {
    --main-inline-pad: 0.75rem;
}

@media (min-width: 1024px) {
    .t-main-wide > .form-page-canvas {
        --main-inline-pad: 1.25rem;
    }
}

.form-page-canvas-preview {
    min-height: 60vh;
    margin-inline: 0;
    padding: 1rem;
    border-radius: 0.75rem;
}

.form-page-design {
    margin-inline: auto;
    padding: 1.25rem;
    background: var(--background);
    border-radius: var(--radius-card, 0.75rem);
    box-shadow: var(--shadow-card);
}

.form-page-width-narrow { max-width: 40rem; }
.form-page-width-medium { max-width: 56rem; }
.form-page-width-wide { max-width: 72rem; }
.form-page-width-full { max-width: 100%; }

.form-page-width-full.form-page-design {
    margin-inline: 0;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
}

.form-page-width-full .form-page-shell {
    padding: 0;
}

.form-gap-compact .form-grid-12 { gap: 0.5rem; }
.form-gap-normal .form-grid-12 { gap: 1rem; }
.form-gap-spacious .form-grid-12 { gap: 1.5rem; }

.form-block-spacing-compact .form-field { margin-bottom: 0.5rem !important; }
.form-block-spacing-normal .form-field { margin-bottom: 1rem !important; }
.form-block-spacing-spacious .form-field { margin-bottom: 1.75rem !important; }

.form-align-center .form-grid-12 { text-align: center; }
.form-align-end .form-grid-12 { text-align: end; }

.form-page-design.form-content-radius-none { border-radius: 0; }
.form-page-design.form-content-radius-sm { border-radius: 0.375rem; }
.form-page-design.form-content-radius-md { border-radius: 0.5rem; }
.form-page-design.form-content-radius-lg { border-radius: 0.75rem; }

.form-content-radius-none .form-grid-12 > .form-field { border-radius: 0; }
.form-content-radius-sm .form-grid-12 > .form-field { border-radius: 0.375rem; }
.form-content-radius-md .form-grid-12 > .form-field { border-radius: 0.5rem; }
.form-content-radius-lg .form-grid-12 > .form-field { border-radius: 0.75rem; }

.elem-variant-centered .web-hero { text-align: center; }
.elem-variant-left .web-hero { text-align: start; }
.elem-variant-left .web-hero-subtitle { margin-inline: 0; }
.elem-variant-minimal .web-hero { padding: 1.5rem; background: transparent; }
.elem-variant-cards .web-feature-grid,
.elem-variant-cards .web-pricing-grid { display: grid; }
.elem-variant-list .web-feature-grid { display: flex; flex-direction: column; gap: 0.75rem; }
.elem-variant-list .web-feature-card { display: flex; gap: 1rem; align-items: flex-start; }
.elem-variant-full_bleed .web-image { border-radius: 0; max-height: none; }
.elem-variant-rounded .web-image { border-radius: 1rem; }
.elem-variant-outline .web-btn-primary { background: transparent; color: var(--brand-color); border: 2px solid var(--brand-color); }
.elem-variant-bordered .web-block { border-inline-start: 4px solid var(--brand-color); padding-inline-start: 1.25rem; }
.elem-variant-large .web-block { font-size: 1.25rem; }
.elem-variant-narrow .web-paragraph { max-width: 36rem; margin-inline: auto; }
.elem-variant-lead .web-paragraph p { font-size: 1.25rem; line-height: 1.8; color: var(--ink); }

.elem-variant-horizontal .web-steps-list { grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); }
.elem-variant-vertical .web-step { flex-direction: column; text-align: center; align-items: center; }
.elem-variant-compact .web-team-card { padding: 0.75rem; }
.elem-variant-compact .web-team-photo { width: 3.5rem; height: 3.5rem; }
.elem-variant-minimal .web-team-card { box-shadow: none; background: transparent; }
.elem-variant-scroll .web-logo-grid { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; }
.elem-variant-muted .web-logo-img { opacity: 0.5; }
.elem-variant-accent .web-banner { background: var(--ink); }
.elem-variant-alternating .web-timeline-item:nth-child(even) { padding-inline-start: 1rem; }
.elem-variant-inline .web-newsletter-form { flex-direction: row; }
.elem-variant-overlay .web-content-card { position: relative; }
.elem-variant-overlay .web-card-body { position: absolute; inset-inline: 0; bottom: 0; background: linear-gradient(transparent, rgba(15, 23, 42, 0.85)); color: #fff; }
.elem-variant-overlay .web-card-desc { color: rgba(255, 255, 255, 0.85); }
.elem-variant-striped .web-comparison-table tbody tr:nth-child(even) { background: var(--surface-sunken); }

/* Per-element website & dashboard design */
.elem-cols-2 .web-feature-grid,
.elem-cols-2 .web-pricing-grid,
.elem-cols-2 .web-team-grid,
.elem-cols-2 .web-gallery-grid,
.elem-cols-2 .web-cards-grid,
.elem-cols-2 .web-stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.elem-cols-3 .web-feature-grid,
.elem-cols-3 .web-pricing-grid,
.elem-cols-3 .web-team-grid,
.elem-cols-3 .web-gallery-grid,
.elem-cols-3 .web-cards-grid,
.elem-cols-3 .web-stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.elem-cols-4 .web-feature-grid,
.elem-cols-4 .web-pricing-grid,
.elem-cols-4 .web-team-grid,
.elem-cols-4 .web-gallery-grid,
.elem-cols-4 .web-cards-grid,
.elem-cols-4 .web-stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.elem-gap-compact .web-feature-grid,
.elem-gap-compact .web-pricing-grid,
.elem-gap-compact .web-team-grid,
.elem-gap-compact .web-gallery-grid,
.elem-gap-compact .web-cards-grid,
.elem-gap-compact .web-stats-grid,
.elem-gap-compact .web-steps-list { gap: 0.5rem; }
.elem-gap-normal .web-feature-grid,
.elem-gap-normal .web-pricing-grid,
.elem-gap-normal .web-team-grid,
.elem-gap-normal .web-gallery-grid,
.elem-gap-normal .web-cards-grid,
.elem-gap-normal .web-stats-grid,
.elem-gap-normal .web-steps-list { gap: 1rem; }
.elem-gap-spacious .web-feature-grid,
.elem-gap-spacious .web-pricing-grid,
.elem-gap-spacious .web-team-grid,
.elem-gap-spacious .web-gallery-grid,
.elem-gap-spacious .web-cards-grid,
.elem-gap-spacious .web-stats-grid,
.elem-gap-spacious .web-steps-list { gap: 1.5rem; }

.elem-fit-cover .web-image { object-fit: cover; width: 100%; }
.elem-fit-contain .web-image { object-fit: contain; width: 100%; }
.form-field[style*="--elem-image-height"] .web-image { height: var(--elem-image-height); max-height: var(--elem-image-height); }
.form-field[style*="--elem-min-height"] .web-hero,
.form-field[style*="--elem-min-height"] .web-banner,
.form-field[style*="--elem-min-height"] .web-image-block,
.form-field[style*="--elem-min-height"] .dash-table-wrap { min-height: var(--elem-min-height); }

.elem-variant-underline .dash-heading-title { border-bottom: 2px solid var(--elem-accent, var(--brand-color)); padding-bottom: 0.5rem; }
.elem-variant-minimal .dash-heading-title { font-size: 1rem; font-weight: 600; color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.05em; }

.elem-overlay-light .web-hero,
.elem-overlay-light .web-image-block,
.elem-overlay-light .web-banner { position: relative; }
.elem-overlay-light .web-hero::after,
.elem-overlay-light .web-image-block::after,
.elem-overlay-light .web-banner::after {
    content: ''; position: absolute; inset: 0; background: rgba(255,255,255,0.35); pointer-events: none; border-radius: inherit;
}
.elem-overlay-dark .web-hero::after,
.elem-overlay-dark .web-image-block::after,
.elem-overlay-dark .web-banner::after {
    content: ''; position: absolute; inset: 0; background: rgba(15,23,42,0.45); pointer-events: none; border-radius: inherit;
}

.elem-btn-filled .web-btn-primary { background: var(--elem-accent, var(--brand-color)); border-color: var(--elem-accent, var(--brand-color)); color: #fff; }
body.t-app .elem-btn-filled a.web-btn-primary,
body.t-app .elem-btn-filled a.web-btn-primary:hover { color: #fff; }
.elem-btn-outline .web-btn-primary { background: transparent; color: var(--elem-accent, var(--brand-color)); border: 2px solid var(--elem-accent, var(--brand-color)); }
body.t-app .elem-btn-outline a.web-btn-primary,
body.t-app .elem-btn-outline a.web-btn-primary:hover { color: var(--elem-accent, var(--brand-color)); }
.elem-btn-ghost .web-btn-primary { background: transparent; color: var(--elem-accent, var(--brand-color)); border: none; box-shadow: none; }
body.t-app .elem-btn-ghost a.web-btn-primary,
body.t-app .elem-btn-ghost a.web-btn-primary:hover { color: var(--elem-accent, var(--brand-color)); }

.elem-hide-title .dash-widget-header { display: none; }

.elem-kpi-sm .dash-kpi-value { font-size: 1.5rem; }
.elem-kpi-md .dash-kpi-value { font-size: 2rem; }
.elem-kpi-lg .dash-kpi-value { font-size: 2.5rem; }
.elem-kpi-xl .dash-kpi-value { font-size: 3rem; }

.elem-dash-flat .dash-widget,
.elem-dash-flat .dash-kpi-card { box-shadow: none; background: var(--surface-sunken); }
.elem-dash-elevated .dash-widget { box-shadow: 0 8px 24px rgba(15, 23, 42, 0.1); border: none; }
.elem-dash-bordered .dash-widget { border-width: 2px; border-color: var(--elem-accent, var(--outline-strong)); }

.form-field[style*="--elem-chart-height"] .dash-chart-canvas,
.form-field[style*="--elem-chart-height"] .dash-gauge-canvas { height: var(--elem-chart-height); }

.elem-table-compact .dash-table th,
.elem-table-compact .dash-table td { padding: 0.25rem 0.5rem; }
.elem-table-comfortable .dash-table th,
.elem-table-comfortable .dash-table td { padding: 0.75rem 1rem; }

.elem-variant-horizontal .dash-chart-wrap { min-height: 12rem; }
.elem-variant-emphasis .dash-kpi-value { letter-spacing: -0.02em; }
.elem-variant-compact .dash-widget { padding: 0.75rem; min-height: 6rem; }
.elem-variant-callout .dash-info { border-inline-start: 4px solid var(--elem-accent, var(--brand-color)); padding-inline-start: 1rem; background: var(--surface-sunken); border-radius: 0.5rem; }
.elem-variant-smooth .dash-chart-canvas { filter: saturate(1.1); }
.elem-variant-gradient .dash-chart-wrap { background: linear-gradient(180deg, transparent, var(--surface-sunken)); border-radius: 0.5rem; }
.elem-variant-labeled .dash-progress-label { font-weight: 600; }

.app-context-bar {
    flex-shrink: 0;
    overflow: visible;
    background: var(--surface-raised, #fff);
    border: 1px solid var(--outline, #e5e7eb);
    border-radius: 0.75rem;
    padding: 0.75rem 1rem 0;
}

.app-context-breadcrumb a.t-btn-link {
    color: var(--ink-muted, #6b7280);
}

.app-page-tabs-wrap {
    margin-inline: -1rem;
    padding-inline: 1rem;
}

.app-page-tabs {
    scrollbar-width: thin;
}

.app-page-tab-item {
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.app-page-tab-item:not(.border-sky-400):hover {
    background: color-mix(in srgb, var(--sky, #0ea5e9) 6%, #fff);
}

/* Legal documents */
.t-legal-card {
    color: inherit;
}

.t-legal h2 {
    scroll-margin-top: 5rem;
}

.t-legal-section + .t-legal-section {
    border-top: 1px solid var(--outline, #f3f4f6);
    padding-top: 2rem;
}

.t-legal-footer a {
    text-decoration: none;
}

.t-legal-footer a:hover {
    text-decoration: underline;
}


/* ==========================================================================
   Partner portal
   ========================================================================== */

.t-partner-app {
    background: var(--surface);
}

.t-partner-nav .t-brand-text {
    font-size: 1rem;
}

.t-partner-hero {
    position: relative;
    overflow: hidden;
}

.t-partner-commission-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 5.5rem;
    min-height: 5.5rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-modal);
    background: linear-gradient(135deg, var(--sky-deep), var(--brand-color));
    color: #fff;
    font-family: var(--font-display);
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 800;
    letter-spacing: -0.04em;
    box-shadow: var(--shadow-card-hover);
}

.t-partner-referral-card .t-card-header {
    align-items: flex-start;
}

.t-partner-copy-row {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 0.75rem;
}

.t-partner-copy-input {
    flex: 1 1 14rem;
    min-width: 0;
    margin: 0;
    padding: 0.75rem 1rem;
    border: 1px solid var(--outline);
    border-radius: var(--radius-input);
    background: var(--surface-sunken);
    color: var(--ink);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.8125rem;
    line-height: 1.4;
    word-break: break-all;
}

.t-partner-payout-grid {
    display: grid;
    gap: 1.25rem;
}

@media (min-width: 900px) {
    .t-partner-payout-grid {
        grid-template-columns: minmax(0, 1fr) minmax(18rem, 22rem);
        align-items: start;
    }
}

.t-partner-payout-form .t-card-header,
.t-partner-apply-form .t-card-header {
    flex-direction: column;
    align-items: flex-start;
}

.t-card-header--divider {
    border-top: 1px solid var(--outline);
}

.t-card-body--flush {
    padding: 0;
}

.t-card-body--flush .t-table-wrap {
    border: none;
    border-radius: 0;
    box-shadow: none;
}

.t-partner-form-grid {
    display: grid;
    gap: 1rem;
}

@media (min-width: 640px) {
    .t-partner-form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

