/* ================================================
   APPROVAL PAGE — Full Scoped CSS (ap- prefix)
   Stat cards match MyBookings mb- pattern exactly
   ================================================ */

/* Header */
.ap-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
}

.ap-header-text h1 {
    font-size: 22px;
    font-weight: 700;
    color: #334155;
    margin: 0 0 4px 0;
}

.ap-header-text p {
    font-size: 13px;
    color: #64748b;
    margin: 0;
}

.ap-header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.ap-btn-outline {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 16px;
    font-size: 13px;
    font-weight: 500;
    color: #475569;
    background-color: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

    .ap-btn-outline:hover {
        background-color: #f8fafc;
        border-color: #94a3b8;
        color: #1e293b;
    }

    .ap-btn-outline svg {
        width: 14px;
        height: 14px;
        flex-shrink: 0;
    }

/* =============================================
   STAT CARDS — mirrors mb-stat-card pattern:
   90deg gradient, border-bottom accent,
   absolutely positioned white icon box (right, centered)
   ============================================= */
.ap-stats-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    margin-bottom: 0;
}

.ap-stat-card {
    border-radius: 8px;
    padding: 16px;
    position: relative; 
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
    min-height: 90px;
    overflow: hidden;
}

.ap-stat-title {
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
    margin-bottom: 8px;
}

.ap-stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 0;
    line-height: 1;
}

/* Absolutely positioned icon box — same as mb-card-icon */
.ap-stat-icon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    right: 16px;
    width: 44px;
    height: 44px;
    background-color: #ffffff;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

    .ap-stat-icon svg {
        width: 20px;
        height: 20px;
        fill: none;
        stroke-width: 1.5;
    }

/* 1. Total Applications — Purple (mirrors mb-card-total) */
.ap-stat-purple {
    background: linear-gradient(90deg, #FAFAFF 0%, #E6E4FF 100%);
    border-left: 3px solid #4F46E5;
}

    .ap-stat-purple .ap-stat-icon svg {
        stroke: #4F46E5;
    }

/* 2. Pending Validation — Orange */
.ap-stat-orange {
    background: linear-gradient(90deg, #FFFAF5 0%, #FFE8CC 100%);
    border-left: 3px solid #EA580C;
}

    .ap-stat-orange .ap-stat-icon svg {
        stroke: #EA580C;
    }

/* 3. Validated by MO — Cyan (mirrors mb-card-upcoming) */
.ap-stat-cyan {
    background: linear-gradient(90deg, #F4FFFF 0%, #D6FBF9 100%);
    border-left: 3px solid #0D9488;
}

    .ap-stat-cyan .ap-stat-icon svg {
        stroke: #0D9488;
    }

/* 4. Rejected — Red (mirrors mb-card-cancelled) */
.ap-stat-red {
    background: linear-gradient(90deg, #FFF5F5 0%, #FEE0E0 100%);
    border-left: 3px solid #DC2626;
}

    .ap-stat-red .ap-stat-icon svg {
        stroke: #DC2626;
    }

/* 5. Completed — Green (mirrors mb-card-completed) */
.ap-stat-green {
    background: linear-gradient(90deg, #F4FDF6 0%, #D3FCE3 100%);
    border-left: 3px solid #16A34A;
}

    .ap-stat-green .ap-stat-icon svg {
        stroke: #16A34A;
    }

/* =============================================
   TABS — underline style
   ============================================= */
.ap-tabs-row {
    display: flex;
    align-items: center;
    background-color: #F1F5F9;
    padding: 6px;
    border-radius: 10px;
    gap: 4px;
    margin-top: 20px;
    margin-bottom: 20px;
    width: fit-content;
}

.ap-tab {
    padding: 9px 22px;
    font-size: 13px;
    font-weight: 500;
    color: #94a3b8;
    background: transparent;
    border: none;
    border-radius: 7px;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

    .ap-tab:hover {
        color: #475569;
    }

    .ap-tab.active {
        background-color: #ffffff;
        color: #0f172a;
        font-weight: 600;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    }
/* =============================================
   TABLE CARD
   ============================================= */
.ap-table-card {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.ap-table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    gap: 16px;
    flex-wrap: wrap;
}

    .ap-table-header h3 {
        font-size: 15px;
        font-weight: 700;
        color: #1e293b;
        margin: 0;
    }

.ap-table-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.ap-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

    .ap-search-wrap svg {
        position: absolute;
        left: 11px;
        width: 14px;
        height: 14px;
        color: #94a3b8;
        pointer-events: none;
    }

    .ap-search-wrap input {
        width: 220px;
        height: 36px;
        padding: 0 12px 0 32px;
        font-size: 13px;
        border: 1px solid #e2e8f0;
        border-radius: 8px;
        background-color: #F3F4F6;
        color: #334155;
        outline: none;
        transition: border-color 0.2s;
    }

        .ap-search-wrap input::placeholder {
            color: #94a3b8;
        }

        .ap-search-wrap input:focus {
            border-color: #94a3b8;
            background-color: #ffffff;
        }

.ap-select {
    height: 36px;
    padding: 0 30px 0 12px;
    font-size: 13px;
    color: #475569;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background-color: #ffffff;
    cursor: pointer;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 13px;
    min-width: 130px;
}

.ap-select-sm {
    height: 32px;
    padding: 0 26px 0 10px;
    font-size: 13px;
    color: #475569;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background-color: #ffffff;
    cursor: pointer;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
    background-size: 12px;
    min-width: 68px;
}

/* Table */
.ap-table-wrap {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid #f1f5f9;
}

.ap-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

/* Fixed layout so the 9 columns always fit the card width and the table
   never pushes the page wider (long columns wrap, compact ones stay single-line). */
.ap-table {
    table-layout: fixed;
}

    .ap-table thead th {
        text-align: left;
        padding: 12px 16px;
        font-size: 12px;
        font-weight: 600;
        color: #64748b;
        background-color: #F2F3F3;
        border-bottom: 1px solid #e2e8f0;
        white-space: normal;
        overflow-wrap: break-word;
        word-break: break-word;
    }

    .ap-table tbody td {
        padding: 15px 16px;
        color: #334155;
        font-size: 13px;
        border-bottom: 1px solid #f1f5f9;
        white-space: normal;
        overflow-wrap: break-word;
        word-break: break-word;
    }

    /* Compact columns keep their content on a single line */
    .ap-table thead th:nth-child(1),
    .ap-table tbody td:nth-child(1),
    .ap-table thead th:nth-child(2),
    .ap-table tbody td:nth-child(2),
    .ap-table thead th:nth-child(6),
    .ap-table tbody td:nth-child(6),
    .ap-table thead th:nth-child(9),
    .ap-table tbody td:nth-child(9) {
        white-space: nowrap;
    }

    .ap-table tbody tr:last-child td {
        border-bottom: none;
    }

    .ap-table tbody tr:hover td {
        background-color: #fafbfc;
    }

.ap-dealer-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ap-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-color: #dbeafe;
    color: #1d4ed8;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ap-td-teal {
    color: #0d9488 !important;
    font-weight: 500;
}

.ap-status {
    display: inline-block;
    padding: 5px 13px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.ap-status-pending {
    background-color: #ffedd5;
    color: #c2410c;
}

.ap-status-validated {
    background-color: #ccfbf1;
    color: #0f766e;
}

.ap-status-rejected {
    background-color: #fee2e2;
    color: #b91c1c;
}

.ap-status-completed {
    background-color: #dcfce7;
    color: #15803d;
}

.ap-row-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.ap-icon-btn {
    background: transparent;
    border: none;
    padding: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: opacity 0.15s, transform 0.15s;
}

    .ap-icon-btn:hover {
        opacity: 0.7;
        transform: scale(1.1);
    }

    .ap-icon-btn svg {
        width: 17px;
        height: 17px;
    }

.ap-icon-view svg {
    stroke: #3b82f6;
}

.ap-icon-edit svg {
    stroke: #ec4899;
}

/* Pagination */
.ap-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid #f1f5f9;
    flex-wrap: wrap;
    gap: 12px;
}

.ap-page-size {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: #64748b;
}

.ap-page-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.ap-page-btn {
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid #e2e8f0;
    background-color: #ffffff;
    color: #475569;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

    .ap-page-btn:hover:not(.active) {
        background-color: #f8fafc;
        border-color: #94a3b8;
    }

    .ap-page-btn.active {
        background-color: #1e293b;
        color: #ffffff;
        border-color: #1e293b;
        font-weight: 600;
    }

.ap-page-arrow svg {
    width: 13px;
    height: 13px;
}

.ap-page-dots {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    font-size: 14px;
    color: #94a3b8;
    letter-spacing: 1px;
    border: none;
    background: transparent;
    cursor: default;
}

/* ================================================
   RESPONSIVE BREAKPOINTS
   ================================================ */

/* Large laptop / small desktop — 4 stats per row */
@media (max-width: 1400px) {
    .ap-stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Tablet landscape — 3 stats per row */
@media (max-width: 1100px) {
    .ap-stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .ap-search-wrap input {
        width: 180px;
    }

    .ap-tabs-row {
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

        .ap-tabs-row::-webkit-scrollbar {
            display: none;
        }
}

/* Tablet portrait — 2 stats, controls stack */
@media (max-width: 860px) {
    .ap-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .ap-table-header {
        flex-direction: column;
        align-items: stretch;
    }

    .ap-table-controls {
        width: 100%;
        flex-wrap: wrap;
    }

    .ap-search-wrap {
        flex: 1;
        min-width: 200px;
    }

        .ap-search-wrap input {
            width: 100%;
        }

    .ap-select {
        flex: 1;
        min-width: 130px;
    }

    /* Tabs become horizontally scrollable to prevent overflow */
    .ap-tabs-row {
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

        .ap-tabs-row::-webkit-scrollbar {
            display: none;
        }

    .ap-tab {
        padding: 8px 16px;
        flex-shrink: 0;
    }
}

/* Mobile — single column, stacked layout */
@media (max-width: 600px) {
    .ap-header-row {
        flex-direction: column;
        gap: 14px;
        align-items: stretch;
    }

    .ap-header-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .ap-btn-outline {
        flex: 1;
        justify-content: center;
        min-width: 80px;
    }

    .ap-stats-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .ap-stat-card {
        padding: 14px 16px;
        min-height: 80px;
    }

    .ap-stat-value {
        font-size: 22px;
    }

    .ap-stat-icon {
        width: 40px;
        height: 40px;
        right: 14px;
    }

        .ap-stat-icon svg {
            width: 18px;
            height: 18px;
        }

    .ap-table-card {
        padding: 16px;
    }

    .ap-table-header h3 {
        font-size: 14px;
    }

    /* Table — let it scroll horizontally on mobile */
    .ap-table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .ap-table {
        min-width: 800px;
    }

        .ap-table thead th,
        .ap-table tbody td {
            padding: 12px 14px;
        }

    /* Pagination: one row - Items Per Page left, pager right - same as the
       other list pages. */
    .ap-pagination {
        flex-direction: row;
        flex-wrap: nowrap;
        justify-content: space-between;
        align-items: center;
        gap: 10px;
    }

    .ap-page-nav {
        flex-wrap: nowrap;
        justify-content: flex-end;
    }
}

/* Very small phones */
@media (max-width: 380px) {
    .ap-header-text h1 {
        font-size: 19px;
    }

    .ap-header-text p {
        font-size: 12px;
    }

    .ap-btn-outline {
        padding: 6px 10px;
        font-size: 12px;
    }

        .ap-btn-outline svg {
            width: 12px;
            height: 12px;
        }

    .ap-tab {
        padding: 8px 14px;
        font-size: 12px;
    }

    .ap-stat-title {
        font-size: 12px;
    }

    .ap-stat-value {
        font-size: 20px;
    }

}
/* Benefit Status Pills (Used in Completed Tab) */
.ap-benefit-pill {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 50px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.ap-benefit-purple {
    background-color: #F3E8FF;
    color: #7E22CE;
}

.ap-benefit-blue {
    background-color: #DBEAFE;
    color: #1D4ED8;
}

.ap-benefit-green {
    background-color: #DCFCE7;
    color: #15803D;
}

/* ================================================
   native: PageHeader adoption (all widths)
   Reproduces the old .ap-header-row look on desktop so the live web is unchanged.
   ================================================ */
.shell-page-header.ap-page-header {
    margin-bottom: 24px;
}

    .shell-page-header.ap-page-header .shell-page-title {
        font-size: 22px;
        font-weight: 700;
        color: #334155;
    }

    .shell-page-header.ap-page-header .shell-page-subtitle {
        font-size: 13px;
        color: #64748b;
        margin-top: 4px;
    }

    .shell-page-header.ap-page-header .shell-page-actions {
        gap: 10px;
    }

/* native: phone */
@media (max-width: 767.98px) {
    .shell-page-header.ap-page-header {
        margin-bottom: 14px;
    }

        .shell-page-header.ap-page-header .shell-page-title {
            font-size: 1.15rem;
        }

        .shell-page-header.ap-page-header .shell-page-subtitle {
            font-size: 12px;
            margin-top: 2px;
        }

        /* Excel / PDF / Print have no handler yet; keep the phone header to one row. */
        .shell-page-header.ap-page-header .shell-page-actions {
            display: none;
        }

    /* Two columns genuinely fit: at 360px each card is ~160px, enough for a
       wrapped title and a 21px value. */
    .ap-stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .ap-stat-card {
        padding: 12px;
        min-height: 68px;
        border-radius: 10px;
    }

    /* The stat icon is absolutely positioned, so the text column has to
       reserve its gutter. Without this a title like "Pending SDWA Admin"
       (~105px) runs under the 32px icon box and is visually clipped. */
    .ap-stat-left {
        min-width: 0;
        padding-right: 32px;
    }

    .ap-stat-title {
        font-size: 11.5px;
        line-height: 1.25;
        margin-bottom: 4px;
        overflow-wrap: anywhere;
    }

    .ap-stat-value {
        font-size: 21px;
    }

    .ap-stat-icon {
        width: 32px;
        height: 32px;
        right: 10px;
        border-radius: 8px;
    }

        .ap-stat-icon svg {
            width: 15px;
            height: 15px;
        }

    /* All seven approval tabs stay visible: they wrap onto further rows
       instead of running off the right edge of a scroller with no affordance.
       `min-width: 0` lets the labels wrap so more tabs fit per row, and
       `flex: 1 1 auto` makes the tabs on each row share the width evenly
       rather than leaving a ragged right edge. */
    .ap-tabs-row {
        width: 100%;
        max-width: 100%;
        overflow-x: visible;
        flex-wrap: wrap;
        gap: 4px;
        margin-top: 14px;
        margin-bottom: 14px;
        padding: 5px;
    }

    .ap-tab {
        flex: 1 1 auto;
        min-width: 0;
        min-height: 44px;
        padding: 8px 10px;
        font-size: 12.5px;
        white-space: normal;
        text-align: center;
    }

    .ap-table-card {
        padding: 14px;
        border-radius: 12px;
    }

    .ap-table-header {
        gap: 10px;
        margin-bottom: 12px;
    }

    /* Search and filter stack full width on every phone width. Left to the
       tablet rules they sat side by side at 430px but stacked at 360px
       (200px + 130px min-widths no longer fit), so the control layout
       changed shape depending on the device. */
    .ap-table-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .ap-search-wrap {
        flex: none;
        width: 100%;
        min-width: 0;
    }

    .ap-select {
        flex: none;
        width: 100%;
        min-width: 0;
    }

    .ap-search-wrap input,
    .ap-select {
        height: 44px;
        font-size: 16px; /* prevents iOS zoom on focus */
    }

    /* Table is replaced by the card list on phones. */
    .ap-table-wrap {
        display: none;
    }

    .ap-cards {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .ap-card {
        background: #ffffff;
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        padding: 13px;
        box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
    }

    .ap-card-head {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 8px;
        flex-wrap: wrap;
    }

    .ap-card-titles {
        min-width: 0;
        flex: 1 1 auto;
    }

    .ap-card-title {
        margin: 0;
        font-size: 15px;
        font-weight: 600;
        color: #0f172a;
        line-height: 1.3;
        overflow-wrap: anywhere;
    }

    .ap-card-sub {
        margin-top: 2px;
        font-size: 12px;
        color: #64748b;
        overflow-wrap: anywhere;
    }

    /* Long labels such as "Approved by SDWA Admin" are ~130px, which used to
       squeeze the dealer name into a narrow column. The badge now wraps to
       its own line, still right-aligned, and its text can break. */
    .ap-card-head .ap-status {
        flex-shrink: 0;
        margin-left: auto;
        max-width: 100%;
        white-space: normal;
        text-align: right;
    }

    .ap-card-rows {
        margin: 10px 0 0;
        display: grid;
        gap: 7px;
    }

    .ap-card-row {
        display: flex;
        justify-content: space-between;
        gap: 12px;
        font-size: 12.5px;
        line-height: 1.4;
    }

        .ap-card-row dt {
            color: #64748b;
            font-weight: 500;
            flex-shrink: 0;
        }

        .ap-card-row dd {
            margin: 0;
            text-align: right;
            color: #1e293b;
            font-weight: 500;
            overflow-wrap: anywhere;
        }

    /* Approval flow (MO → RM → SM → SDWA → SDWA Admin) as a soft inset
       panel. The five nodes and their labels fit inside the card width, so
       the stepper is centred as one unit rather than spread with
       space-between, which would pull the 14px connector lines away from the
       nodes they join. The scroller stays as a safety net for longer labels. */
    .ap-card-flow {
        margin-top: 12px;
        padding: 10px 8px;
        border-top: none;
        background: #f8fafc;
        border: 1px solid #f1f5f9;
        border-radius: 8px;
        overflow-x: auto;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

        .ap-card-flow .ap-flow {
            display: flex;
            width: 100%;
            justify-content: center;
        }

        .ap-card-flow .ap-flow-label {
            font-size: 0.6rem;
        }

    .ap-card-actions {
        display: flex;
        margin-top: 10px;
    }

    /* Scoped to .ap-card-btn rather than .ap-btn-outline: the base class is
       also used by ApprovalDetail's top bar, which overrides it with a
       higher-specificity .mo-approval-topbar rule. */
    .ap-card-btn {
        flex: 1 1 auto;
        width: 100%;
        justify-content: center;
        min-height: 46px;
        font-size: 14px;
        font-weight: 600;
        border-radius: 8px;
    }

    /* One row, same as the other list pages. Shrinking the arrows to 28px
       (instead of the old 44px) is what makes "Items Per Page" + select and
       the two arrows + page label fit together on a 360px screen without
       wrapping. */
    .ap-pagination {
        flex-direction: row;
        flex-wrap: nowrap;
        justify-content: space-between;
        align-items: center;
        gap: 8px;
        margin-top: 14px;
        padding-top: 14px;
    }

    .ap-page-size {
        gap: 6px;
        font-size: 12px;
        white-space: nowrap;
    }

    .ap-page-nav {
        justify-content: flex-end;
        flex-wrap: nowrap;
        gap: 6px;
    }

    .ap-page-btn {
        min-width: 28px;
        height: 28px;
        border-radius: 6px;
        flex: 0 0 auto;
    }

    .ap-page-dots {
        font-size: 11px;
        white-space: nowrap;
    }

    .ap-select-sm {
        height: 32px;
    }

    /* .ap-error-state carries no stylesheet rule at all, so on a phone the
       message and Retry button rendered as bare inline text. Scoped to the
       phone breakpoint to leave the desktop rendering exactly as it is. */
    .ap-error-state {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 12px;
        padding: 20px 16px;
        text-align: center;
        font-size: 13px;
        line-height: 1.5;
        color: #991b1b;
        background: #fef2f2;
        border: 1px solid #fecaca;
        border-radius: 12px;
    }

    .ap-error-state .ap-btn-outline {
        width: 100%;
        min-height: 44px;
        justify-content: center;
    }
}

/* Small phones (≈320-360px). The 2-up stat grid and the wrapped tab rows are
   kept — at 360px a stat card is still ~150px, which fits the icon, a wrapped
   title and the value. Only padding and the type scale come down a step. */
@media (max-width: 380px) {
    .shell-page-header.ap-page-header {
        margin-bottom: 12px;
    }

    .ap-stat-card {
        padding: 10px;
        min-height: 62px;
    }

    /* Gutter shrinks with the icon box so the title keeps its room. */
    .ap-stat-left {
        padding-right: 28px;
    }

    .ap-stat-title {
        font-size: 11px;
    }

    .ap-stat-value {
        font-size: 19px;
    }

    .ap-stat-icon {
        width: 28px;
        height: 28px;
        right: 8px;
    }

        .ap-stat-icon svg {
            width: 14px;
            height: 14px;
        }

    .ap-tabs-row {
        margin-top: 12px;
        margin-bottom: 12px;
        padding: 4px;
        gap: 4px;
    }

    .ap-tab {
        padding: 8px;
        font-size: 12px;
    }

    .ap-table-card {
        padding: 12px;
    }

    .ap-card {
        padding: 11px;
    }

    .ap-card-title {
        font-size: 14px;
    }

    .ap-card-rows {
        gap: 6px;
    }

    .ap-card-row {
        font-size: 12px;
    }
}

