/* ==========================================================
   YPWK Digital UI/UX Responsive Final V21
   Loaded last to resolve cascade conflicts from legacy UI layers.
   ========================================================== */

body.portal-body .main,
body.portal-body .topbar,
body.portal-body .topbar > div,
body.portal-body .panel,
body.portal-body .panel-head,
body.portal-body .panel-head > div,
body.portal-body .module-layout,
body.portal-body .cms-layout,
body.portal-body .form-grid,
body.portal-body .table-wrap,
body.portal-body .action-row,
body.portal-body .panel-actions,
body.portal-body .inline-disclosure,
body.portal-body .disclosure-card {
    min-width: 0 !important;
}

body.portal-body .panel-head > div:first-child {
    flex: 1 1 auto !important;
    width: auto !important;
    max-width: 100% !important;
}

body.portal-body .panel-head h2,
body.portal-body .panel-head p,
body.portal-body .readonly-field strong,
body.portal-body .mini-record,
body.portal-body td,
body.portal-body th {
    overflow-wrap: anywhere;
    word-break: normal;
}

body.portal-body .panel-head .action-row,
body.portal-body .panel-head .panel-actions,
body.portal-body .panel-head > .inline-disclosure {
    flex: 0 0 auto !important;
    width: auto !important;
    max-width: 100% !important;
}

body.portal-body .btn {
    max-width: 100% !important;
    text-align: center;
}

body.portal-body .kpi-card strong {
    overflow-wrap: normal !important;
    word-break: normal !important;
}

body.portal-body .kpi-card .kpi-value-long {
    font-size: 26px !important;
    line-height: 1.12 !important;
    letter-spacing: 0 !important;
    overflow-wrap: normal !important;
    word-break: keep-all !important;
}

body.portal-body .table-wrap {
    overscroll-behavior-x: contain;
    scrollbar-gutter: stable;
}

body.portal-body .table-wrap table {
    margin-left: 0 !important;
    margin-right: 0 !important;
}

body.portal-body .command-item[hidden] {
    display: none !important;
}

body.public-site .rich-content pre,
body.public-site .page-body pre,
body.public-site .content-body pre {
    max-width: 100%;
    overflow-x: auto;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

@media (max-width: 1120px) {
    body.portal-body .panel-head {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) !important;
        align-items: start !important;
        gap: 12px !important;
    }

    body.portal-body .panel-head > div:first-child {
        width: 100% !important;
    }

    body.portal-body .panel-head .action-row,
    body.portal-body .panel-head .panel-actions,
    body.portal-body .panel-head > .inline-disclosure {
        width: auto !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        justify-self: start !important;
        justify-content: flex-start !important;
    }

    body.portal-body .panel-head .action-row .btn,
    body.portal-body .panel-head .panel-actions .btn,
    body.portal-body .panel-head > .btn,
    body.portal-body .panel-head > a.btn,
    body.portal-body .panel-head > .inline-disclosure > summary.btn {
        width: auto !important;
        min-width: 0 !important;
    }

    body.portal-body .inline-disclosure[open] {
        width: 100% !important;
        justify-self: stretch !important;
    }

    body.portal-body .inline-disclosure[open] .disclosure-card,
    body.portal-body .inline-disclosure[open] .form-grid {
        width: 100% !important;
        max-width: 100% !important;
    }
}

@media (min-width: 681px) and (max-width: 920px) {
    body.portal-body .topbar-actions {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        width: 100% !important;
        gap: 8px !important;
    }

    body.portal-body .topbar-actions > *,
    body.portal-body .topbar-actions form,
    body.portal-body .topbar-actions .btn,
    body.portal-body .topbar-actions button,
    body.portal-body .topbar-meta {
        width: 100% !important;
        min-width: 0 !important;
    }
}

@media (max-width: 680px) {
    body.portal-body .topbar-actions {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        width: 100% !important;
        gap: 7px !important;
    }

    body.portal-body .topbar-actions > *,
    body.portal-body .topbar-actions form,
    body.portal-body .topbar-actions .btn,
    body.portal-body .topbar-actions button {
        width: 100% !important;
        min-width: 0 !important;
    }

    body.portal-body .panel-head .action-row,
    body.portal-body .panel-head .panel-actions,
    body.portal-body .panel-head > .inline-disclosure {
        width: 100% !important;
        justify-self: stretch !important;
    }

    body.portal-body .panel-head .action-row .btn,
    body.portal-body .panel-head .panel-actions .btn,
    body.portal-body .panel-head > .btn,
    body.portal-body .panel-head > a.btn,
    body.portal-body .panel-head > .inline-disclosure > summary.btn {
        width: 100% !important;
    }

    body.portal-body .panel-head .action-row,
    body.portal-body .panel-head .panel-actions {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) !important;
    }

    body.portal-body .table-wrap tbody td {
        grid-template-columns: minmax(88px, 34%) minmax(0, 1fr) !important;
    }

    body.portal-body .table-wrap tbody td > *,
    body.portal-body .table-wrap tbody td .action-row,
    body.portal-body .table-wrap tbody td .inline-form,
    body.portal-body .table-wrap tbody td .stack-actions {
        min-width: 0 !important;
        max-width: 100% !important;
    }
}

@media (max-width: 420px) {
    body.portal-body .main {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }

    body.portal-body .topbar,
    body.portal-body .panel,
    body.portal-body .kpi-card,
    body.portal-body .stat-card,
    body.portal-body .role-card,
    body.portal-body .cms-guide-card {
        max-width: 100% !important;
    }
}
