/* Shared responsive corrections for non-studio workspace routes. */
@media (min-width: 576px) and (max-width: 991.98px) {
    html[data-ui-theme="workspace"] .brand-body .brand-topbar {
        flex-wrap: wrap;
    }

    html[data-ui-theme="workspace"] .brand-body .brand-topbar-title {
        flex: 1 1 calc(100% - 64px);
    }

    html[data-ui-theme="workspace"] .brand-topbar-title > span {
        display: block;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    html[data-ui-theme="workspace"] .brand-body .brand-topbar-actions {
        flex: 1 0 100%;
        width: 100%;
    }
}

@media (max-width: 991.98px) {
    /* Keep the full localized name inside its own six-slot navigation target. */
    html[data-ui-theme="workspace"] .client-bottom-nav > :is(a, button) > span {
        display: block;
        max-width: 100%;
        min-width: 0;
        white-space: normal;
        overflow-wrap: anywhere;
        hyphens: auto;
        text-wrap: balance;
        text-align: center;
        font-weight: 600;
        letter-spacing: -.01em;
        line-height: 1.15;
    }

    html[data-ui-theme="workspace"] .brand-body:has(.quick-client-form) {
        --workspace-action-bottom: calc(110px + env(safe-area-inset-bottom));
        --workspace-actions-height: 104px;
    }

    html[data-ui-theme="workspace"] .quick-client-form .quick-action-bar {
        bottom: var(--workspace-action-bottom);
    }

    html[data-ui-theme="workspace"] .brand-body:has(.quick-client-form) .brand-main-content {
        padding-bottom: calc(var(--workspace-action-bottom) + var(--workspace-actions-height) + 24px) !important;
    }

    html[data-ui-theme="workspace"] .brand-body:has(.quick-client-form) :is(.brand-module-guide-floating, .frexima-back-to-top) {
        bottom: calc(var(--workspace-action-bottom) + var(--workspace-actions-height) + 12px) !important;
    }
}

/* Keep the inbox title visible on phones; the compact conversation view may
   still hide its entire heading when a conversation is selected. */
html[data-ui-theme="workspace"] .client-body .messages-heading h1 {
    display: block;
    margin: 0 0 8px;
    color: var(--workspace-text);
    font-size: clamp(1.55rem, 4vw, 2rem);
}

html[data-ui-theme="workspace"] .workspace-page-title {
    margin: 0 0 6px;
    color: var(--workspace-text);
    font-size: clamp(1.55rem, 4vw, 2.15rem);
    font-weight: 850;
    letter-spacing: -.035em;
    line-height: 1.1;
}

html[data-ui-theme="workspace"] .connection-social-profile .creator-profile-back {
    display: inline-flex;
    width: auto;
    min-width: 48px;
    min-height: 48px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding-inline: 14px;
    border-radius: 999px;
    font-size: .82rem;
    font-weight: 800;
}

@media (max-width: 767.98px) {
    .service-catalog-table,
    .service-catalog-table tbody,
    .service-catalog-table tr,
    .service-catalog-table td {
        display: block;
        max-width: 100%;
        min-width: 0 !important;
        width: 100%;
    }

    .service-catalog-table thead {
        display: none;
    }

    .service-catalog-table tbody {
        display: grid;
        gap: 0.85rem;
    }

    .service-catalog-table tr {
        background: var(--fx-surface, #fffdfa);
        border: 1px solid var(--fx-border, #e6ddd4);
        border-radius: 14px;
        overflow: hidden;
        padding: 0.4rem 0.85rem;
    }

    .service-catalog-table td {
        align-items: center;
        border-bottom: 1px solid var(--fx-border, #e6ddd4);
        display: flex;
        gap: 1rem;
        justify-content: space-between;
        min-height: 44px;
        padding: 0.65rem 0;
        text-align: right !important;
    }

    .service-catalog-table td:first-child {
        display: block;
        text-align: left !important;
    }

    .service-catalog-table td:first-child::before {
        display: block;
        margin-bottom: 0.45rem;
    }

    .service-catalog-table td:last-child {
        border-bottom: 0;
    }

    .service-catalog-table td::before {
        color: var(--fx-text-muted, #6d5847);
        content: attr(data-label);
        flex: 0 0 auto;
        font-size: 0.78rem;
        font-weight: 750;
        letter-spacing: 0.03em;
        text-align: left;
    }

    .service-catalog-table td:last-child > div {
        margin-left: auto;
    }

    html[data-ui-theme="workspace"] .frexima-dashboard-hero .dashboard-selected-assistant {
        display: none;
    }

    html[data-ui-theme="workspace"] :is(.page-actions, .support-section-header) {
        min-width: 0;
    }

    html[data-ui-theme="workspace"] .support-search-form {
        width: 100%;
        max-width: none;
        flex: 0 0 auto;
    }

    html[data-ui-theme="workspace"] .support-tickets-panel {
        padding-inline: 14px;
    }

    html[data-ui-theme="workspace"] .support-ticket-table {
        margin-inline: 0;
        overflow: visible;
    }

    html[data-ui-theme="workspace"] .support-ticket-table table,
    html[data-ui-theme="workspace"] .support-ticket-table tbody,
    html[data-ui-theme="workspace"] .support-ticket-table tr,
    html[data-ui-theme="workspace"] .support-ticket-table td {
        display: block;
        width: 100%;
    }

    html[data-ui-theme="workspace"] .support-ticket-table table {
        min-width: 0 !important;
        table-layout: fixed;
    }

    html[data-ui-theme="workspace"] .support-ticket-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        clip-path: inset(50%);
        white-space: nowrap;
    }

    html[data-ui-theme="workspace"] .support-ticket-table tbody {
        display: grid;
        gap: 12px;
    }

    html[data-ui-theme="workspace"] .support-ticket-table tr {
        overflow: hidden;
        background: var(--workspace-surface);
        border: 1px solid var(--workspace-line);
        border-radius: 14px;
        box-shadow: var(--workspace-shadow);
    }

    html[data-ui-theme="workspace"] .support-ticket-table td {
        display: grid;
        grid-template-columns: minmax(104px, 38%) minmax(0, 1fr);
        align-items: center;
        gap: 10px;
        padding: 10px 12px;
        border: 0;
        border-top: 1px solid var(--workspace-line);
        text-align: start !important;
        overflow-wrap: anywhere;
    }

    html[data-ui-theme="workspace"] .support-ticket-table td:first-child { border-top: 0; }
    html[data-ui-theme="workspace"] .support-ticket-table td::before {
        content: attr(data-label);
        color: var(--workspace-muted);
        font-size: .72rem;
        font-weight: 800;
        letter-spacing: .02em;
    }

    html[data-ui-theme="workspace"] .support-ticket-table td[colspan] {
        display: block;
        padding: 28px 14px !important;
        border-top: 0;
        text-align: center !important;
    }

    html[data-ui-theme="workspace"] .support-ticket-table td[colspan]::before { content: none; }
    html[data-ui-theme="workspace"] .support-ticket-table td .btn { min-height: 44px; }

    html[data-ui-theme="workspace"] .modal-dialog {
        margin: max(10px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom));
    }

    html[data-ui-theme="workspace"] .modal-content { max-height: calc(100dvh - 20px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
    html[data-ui-theme="workspace"] .modal-body { overflow-y: auto; }

    html[data-ui-theme="workspace"] body[data-workspace-keyboard="open"] .quick-action-bar {
        position: static;
        margin: 14px -14px 0;
        padding-bottom: 12px;
    }

    html[data-ui-theme="workspace"] .connection-social-profile .creator-profile-back {
        top: 12px;
        left: 12px;
        width: auto;
        height: 48px;
        min-height: 48px;
        padding-inline: 13px;
    }

    html[data-ui-theme="workspace"] .connection-social-profile .creator-profile-avatar {
        z-index: 3;
        margin-top: -34px;
    }

    html[data-ui-theme="workspace"] .frexima-calendar-page .calendar-staff-row {
        padding: 8px 10px;
    }

    html[data-ui-theme="workspace"] .frexima-calendar-page .schedule-staff-selector {
        display: grid;
        min-width: 100%;
        grid-auto-flow: column;
        grid-auto-columns: minmax(160px, 1fr);
        gap: 8px;
        padding-bottom: 2px;
        scroll-padding-inline: 12px;
    }

    html[data-ui-theme="workspace"] .frexima-calendar-page .schedule-staff-chip {
        min-width: 0;
        min-height: 48px;
        padding: 7px 10px;
    }

    html[data-ui-theme="workspace"] .frexima-calendar-page .schedule-staff-chip span:last-child {
        min-width: 0;
    }

    html[data-ui-theme="workspace"] .frexima-calendar-page .schedule-staff-chip :is(strong, small) {
        max-width: none;
        overflow: visible;
        text-overflow: clip;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    html[data-ui-theme="workspace"] .frexima-calendar-page .calendar-title-block,
    html[data-ui-theme="workspace"] .frexima-calendar-page .calendar-today-button.is-current-date {
        display: none;
    }

    html[data-ui-theme="workspace"] .frexima-calendar-page .calendar-ops-bar {
        padding: 10px;
    }

    html[data-ui-theme="workspace"] .frexima-calendar-page .calendar-ops-main {
        min-height: 46px;
        padding-right: 104px;
    }

    html[data-ui-theme="workspace"] .frexima-calendar-page .calendar-nav-actions {
        min-width: 0;
    }

    html[data-ui-theme="workspace"] .frexima-calendar-page .calendar-date-jump {
        min-width: 0;
    }

    html[data-ui-theme="workspace"] .frexima-calendar-page .fx-workspace-tabs {
        min-height: 48px;
        margin-bottom: 10px;
        padding: 4px;
    }

    html[data-ui-theme="workspace"] .frexima-calendar-page .fx-workspace-tabs > a {
        min-height: 40px;
        padding: 8px 10px;
    }
}

@media (max-width: 575.98px) {
    html[data-ui-theme="workspace"] .brand-body .subscription-status-button {
        width: auto;
        min-width: 132px;
        padding: 6px 18px 7px 9px;
        grid-template-columns: minmax(0, 1fr);
    }

    html[data-ui-theme="workspace"] .brand-body .subscription-status-button > i {
        display: none;
    }

    html[data-ui-theme="workspace"] .brand-body .subscription-status-button-copy strong {
        max-width: none;
    }

    html[data-ui-theme="workspace"] .workspace-wrap-tabs {
        display: flex;
        width: 100%;
        flex-wrap: wrap;
        gap: 7px;
        overflow: visible;
    }

    html[data-ui-theme="workspace"] .workspace-wrap-tabs > :is(a, button),
    html[data-ui-theme="workspace"] .support-tabs .campaign-platform-tab {
        width: auto;
        min-width: 0;
        min-height: 44px;
        flex: 1 1 calc(50% - 7px);
        justify-content: center;
        white-space: normal;
        text-align: center;
    }

    html[data-ui-theme="workspace"] .support-section-header .btn,
    html[data-ui-theme="workspace"] .support-heading .btn { min-height: 48px; }

    html[data-ui-theme="workspace"] .support-ticket-table td {
        grid-template-columns: minmax(88px, 35%) minmax(0, 1fr);
    }
}

@media (max-width: 389.98px) {
    html[data-ui-theme="workspace"] .brand-body .subscription-status-button {
        width: 108px !important;
        min-width: 108px !important;
        min-height: 48px;
        height: 48px;
        padding: 5px 14px 5px 7px !important;
        grid-template-columns: minmax(0, 1fr) !important;
    }

    html[data-ui-theme="workspace"] .brand-body .subscription-status-button-copy {
        display: block !important;
    }

    html[data-ui-theme="workspace"] .brand-body .subscription-status-button-copy strong {
        max-width: none;
        overflow: visible;
        font-size: 9.5px;
        line-height: 1.08;
        text-overflow: clip;
        white-space: normal;
    }
}
