/* Wider customer portal with compact ticket metadata and no horizontal scrolling. */
html:has(body.pstm-support-page),
body.pstm-support-page {
    max-width: 100% !important;
    overflow-x: hidden !important;
    overflow-x: clip !important;
}

body.pstm-support-page .wp-site-blocks,
body.pstm-support-page main,
body.pstm-support-page .site-content,
body.pstm-support-page .support-ticket-page-container {
    max-width: 100% !important;
    overflow-x: hidden !important;
    overflow-x: clip !important;
}

.pstm-portal {
    position: relative;
    left: 50%;
    display: block;
    box-sizing: border-box;
    width: min(1180px, calc(100vw - 32px)) !important;
    max-width: none !important;
    margin: 32px 0 !important;
    padding: 0 !important;
    transform: translateX(-50%);
    color: #172033;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

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

/* Keep the ticket layout independent from theme card, header and form rules. */
.pstm-portal .pstm-portal-head {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 24px !important;
    min-height: 148px;
    margin: 0 0 20px !important;
    padding: 24px 28px !important;
    overflow: hidden;
    border: 1px solid #d8e3ec !important;
    border-left: 5px solid #0f8b80 !important;
    border-radius: 17px !important;
    background: #fff !important;
    box-shadow: 0 10px 28px rgba(15, 23, 42, .045) !important;
}

.pstm-portal .pstm-portal-head > div {
    min-width: 0;
}

.pstm-portal .pstm-portal-head > div:last-child {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 6px;
}

.pstm-portal .pstm-portal-head span,
.pstm-portal .pstm-portal-head h2,
.pstm-portal .pstm-portal-head p {
    font-family: inherit !important;
}

.pstm-portal .pstm-portal-head > div:first-child > span {
    display: block;
    margin: 0 0 3px !important;
    color: #526176 !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    line-height: 1.4 !important;
}

.pstm-portal .pstm-portal-head h2 {
    margin: 0 !important;
    color: #16304f !important;
    font-size: clamp(25px, 3vw, 31px) !important;
    font-weight: 800 !important;
    line-height: 1.2 !important;
    letter-spacing: -.025em !important;
    overflow-wrap: anywhere;
}

.pstm-portal .pstm-portal-head p {
    margin: 11px 0 0 !important;
    color: #27364a !important;
    font-size: 16px !important;
    line-height: 1.5 !important;
}

.pstm-portal .pstm-meta {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(150px, 190px));
    gap: 8px;
    justify-content: start;
    width: 100%;
    margin: 0 0 24px !important;
    padding: 0 !important;
}

.pstm-portal .pstm-meta > div {
    display: block !important;
    min-width: 0;
    min-height: 62px;
    margin: 0 !important;
    padding: 9px 12px !important;
    border: 1px solid #dbe5f0;
    border-radius: 10px;
    background: #fff !important;
    box-shadow: 0 4px 13px rgba(15, 23, 42, .025);
}

.pstm-portal .pstm-meta dt {
    display: block !important;
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    float: none !important;
    color: #64748b;
    font-size: 10px;
    font-weight: 750;
    line-height: 1.3;
    letter-spacing: .055em;
    text-transform: uppercase;
}

.pstm-portal .pstm-meta dd {
    display: block !important;
    width: auto !important;
    margin: 5px 0 0 !important;
    margin-inline-start: 0 !important;
    padding: 0 !important;
    float: none !important;
    overflow-wrap: normal;
    color: #172033;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.35;
    white-space: nowrap;
}

.pstm-portal .pstm-alert {
    width: min(100%, 760px);
    margin: 0 auto 26px !important;
    padding: 17px 20px !important;
    border: 1px solid #fecaca !important;
    border-radius: 10px !important;
    background: #fff1f2 !important;
    color: #27364a !important;
    font-family: inherit !important;
    font-size: 15px !important;
    line-height: 1.7 !important;
}

.pstm-portal .pstm-conversation-title {
    margin: 25px 0 15px !important;
    color: #16304f !important;
    font-family: inherit !important;
    font-size: 18px !important;
    font-weight: 800 !important;
    line-height: 1.35 !important;
}

/* Keep the conversation open on the page instead of inside a tinted panel. */
.pstm-portal .pstm-conversation {
    display: flex !important;
    width: 100% !important;
    margin: 0 0 26px !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    flex-direction: column !important;
    gap: 14px !important;
}

.pstm-portal .pstm-conversation article {
    align-self: flex-start;
    width: 85%;
    min-width: min(360px, 100%);
    max-width: 85% !important;
    margin: 0 !important;
    padding: 16px 18px !important;
    border: 1px solid #dbe5f0 !important;
    border-radius: 14px !important;
    background: #fff !important;
    color: #27364a !important;
    box-shadow: 0 7px 20px rgba(15, 23, 42, .045) !important;
    font-family: inherit !important;
}

.pstm-portal .pstm-conversation article > header {
    display: flex !important;
    align-items: flex-start !important;
    justify-content: space-between !important;
    gap: 16px !important;
    margin: 0 0 12px !important;
    padding: 0 0 10px !important;
    border: 0 !important;
    border-bottom: 1px solid #e2e8f0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

.pstm-portal .pstm-conversation article strong {
    color: #172033 !important;
    font-size: 14px !important;
    font-weight: 800 !important;
    line-height: 1.35 !important;
}

.pstm-portal .pstm-conversation article time {
    flex: 0 0 auto;
    color: #64748b !important;
    font-size: 10px !important;
    font-weight: 500 !important;
    line-height: 1.5 !important;
    white-space: nowrap;
}

.pstm-portal .pstm-conversation article > div,
.pstm-portal .pstm-conversation article > div p {
    margin-top: 0 !important;
    color: #27364a !important;
    font-size: 15px !important;
    line-height: 1.65 !important;
}

.pstm-portal .pstm-conversation article > div p:last-child {
    margin-bottom: 0 !important;
}

.pstm-portal .pstm-conversation article.agent {
    align-self: flex-end;
    width: auto;
    border: 1px solid #d8e0e9;
    background: #f1f3f5 !important;
    box-shadow: 0 6px 18px rgba(15, 23, 42, .045);
}

.pstm-portal .pstm-attachment {
    display: inline-flex !important;
    align-items: center;
    gap: 5px;
    margin: 10px 0 0 !important;
    color: #334155 !important;
    font-size: 14px !important;
    overflow-wrap: anywhere;
}

.pstm-portal .pstm-portal-reply {
    display: block !important;
    width: 100% !important;
    margin: 24px 0 0 !important;
    padding: 24px !important;
    border: 1px solid #dbe5f0 !important;
    border-radius: 15px !important;
    background: #fff !important;
    box-shadow: 0 10px 28px rgba(15, 23, 42, .04) !important;
}

.pstm-portal .pstm-portal-reply label {
    display: block !important;
    width: 100% !important;
    margin: 0 0 17px !important;
    color: #172033 !important;
    font-family: inherit !important;
    font-size: 14px !important;
    font-weight: 750 !important;
    line-height: 1.45 !important;
}

.pstm-portal .pstm-portal-reply textarea,
.pstm-portal .pstm-portal-reply input[type="file"] {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    margin: 7px 0 0 !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 8px !important;
    background: #fff !important;
    color: #172033 !important;
    box-shadow: none !important;
    font: inherit !important;
}

.pstm-portal .pstm-portal-reply textarea {
    min-height: 150px !important;
    padding: 13px !important;
    resize: vertical;
}

.pstm-portal .pstm-portal-reply input[type="file"] {
    min-height: 46px !important;
    padding: 7px !important;
}

.pstm-portal .pstm-portal-reply textarea:focus,
.pstm-portal .pstm-portal-reply input[type="file"]:focus {
    border-color: #0f8b80 !important;
    outline: 0 !important;
    box-shadow: 0 0 0 3px rgba(15, 139, 128, .14) !important;
}

.pstm-portal .pstm-portal-reply button[type="submit"],
.pstm-portal form .pstm-close {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 44px !important;
    margin: 0 !important;
    padding: 10px 18px !important;
    border: 0 !important;
    border-radius: 9px !important;
    background: #0f8178 !important;
    color: #fff !important;
    box-shadow: 0 7px 17px rgba(15, 129, 120, .18) !important;
    font-family: inherit !important;
    font-size: 14px !important;
    font-weight: 750 !important;
    line-height: 1.4 !important;
    text-decoration: none !important;
    cursor: pointer;
}

.pstm-portal > form:last-of-type {
    margin: 14px 0 0 !important;
}

.pstm-portal .pstm-portal-reply button[type="submit"]:hover,
.pstm-portal form .pstm-close:hover {
    background: #0b6f68 !important;
}

.pstm-image-size-message {
    display: block;
    margin: 8px 0 0 !important;
    color: #b42318 !important;
    font-size: 12px !important;
    font-weight: 650 !important;
    line-height: 1.45 !important;
}

.pstm-image-size-message[hidden] {
    display: none !important;
}

.pstm-customer-tickets {
    width: 100%;
    overflow: visible;
}

.pstm-customer-tickets table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
}

.pstm-customer-tickets th,
.pstm-customer-tickets td {
    min-width: 0;
    padding: 11px 12px;
    overflow-wrap: anywhere;
    word-break: normal;
    vertical-align: top;
}

.pstm-customer-tickets th:nth-child(1) { width: 22%; }
.pstm-customer-tickets th:nth-child(2) { width: 28%; }
.pstm-customer-tickets th:nth-child(3) { width: 19%; }
.pstm-customer-tickets th:nth-child(4) { width: 13%; }
.pstm-customer-tickets th:nth-child(5) { width: 18%; }

@media (max-width: 720px) {
    .pstm-portal {
        left: 50%;
        width: calc(100vw - 24px) !important;
        margin: 20px 0 !important;
        transform: translateX(-50%);
    }

    .pstm-portal .pstm-portal-head {
        min-height: 0;
        padding: 20px !important;
        align-items: flex-start !important;
        flex-direction: column !important;
    }

    .pstm-portal .pstm-portal-head > div:last-child {
        justify-content: flex-start;
    }

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

    .pstm-portal .pstm-conversation article,
    .pstm-portal .pstm-conversation article.agent {
        width: 100%;
        min-width: 0;
        max-width: 100% !important;
    }

    .pstm-portal .pstm-portal-reply {
        padding: 18px !important;
    }

    .pstm-customer-tickets {
        border: 0;
        border-radius: 0;
    }

    .pstm-customer-tickets table,
    .pstm-customer-tickets tbody,
    .pstm-customer-tickets tr,
    .pstm-customer-tickets td {
        display: block;
        width: 100%;
    }

    .pstm-customer-tickets thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    .pstm-customer-tickets tr {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 11px 16px;
        margin-bottom: 12px;
        padding: 14px;
        border: 1px solid #dbe5f0;
        border-radius: 12px;
        background: #fff;
    }

    .pstm-customer-tickets td {
        padding: 0;
        border: 0;
    }

    .pstm-customer-tickets td::before {
        display: block;
        margin-bottom: 4px;
        color: #64748b;
        font-size: 10px;
        font-weight: 750;
        letter-spacing: .05em;
        text-transform: uppercase;
    }

    .pstm-customer-tickets td:nth-child(1)::before { content: "Ticket ID"; }
    .pstm-customer-tickets td:nth-child(2)::before { content: "Subject"; }
    .pstm-customer-tickets td:nth-child(3)::before { content: "Status"; }
    .pstm-customer-tickets td:nth-child(4)::before { content: "Priority"; }
    .pstm-customer-tickets td:nth-child(5)::before { content: "Updated"; }
}

@media (max-width: 480px) {
    .pstm-meta,
    .pstm-customer-tickets tr {
        grid-template-columns: 1fr;
    }

    .pstm-portal .pstm-meta dd {
        white-space: normal;
    }
}

/* Center customer authentication and ticket-list views independently of the
   active theme's content column. Ticket conversation pages retain the wider
   portal layout above. */
body.pstm-support-page .pstm-page-form-wrap > .pstm-portal.pstm-portal-login,
body.pstm-support-page .pstm-page-form-wrap > .pstm-portal.pstm-portal-dashboard,
.pstm-portal.pstm-portal-login,
.pstm-portal.pstm-portal-dashboard {
    position: relative !important;
    left: 50% !important;
    width: 100vw !important;
    width: 100dvw !important;
    max-width: 100vw !important;
    max-width: 100dvw !important;
    margin: 0 0 32px -50vw !important;
    margin-left: -50dvw !important;
    padding: 40px 16px !important;
    transform: none !important;
    overflow: visible !important;
}

.pstm-customer-login-content {
    width: min(100%, 760px);
    margin: 0 auto;
}

.pstm-portal-login .pstm-lookup {
    width: 100%;
    margin: 0 auto !important;
    padding: 30px 32px !important;
    border: 1px solid #dbe5f0 !important;
    border-radius: 14px !important;
    background: #fff !important;
    box-shadow: 0 10px 28px rgba(15, 23, 42, .05) !important;
}

.pstm-portal-login .pstm-alert {
    width: 100%;
    max-width: none;
}

.pstm-customer-dashboard-content {
    width: min(100%, 1180px);
    margin: 0 auto;
}

.pstm-customer-dashboard-content .pstm-alert {
    margin-right: auto !important;
    margin-left: auto !important;
}

/* The secure ticket-detail URL also has to escape narrow or offset theme
   columns. Keep the complete conversation centered in a 1180px viewport
   container while preserving full-width behavior on smaller screens. */
body.pstm-support-page .pstm-page-form-wrap > .pstm-portal.pstm-portal-ticket,
.pstm-portal.pstm-portal-ticket {
    position: relative !important;
    left: 50% !important;
    width: 100vw !important;
    width: 100dvw !important;
    max-width: 100vw !important;
    max-width: 100dvw !important;
    margin: 0 0 32px -50vw !important;
    margin-left: -50dvw !important;
    padding: 40px max(16px, calc((100vw - 1180px) / 2)) !important;
    padding-right: max(16px, calc((100dvw - 1180px) / 2)) !important;
    padding-left: max(16px, calc((100dvw - 1180px) / 2)) !important;
    transform: none !important;
    overflow: visible !important;
}

@media (max-width: 720px) {
    body.pstm-support-page .pstm-page-form-wrap > .pstm-portal.pstm-portal-login,
    body.pstm-support-page .pstm-page-form-wrap > .pstm-portal.pstm-portal-dashboard,
    .pstm-portal.pstm-portal-login,
    .pstm-portal.pstm-portal-dashboard {
        margin-bottom: 20px !important;
        padding: 24px 12px !important;
    }

    .pstm-portal-login .pstm-lookup {
        padding: 22px 18px !important;
    }

    body.pstm-support-page .pstm-page-form-wrap > .pstm-portal.pstm-portal-ticket,
    .pstm-portal.pstm-portal-ticket {
        margin-bottom: 20px !important;
        padding: 24px 12px !important;
    }

    .pstm-customer-head {
        align-items: flex-start;
        flex-direction: column;
    }
}
