/* ═══════════════════════════════════════════════════════════
   Petty Cash Module — Mobile-first responsive UI
   ═══════════════════════════════════════════════════════════ */

.pc-module {
    --pc-touch-min: 44px;
    --pc-card-radius: 14px;
    --pc-gap: 0.75rem;
}

/* ── Icon-only action buttons ── */

.pc-icon-actions {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    justify-content: flex-end;
    align-items: center;
}

.pc-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.85rem;
    height: 1.85rem;
    min-width: 1.85rem;
    padding: 0;
    border: 1px solid var(--portal-border, #e2e8f0);
    border-radius: 7px;
    background: var(--portal-surface, #fff);
    color: var(--portal-text, #0f172a);
    cursor: pointer;
    font-size: 0.72rem;
    line-height: 1;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.pc-icon-btn i {
    font-size: 0.72rem;
    line-height: 1;
}

.pc-icon-btn:hover:not(:disabled) {
    background: var(--portal-surface-muted, #f8fafc);
    border-color: var(--portal-border-strong, #cbd5e1);
}

.pc-icon-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.pc-icon-btn.text-success { color: #16a34a; }
.pc-icon-btn.text-danger { color: #dc2626; }

.pc-line-close-btn {
    display: inline-flex;
    align-items: center;
    min-height: 2rem;
    padding: 0.35rem 0.65rem;
    border: 1px solid #fecaca;
    border-radius: 10px;
    background: #fff7f7;
    color: #b91c1c;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.pc-line-close-btn:hover:not(:disabled) {
    background: #fef2f2;
    border-color: #f87171;
}

/* ── Monthly expense report ── */

.pc-monthly-report-section {
    margin-top: 0.5rem;
}

.pc-monthly-report-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.pc-monthly-report-head h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 800;
}

.pc-monthly-report-head span {
    color: var(--portal-text-muted);
    font-size: 0.82rem;
}

.pc-monthly-report-scroll {
    overflow: auto;
    max-width: 100%;
    border: 1px solid var(--portal-border);
    border-radius: 1rem;
}

.pc-monthly-report-table {
    min-width: max-content;
    margin: 0;
}

.pc-monthly-report-table th,
.pc-monthly-report-table td {
    white-space: nowrap;
    vertical-align: middle;
}

.pc-monthly-sticky-col {
    position: sticky;
    left: 0;
    z-index: 2;
    background: inherit;
    min-width: 220px;
}

.pc-monthly-report-table thead .pc-monthly-sticky-col {
    background: #f8fafc;
    z-index: 3;
}

.pc-monthly-row-available {
    background: #ecfdf5;
}

.pc-monthly-row-available .pc-monthly-sticky-col {
    background: #ecfdf5;
}

.pc-monthly-row-exhausted {
    background: #fdf2f8;
}

.pc-monthly-row-exhausted .pc-monthly-sticky-col {
    background: #fdf2f8;
}

.pc-monthly-breakers {
    margin-top: 1.5rem;
}

.pc-monthly-breakers .pc-monthly-report-head h4 {
    color: #be185d;
}

.pc-centered-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 220px;
    width: 100%;
    padding: 2rem 1rem;
}

.pc-centered-loader.is-compact {
    min-height: 120px;
    padding: 1rem;
}

.pc-centered-loader-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.pc-centered-loader-msg {
    color: var(--portal-text-muted, #64748b);
    font-size: 0.9rem;
    font-weight: 600;
}

.pc-grid-host {
    position: relative;
    min-height: 120px;
}

.pc-grid-busy-overlay {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.72);
    border-radius: 0.75rem;
}

.pc-list-filters {
    align-items: end;
}

.pc-list-filters .pc-filter-search {
    margin-left: auto;
}

.pc-list-filters .pc-grid-search {
    width: 100%;
    max-width: none;
}

/* ── Column-wise detail grid (view pages) ── */

.pc-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.85rem 1.25rem;
}

.pc-detail-col {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--portal-border, #e2e8f0);
    border-radius: var(--pc-card-radius);
    background: var(--portal-surface-muted, #f8fafc);
}

.pc-detail-col-wide {
    grid-column: 1 / -1;
}

.pc-detail-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--portal-text-muted, #64748b);
}

.pc-detail-value {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--portal-text, #0f172a);
    word-break: break-word;
}

/* ── Select2-style location combobox ── */

.pc-combobox {
    position: relative;
    width: 100%;
}

.pc-combobox-trigger {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    text-align: left;
    cursor: pointer;
    background: var(--portal-surface, #fff);
}

.pc-combobox-value {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pc-combobox-value.is-placeholder {
    color: var(--portal-text-muted, #64748b);
    font-weight: 400;
}

.pc-combobox-chevron {
    color: var(--portal-text-muted, #64748b);
    font-size: 0.8rem;
    transition: transform 0.15s ease;
}

.pc-combobox.is-open .pc-combobox-chevron {
    transform: rotate(180deg);
}

.pc-combobox.is-open {
    position: relative;
    z-index: 31;
}

.pem-modal .pc-combobox.is-open {
    z-index: 70;
}

.pem-modal .pc-combobox-backdrop {
    position: fixed;
    z-index: 65;
}

.pem-modal .pc-combobox-panel {
    z-index: 71;
}

.pc-attachment-cell {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.pc-deposit-files {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 0;
}

.pc-deposit-files .pc-attachment-cell {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 0.35rem;
}

.pc-deposit-files .pc-attachment-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pc-deposit-files .pc-attachment-actions {
    flex-shrink: 0;
    gap: 0.15rem;
}

.pc-attachment-name {
    font-size: 0.85rem;
    word-break: break-word;
}

.pc-attachment-actions {
    display: flex;
    gap: 0.75rem;
}

.pc-combobox-backdrop {
    position: fixed;
    inset: 0;
    z-index: 30;
    background: transparent;
    border: 0;
    padding: 0;
    margin: 0;
}

.pc-combobox-panel {
    position: absolute;
    z-index: 31;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--portal-surface, #fff);
    border: 1px solid var(--portal-border, #e2e8f0);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
    overflow: hidden;
}

.pc-combobox-search {
    border: 0 !important;
    border-bottom: 1px solid var(--portal-border, #e2e8f0) !important;
    border-radius: 0 !important;
    margin: 0 !important;
}

.pc-combobox-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 240px;
    overflow-y: auto;
}

.pc-combobox-option {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.15rem 0.5rem;
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid var(--portal-border, #e2e8f0);
    cursor: pointer;
    min-height: var(--pc-touch-min);
    align-content: center;
}

.pc-combobox-option:last-child {
    border-bottom: 0;
}

.pc-combobox-option:hover,
.pc-combobox-option.is-selected {
    background: var(--portal-surface-muted, #f1f5f9);
}

.pc-combobox-option-code {
    font-weight: 700;
    font-size: 0.82rem;
}

.pc-combobox-option-name {
    grid-column: 2;
    font-size: 0.92rem;
}

.pc-combobox-option-meta {
    grid-column: 1 / -1;
    font-size: 0.75rem;
    color: var(--portal-text-muted, #64748b);
}

.pc-combobox-empty {
    padding: 0.85rem;
    color: var(--portal-text-muted, #64748b);
    font-size: 0.9rem;
}

.pc-header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-left: auto;
    align-items: center;
    justify-content: flex-end;
}

.pc-form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.pc-form-actions .btn-submit,
.pc-form-actions .btn-outline {
    width: auto;
    min-width: 8rem;
}

/* ── Workflow timeline on view pages ── */

.pc-workflow-timeline.audit-timeline {
    padding-left: 0.25rem;
}

.pc-workflow-timeline .audit-item {
    padding-bottom: 0.85rem;
}

.pc-workflow-timeline .audit-event {
    font-size: 0.92rem;
    line-height: 1.45;
}

/* ── Sticky acting role (quick role switch on phone) ── */

.pc-acting-role-bar {
    position: sticky;
    top: 0;
    z-index: 20;
    margin-bottom: 0.75rem !important;
    padding: 0.85rem 1rem !important;
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.08);
}

.pc-acting-role-bar .pc-acting-role-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--portal-text-muted, #64748b);
    margin-bottom: 0.35rem;
}

.pc-acting-role-bar .pc-acting-role-select {
    width: 100%;
    max-width: none !important;
    min-height: var(--pc-touch-min);
    font-size: 1rem;
}

/* ── Panel header ── */

.pc-module .master-header {
    display: flex;
    flex-wrap: wrap;
    gap: var(--pc-gap);
    justify-content: space-between;
    align-items: flex-start;
}

.pc-module .master-header h3 {
    font-size: 1.15rem;
    line-height: 1.3;
}

.pc-module .master-header p {
    font-size: 0.82rem;
    line-height: 1.45;
    margin-bottom: 0;
}

.pc-module .master-header > button,
.pc-module .master-header .btn-outline,
.pc-module .master-header .btn-submit {
    min-height: var(--pc-touch-min);
}

/* ── Forms & inputs (prevent iOS zoom on focus) ── */

.pc-module .portal-input,
.pc-module .form-control,
.pc-module .form-select,
.pc-module select.portal-input,
.pc-module textarea.portal-input {
    min-height: var(--pc-touch-min);
    font-size: 1rem;
}

.pc-module .pc-form-card {
    padding: 1rem !important;
    border-radius: var(--pc-card-radius);
}

.pc-module .pc-form-card .btn-submit,
.pc-module .pc-form-card .btn-primary,
.pc-module .pc-form-card .btn-outline {
    width: 100%;
    min-height: var(--pc-touch-min);
    margin-top: 0.5rem;
}

/* ── Expense / line item rows ── */

.pc-module .pc-expense-lines-block {
    display: grid;
    gap: 0.75rem;
    padding: 1rem;
    margin-bottom: 0.85rem;
    border: 1px solid var(--portal-border, #e2e8f0);
    border-radius: var(--pc-card-radius);
    background: var(--portal-surface-muted, #f8fafc);
}

.pc-module .pc-expense-line {
    padding: 0.85rem 0.9rem !important;
    margin: 0 !important;
    border: 1px solid var(--portal-border, #e2e8f0) !important;
    border-radius: 12px !important;
    background: var(--portal-surface, #fff) !important;
}

.pc-module .pc-expense-line .form-label {
    margin-bottom: 0.35rem;
    font-weight: 600;
    color: var(--portal-text, #0f172a);
}

.pc-module .pc-expense-line .pc-icon-btn {
    margin-bottom: 0.15rem;
}

.pc-module .pc-expense-add-row {
    width: 100%;
    min-height: 2.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    font-weight: 600;
    background: var(--portal-surface, #fff);
}

.pc-module .pc-expense-lines-total {
    margin-bottom: 1rem;
    font-weight: 700;
}

.pc-module .pc-form-location-wrap {
    max-width: 28rem;
}

.pc-module .pc-line-attachment {
    display: grid;
    gap: 0.3rem;
    min-width: 0;
}

.pc-module .pc-line-attachment-picker {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    padding: 0.45rem 0.65rem;
    min-height: 2.35rem;
    border: 1px dashed var(--portal-border, #cbd5e1);
    border-radius: 8px;
    background: var(--portal-surface, #fff);
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
    overflow: hidden;
}

.pc-module .pc-line-attachment-picker:hover:not(.is-disabled) {
    border-color: rgba(83, 147, 203, 0.55);
    background: #f8fafc;
}

.pc-module .pc-line-attachment-picker.is-disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.pc-module .pc-line-attachment-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    flex-shrink: 0;
    border-radius: 6px;
    background: #eff6ff;
    color: #2563eb;
    font-size: 0.72rem;
}

.pc-module .pc-line-attachment-text {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 0.82rem;
    line-height: 1.3;
}

.pc-module .pc-line-attachment-name,
.pc-module .pc-line-attachment-placeholder {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pc-module .pc-line-attachment-placeholder {
    color: var(--portal-text-muted, #64748b);
}

.pc-module .pc-line-attachment-prefix {
    display: block;
    font-size: 0.68rem;
    color: var(--portal-text-muted, #64748b);
    line-height: 1.2;
}

.pc-module .pc-line-attachment-input {
    position: absolute;
    width: 0.1px;
    height: 0.1px;
    opacity: 0;
    overflow: hidden;
    z-index: -1;
}

.pc-module .pc-line-attachment-hint {
    font-size: 0.68rem;
    line-height: 1.25;
    color: #94a3b8;
}

.pc-module .pc-line-attachment-error {
    font-size: 0.72rem;
    line-height: 1.25;
    color: #dc2626;
}

.pc-module .pc-expense-line .btn-submit {
    width: 100%;
    min-height: var(--pc-touch-min);
    margin-top: 0.5rem;
}

@media (max-width: 767.98px) {
    .pc-module .pc-expense-line {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .pc-module .pc-expense-line .portal-input,
    .pc-module .pc-expense-line select.portal-input,
    .pc-module .pc-expense-line input.portal-input,
    .pc-module .pc-expense-line .form-control {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
    }

    .pc-module .pc-expense-line .form-label {
        margin-bottom: 0.25rem;
    }
}

/* ── Action button groups ── */

.pc-action-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    justify-content: flex-end;
}

.pc-action-group .btn-submit,
.pc-action-group .btn-outline {
    min-height: 2.25rem;
}

/* ── Returned requests alert ── */

.pc-module .pc-returned-list li {
    margin-bottom: 0.65rem;
    line-height: 1.45;
}

.pc-module .pc-returned-list .btn-submit {
    margin-top: 0.35rem;
    min-height: var(--pc-touch-min);
}

/* ── Dashboard stats ── */

.pc-module .pem-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
}

.pc-module .pem-stat-card {
    padding: 1rem;
    border-radius: var(--pc-card-radius);
}

.pc-module .pem-stat-value {
    font-size: 1.65rem;
}

/* ── Mobile card tables ── */

@media (max-width: 768px) {
    .pc-module {
        padding: 0.85rem !important;
    }

    .pc-module .master-header {
        flex-direction: column;
        align-items: stretch;
    }

    .pc-module .master-header > button {
        width: 100%;
    }

    .pc-module .row.g-3 > [class*="col-"] {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .pc-action-group {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }

    .pc-action-group .btn-submit,
    .pc-action-group .btn-outline {
        width: 100%;
        min-height: var(--pc-touch-min);
        margin: 0 !important;
    }

    .pc-module .pc-returned-list .btn-submit {
        display: block;
        width: 100%;
        margin-left: 0 !important;
    }

    /* Table → cards */
    .pc-module .pc-mobile-table {
        border: 0;
        box-shadow: none !important;
        background: transparent;
    }

    .pc-module .pc-mobile-table thead {
        display: none;
    }

    .pc-module .pc-mobile-table tbody {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }

    .pc-module .pc-mobile-table tr {
        display: block;
        background: var(--portal-surface, #fff);
        border: 1px solid var(--portal-border, #e2e8f0);
        border-radius: var(--pc-card-radius);
        padding: 0.85rem 1rem;
        box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
    }

    .pc-module .pc-mobile-table tr.pc-row-returned {
        border-color: #fecaca;
        background: #fffafa;
    }

    .pc-module .pc-mobile-table tr.pc-mobile-empty {
        padding: 2rem 1rem;
        text-align: center;
        box-shadow: none;
    }

    .pc-module .pc-mobile-table tr.pc-mobile-empty td {
        display: block;
        border: 0;
        padding: 0;
    }

    .pc-module .pc-mobile-table tr.pc-mobile-empty td::before {
        display: none;
    }

    .pc-module .pc-mobile-table td {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 0.75rem;
        padding: 0.45rem 0;
        border: 0;
        text-align: right !important;
        font-size: 0.9rem;
        line-height: 1.4;
    }

    .pc-module .pc-mobile-table td::before {
        content: attr(data-label);
        font-weight: 700;
        font-size: 0.72rem;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: var(--portal-text-muted, #64748b);
        text-align: left;
        flex: 0 0 38%;
        padding-top: 0.1rem;
    }

    .pc-module .pc-mobile-table td.pc-mobile-actions {
        flex-direction: column;
        align-items: stretch;
        padding-top: 0.75rem;
        margin-top: 0.35rem;
        border-top: 1px dashed var(--portal-border, #e2e8f0);
    }

    .pc-module .pc-mobile-table td.pc-mobile-actions::before {
        margin-bottom: 0.25rem;
        flex: none;
    }

    .pc-module .pc-mobile-table td.pc-mobile-id {
        font-weight: 700;
        font-size: 1rem;
        color: var(--portal-primary, #1d4ed8);
        padding-bottom: 0.5rem;
        border-bottom: 1px solid var(--portal-border, #e2e8f0);
        margin-bottom: 0.25rem;
    }

    .pc-module .pc-mobile-table td.pc-mobile-id::before {
        display: none;
    }

    .pc-module .pc-mobile-table tfoot.pc-mobile-ledger-foot {
        display: block;
        margin-top: 0.5rem;
    }

    .pc-module .pc-mobile-table tfoot.pc-mobile-ledger-foot tr {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 1rem;
        background: #edf2f7 !important;
        border-radius: var(--pc-card-radius);
    }

    .pc-module .pc-mobile-table tfoot.pc-mobile-ledger-foot td {
        display: block;
        padding: 0;
        border: 0;
        text-align: right !important;
    }

    .pc-module .pc-mobile-table tfoot.pc-mobile-ledger-foot td::before {
        display: none;
    }

    .pc-module .pc-mobile-table tfoot.pc-mobile-ledger-foot td:first-child {
        flex: 1;
        text-align: left !important;
        font-weight: 700;
    }

    .pc-module .pc-mobile-table tfoot.pc-mobile-ledger-foot td:last-child {
        display: none;
    }

    .pc-meta-box .meta-row {
        display: flex;
        justify-content: space-between;
        gap: 0.75rem;
        padding: 0.4rem 0;
        border-bottom: 1px dashed var(--portal-border, #e2e8f0);
        font-size: 0.9rem;
    }

    .pc-meta-box .meta-row:last-child {
        border-bottom: 0;
    }

    .pc-meta-box .meta-label {
        font-weight: 700;
        font-size: 0.72rem;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: var(--portal-text-muted, #64748b);
        flex: 0 0 40%;
    }

    .pc-meta-box .meta-value {
        text-align: right;
        flex: 1;
    }

    .pc-module .pc-radio-row label {
        min-height: var(--pc-touch-min);
        display: inline-flex;
        align-items: center;
        gap: 0.5rem;
        padding: 0.35rem 0.75rem;
        border: 1px solid var(--portal-border, #e2e8f0);
        border-radius: 999px;
        background: var(--portal-surface, #fff);
    }

    .pc-module .pc-radio-row input[type="radio"] {
        width: 1.1rem;
        height: 1.1rem;
    }

    .pc-action-group .btn-link {
        min-height: 2.25rem;
        padding: 0.35rem 0.75rem;
    }

    /* Modals — bottom sheet style on phone */
    .pem-modal-overlay {
        padding: 0 !important;
        align-items: flex-end !important;
    }

    .pem-modal {
        max-width: 100% !important;
        width: 100%;
        max-height: 92vh !important;
        border-radius: 1.25rem 1.25rem 0 0 !important;
        margin: 0;
    }

    .pem-modal-header h3,
    .pem-modal-header h4 {
        font-size: 1.05rem;
    }

    .pem-modal-footer {
        flex-direction: column-reverse;
        gap: 0.5rem;
    }

    .pem-modal-footer .btn-submit,
    .pem-modal-footer .btn-primary,
    .pem-modal-footer .btn-outline {
        width: 100%;
        min-height: var(--pc-touch-min);
        margin: 0 !important;
    }

    .maintix-bento-shell .pem-modal-footer {
        flex-direction: column-reverse;
    }
}

@media (max-width: 400px) {
    .pc-module .pem-stats-grid {
        grid-template-columns: 1fr;
    }
}

/* Touch devices — larger tap targets */
@media (hover: none) and (pointer: coarse) {
    .pc-module .btn-submit,
    .pc-module .btn-outline,
    .pc-module .btn-link {
        min-height: var(--pc-touch-min);
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

/* Overall Ledger + filter bars — mobile polish */
@media (max-width: 768px) {
    .pc-module .pc-overall-ledger .row.g-3 > [class*="col-"] {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .pc-module .pc-ol-summary,
    .pc-module .pc-ol-grand-grid {
        grid-template-columns: 1fr !important;
    }

    .pc-module .pc-ol-location-header,
    .pc-module .pc-ol-section-header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.5rem;
    }

    .pc-module .pc-ol-section .master-table thead {
        display: none;
    }

    .pc-module .pc-ol-section .master-table,
    .pc-module .pc-ol-section .master-table tbody,
    .pc-module .pc-ol-section .master-table tr,
    .pc-module .pc-ol-section .master-table td {
        display: block;
        width: 100%;
    }

    .pc-module .pc-ol-section .master-table tr {
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        margin-bottom: 0.65rem;
        padding: 0.65rem 0.75rem;
        background: #fff;
    }

    .pc-module .pc-ol-section .master-table td {
        display: flex;
        justify-content: space-between;
        gap: 0.75rem;
        padding: 0.35rem 0;
        border: none;
        text-align: right;
    }

    .pc-module .pc-ol-section .master-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #64748b;
        text-align: left;
        flex: 0 0 42%;
    }

    .pc-module .pc-ol-section-totals {
        border-radius: 0 0 12px 12px;
        margin-bottom: 0.75rem;
    }

    .pc-module .pc-ol-section-totals-grid {
        grid-template-columns: 1fr !important;
    }

    .pc-module .pc-ol-section-totals-grid > div {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        gap: 0.75rem;
        padding: 0.35rem 0;
        border-bottom: 1px solid #e2e8f0;
    }

    .pc-module .pc-ol-section-totals-grid > div:last-child {
        border-bottom: none;
    }

    .pc-module .pc-ol-section-totals-grid span {
        margin-bottom: 0;
        flex: 0 0 40%;
    }

    .pc-module .pc-ol-section-totals-grid strong {
        text-align: right;
        white-space: nowrap;
    }

    .pc-module .pc-ol-grand-grid > div {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        gap: 0.75rem;
        padding: 0.45rem 0;
        border-bottom: 1px solid #e2e8f0;
    }

    .pc-module .pc-ol-grand-grid > div:last-child {
        border-bottom: none;
    }

    .pc-module .pc-ol-grand-grid .pc-ol-summary-label {
        margin-bottom: 0;
    }

    .pc-module .master-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .pc-module .pc-header-actions {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .pc-module .pc-header-actions .btn-submit,
    .pc-module .pc-header-actions .btn-outline {
        flex: 1 1 auto;
        min-width: 0;
    }

    .pc-module .pc-grid-search,
    .pc-module .row.g-2 .portal-input,
    .pc-module .row.g-3 .portal-input {
        font-size: 16px; /* prevent iOS zoom */
    }

    .pc-module .registry-data-grid {
        font-size: 0.85rem;
    }
}

/* ── Mobile: contain PC lists; table scrolls inside .table-wrap / grid data ── */
@media (max-width: 860px) {
    .maintix-bento-shell .portal-page:has(.pc-module),
    .maintix-bento-shell .portal-page:has(.pc-dashboard) {
        overflow-x: clip;
        max-width: 100%;
    }

    .maintix-bento-shell .pc-module,
    .maintix-bento-shell .pc-dashboard,
    .maintix-bento-shell .pc-module.master-panel,
    .maintix-bento-shell .pc-module.portal-card {
        max-width: 100%;
        min-width: 0;
        overflow-x: clip;
        box-sizing: border-box;
    }

    .maintix-bento-shell .pc-module .pc-list-filters,
    .maintix-bento-shell .pc-module .row,
    .maintix-bento-shell .pc-module .pc-grid-host,
    .maintix-bento-shell .pc-module .master-header {
        max-width: 100%;
        min-width: 0;
    }

    .maintix-bento-shell .pc-module .portal-input,
    .maintix-bento-shell .pc-module select.portal-input,
    .maintix-bento-shell .pc-module .pc-grid-search,
    .maintix-bento-shell .pc-module .pc-filter-search {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    .maintix-bento-shell .pc-module .table-wrap,
    .maintix-bento-shell .pc-dashboard .table-wrap {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        overflow-x: auto !important;
        overflow-y: visible !important;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;
    }

    .maintix-bento-shell .pc-module .rz-data-grid,
    .maintix-bento-shell .pc-dashboard .rz-data-grid {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        overflow: hidden !important;
    }

    .maintix-bento-shell .pc-module .rz-data-grid > .rz-data-grid-data,
    .maintix-bento-shell .pc-dashboard .rz-data-grid > .rz-data-grid-data {
        overflow: auto !important;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }

    .maintix-bento-shell .pc-module .rz-grid-table,
    .maintix-bento-shell .pc-dashboard .rz-grid-table {
        width: max-content !important;
        min-width: 920px !important;
        table-layout: auto !important;
    }

    .maintix-bento-shell .pc-module .rz-grid-table th,
    .maintix-bento-shell .pc-module .rz-grid-table td {
        white-space: nowrap;
        vertical-align: middle;
    }

    .maintix-bento-shell .pc-module .rz-data-grid > .rz-pager {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }
}

/* ── Status / step / type pill badges (list views) ── */

.pc-module .pc-badge,
.pc-dashboard .pc-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.32rem;
    max-width: 100%;
    padding: 0.2rem 0.6rem;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.25;
    white-space: nowrap;
    letter-spacing: 0.01em;
}

.pc-module .pc-badge .pc-badge-text,
.pc-dashboard .pc-badge .pc-badge-text {
    overflow: hidden;
    text-overflow: ellipsis;
}

.pc-module .pc-badge i,
.pc-dashboard .pc-badge i {
    font-size: 0.62rem;
    opacity: 0.85;
}

/* Success — green */
.pc-badge-success {
    background: #ecfdf5;
    border-color: rgba(5, 150, 105, 0.28);
    color: #047857;
}

/* Warning / pending — amber */
.pc-badge-warning {
    background: #fffbeb;
    border-color: rgba(217, 119, 6, 0.28);
    color: #b45309;
}

/* Danger / rejected — red */
.pc-badge-danger {
    background: #fef2f2;
    border-color: rgba(220, 38, 38, 0.28);
    color: #b91c1c;
}

/* Info / returned — blue */
.pc-badge-info {
    background: #eff6ff;
    border-color: rgba(37, 99, 235, 0.28);
    color: #1d4ed8;
}

/* Accent — indigo (types / categories) */
.pc-badge-accent {
    background: #eef2ff;
    border-color: rgba(79, 70, 229, 0.28);
    color: #4338ca;
}

/* Pending pipeline list: hide desktop table on mobile.
   Must beat .maintix-bento-shell .pc-module .table-wrap { display: flex !important; } */
.maintix-bento-shell .pc-module .table-wrap.pc-pending-desktop {
    display: none !important;
}

.maintix-bento-shell .pc-module .pc-pending-mobile {
    display: block !important;
}

@media (min-width: 992px) {
    .maintix-bento-shell .pc-module .table-wrap.pc-pending-desktop {
        display: flex !important;
        flex-direction: column !important;
    }

    .maintix-bento-shell .pc-module .pc-pending-mobile {
        display: none !important;
    }
}

/* Neutral — slate */
.pc-badge-neutral {
    background: #f1f5f9;
    border-color: rgba(100, 116, 139, 0.26);
    color: #475569;
}

.pc-badge-soft {
    font-weight: 600;
    background: transparent;
}

