/* Customer order list ([oms_orders]). Tokens are shared with payment.css and admin.css. */
.oms-orders-wrapper,
#oms-toast-container {
    --oms-ink: #111827;
    --oms-text: #374151;
    --oms-muted: #6b7280;
    --oms-line: #e5e7eb;
    --oms-bg: #f7f8fa;
    --oms-surface: #fff;
    --oms-green: #047857;
    --oms-green-bg: #ecfdf5;
    --oms-amber: #92400e;
    --oms-amber-bg: #fef3c7;
    --oms-red: #b91c1c;
    --oms-red-bg: #fef2f2;
    --oms-radius: 10px;
}

body:has(.oms-orders-wrapper) { background: #f7f8fa; }

.oms-orders-wrapper {
    max-width: 1180px;
    margin: 0 auto;
    padding: 32px 20px 96px;
    color: var(--oms-text);
    font-family: Roboto, -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    -webkit-tap-highlight-color: transparent;
}

.oms-orders-wrapper *,
.oms-orders-wrapper *::before,
.oms-orders-wrapper *::after { box-sizing: border-box; }

.oms-icon { width: 16px; height: 16px; flex: none; }

/* The page builder wraps shortcode output in paragraphs and leaves empty ones behind. */
.oms-orders-wrapper p:empty { display: none; }

/* Heading + totals */
.oms-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px 32px;
    margin-bottom: 20px;
}

.oms-orders-wrapper .oms-title {
    margin: 0;
    color: var(--oms-ink);
    font-family: inherit;
    font-size: 24px;
    font-weight: 700;
    line-height: 1.25;
}

.oms-sub { margin: 2px 0 0; color: var(--oms-muted); }

.oms-stats { display: flex; gap: 32px; margin: 0; }
.oms-stats div { min-width: 0; }
.oms-stats dt { color: var(--oms-muted); font-size: 13px; font-weight: 400; }
.oms-stats dd { margin: 0; color: var(--oms-ink); font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Filters */
.oms-filter { margin-bottom: 16px; }

.oms-filter-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
    margin: 0;
}

.oms-filter .filter-group { display: flex; flex-direction: column; gap: 4px; }
.oms-filter label { margin: 0; color: var(--oms-muted); font-size: 13px; font-weight: 400; }

.oms-filter select {
    min-width: 170px;
    height: 40px;
    padding: 0 32px 0 12px;
    color: var(--oms-ink);
    font-family: inherit;
    font-size: max(16px, 1rem);
    background: var(--oms-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center;
    border: 1px solid var(--oms-line);
    border-radius: 8px;
    appearance: none;
}

.oms-filter select:focus-visible { outline: 2px solid var(--oms-ink); outline-offset: 1px; }

/* Table */
.oms-table-container {
    overflow: hidden;
    background: var(--oms-surface);
    border: 1px solid var(--oms-line);
    border-radius: var(--oms-radius);
}

.oms-orders-table { width: 100%; margin: 0; border: 0; border-collapse: collapse; }

.oms-orders-table th {
    padding: 12px 16px;
    color: var(--oms-muted);
    font-size: 13px;
    font-weight: 500;
    text-align: left;
    white-space: nowrap;
    background: #fafafa;
    border: 0;
    border-bottom: 1px solid var(--oms-line);
}

.oms-orders-table td {
    padding: 16px;
    vertical-align: top;
    background: none;
    border: 0;
    border-bottom: 1px solid var(--oms-line);
}

.oms-orders-table tbody tr:last-child td { border-bottom: 0; }
.oms-orders-table .col-checkbox { width: 44px; padding-right: 0; }
.oms-orders-table input[type='checkbox'] { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--oms-ink); cursor: pointer; }
.oms-orders-table .col-code { white-space: nowrap; }
.oms-orders-table .col-code strong { display: block; color: var(--oms-ink); font-weight: 600; }
.oms-orders-table .oms-date { color: var(--oms-muted); font-size: 13px; }
.oms-orders-table .col-reason { min-width: 240px; font-size: 14px; word-break: break-word; }
.oms-orders-table .col-amount { text-align: right; white-space: nowrap; }
.oms-orders-table th.col-amount { text-align: right; }
.amount-value { color: var(--oms-ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.order-row.paid .amount-value { color: var(--oms-muted); font-weight: 500; }
.order-row.paid .col-reason { color: var(--oms-muted); }
.oms-orders-table .col-status { min-width: 220px; }
.oms-orders-table .col-actions { width: 1%; white-space: nowrap; }

.empty-state { padding: 56px 16px !important; color: var(--oms-muted); text-align: center; }

/* Status */
.oms-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 10px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    border-radius: 999px;
}

.oms-pill::before { width: 6px; height: 6px; content: ''; background: currentColor; border-radius: 50%; }
.oms-pill.paid { color: var(--oms-green); background: var(--oms-green-bg); }
.oms-pill.pending { color: var(--oms-amber); background: var(--oms-amber-bg); }
.oms-status-note { margin: 4px 0 0; color: var(--oms-muted); font-size: 13px; line-height: 1.4; white-space: normal; }
.oms-status-note b { color: var(--oms-text); font-weight: 500; }

/* Buttons */
.action-buttons { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }

.btn-pay,
.btn-pay-multiple,
.oms-page-btn,
.btn-copy-modal {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 36px;
    padding: 6px 14px;
    color: var(--oms-ink);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    background: var(--oms-surface);
    border: 1px solid #d1d5db;
    border-radius: 8px;
    transition: background-color .15s, border-color .15s;
}

.btn-pay.btn-primary,
.btn-pay-multiple#btn-pay-selected {
    color: #fff;
    background: var(--oms-ink);
    border-color: var(--oms-ink);
}

.btn-pay:focus-visible,
.btn-pay-multiple:focus-visible,
.oms-page-btn:focus-visible,
.btn-copy-modal:focus-visible { outline: 2px solid var(--oms-ink); outline-offset: 2px; text-decoration: none; }

.btn-pay:active,
.btn-pay-multiple:active,
.oms-page-btn:active { background: #f3f4f6; }

.btn-pay.btn-primary:active,
.btn-pay-multiple#btn-pay-selected:active { background: #374151; }

@media (hover: hover) and (pointer: fine) {
    .btn-pay:hover,
    .btn-pay-multiple:hover,
    .oms-page-btn:hover,
    .btn-copy-modal:hover { color: var(--oms-ink); text-decoration: none; background: #f3f4f6; border-color: #9ca3af; }

    .btn-pay.btn-primary:hover,
    .btn-pay-multiple#btn-pay-selected:hover { color: #fff; background: #374151; border-color: #374151; }
}

/* Pagination */
.oms-pagination-bottom {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 16px;
}

.oms-pagination-info { color: var(--oms-muted); font-size: 14px; }
.oms-pagination-buttons { display: flex; gap: 8px; }

/* Selection bar */
.oms-payment-summary {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 900;
    padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
    background: var(--oms-surface);
    border-top: 1px solid var(--oms-line);
    box-shadow: 0 -4px 16px rgba(17, 24, 39, .06);
}

.summary-content {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 24px;
    max-width: 1140px;
    margin: 0 auto;
}

.summary-info { display: flex; flex-wrap: wrap; gap: 4px 24px; }
.summary-item { color: var(--oms-muted); font-size: 14px; }
.summary-item strong { font-weight: 400; }
.summary-item span { margin-left: 4px; color: var(--oms-ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.summary-actions { display: flex; gap: 8px; }

/* Share dialog */
.oms-share-modal { position: fixed; inset: 0; z-index: 1000; }
.oms-share-modal-overlay { position: absolute; inset: 0; background: rgba(17, 24, 39, .45); }

.oms-share-modal-content {
    position: relative;
    width: min(480px, calc(100% - 32px));
    margin: 12vh auto 0;
    padding: 20px;
    background: var(--oms-surface);
    border-radius: 12px;
    box-shadow: 0 20px 48px rgba(17, 24, 39, .2);
}

.oms-share-modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.oms-orders-wrapper .oms-share-modal-header h3 { margin: 0; color: var(--oms-ink); font-family: inherit; font-size: 17px; font-weight: 600; }

.oms-share-modal-close {
    display: inline-flex;
    padding: 6px;
    color: var(--oms-muted);
    cursor: pointer;
    background: none;
    border: 0;
    border-radius: 6px;
}

.oms-share-modal-body label { display: block; margin-bottom: 6px; color: var(--oms-muted); font-size: 14px; }
.oms-share-input-wrapper { display: flex; gap: 8px; }

.oms-share-input-wrapper input {
    flex: 1;
    min-width: 0;
    height: 40px;
    padding: 0 12px;
    color: var(--oms-ink);
    font-size: max(16px, 1rem);
    background: var(--oms-bg);
    border: 1px solid var(--oms-line);
    border-radius: 8px;
}

.oms-share-status { min-height: 20px; margin-top: 8px; font-size: 14px; }
.oms-share-status.success { color: var(--oms-green); }
.oms-share-status.error { color: var(--oms-red); }
.oms-share-status.copying { color: var(--oms-muted); }

/* Toasts */
#oms-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: calc(100% - 40px);
    font-family: Roboto, -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
}

.oms-toast {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    max-width: 380px;
    padding: 12px 14px;
    color: var(--oms-ink);
    font-size: 14px;
    line-height: 1.4;
    background: var(--oms-surface);
    border: 1px solid var(--oms-line);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(17, 24, 39, .12);
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity .2s, transform .2s;
}

.oms-toast-show { opacity: 1; transform: none; }
.oms-toast-icon { display: inline-flex; margin-top: 1px; }
.oms-toast-success .oms-toast-icon { color: var(--oms-green); }
.oms-toast-error .oms-toast-icon { color: var(--oms-red); }
.oms-toast-warning .oms-toast-icon { color: var(--oms-amber); }
.oms-toast-info .oms-toast-icon { color: var(--oms-muted); }

/* Phones: every row becomes a card */
@media (max-width: 767px) {
    .oms-orders-wrapper { padding: 20px 16px 120px; }
    .oms-stats { gap: 24px; width: 100%; }
    .oms-filter .filter-group { flex: 1 1 140px; }
    .oms-filter select { width: 100%; min-width: 0; }

    .oms-table-container { overflow: visible; background: none; border: 0; }
    .oms-orders-table, .oms-orders-table tbody { display: block; }
    .oms-orders-table thead { display: none; }

    .oms-orders-table .order-row {
        position: relative;
        display: block;
        margin-bottom: 12px;
        padding: 14px 16px;
        background: var(--oms-surface);
        border: 1px solid var(--oms-line);
        border-radius: var(--oms-radius);
    }

    .oms-orders-table .order-row td { display: block; width: auto; min-width: 0; padding: 0; border: 0; }
    .oms-orders-table .order-row .col-checkbox { position: absolute; top: 14px; right: 16px; }
    .oms-orders-table .order-row .col-code { padding-right: 32px; }
    .oms-orders-table .order-row .col-amount { margin-top: 10px; font-size: 18px; text-align: left; }
    .oms-orders-table .order-row .col-reason { margin-top: 10px; }
    .oms-orders-table .order-row .col-status { margin-top: 10px; }
    .oms-orders-table .order-row .col-actions { margin-top: 12px; white-space: normal; }
    .action-buttons { flex-direction: row; flex-wrap: wrap; }
    .action-buttons .btn-pay { flex: 1 1 130px; min-height: 40px; }

    .oms-orders-table .empty-state { display: block; background: var(--oms-surface); border: 1px solid var(--oms-line); border-radius: var(--oms-radius); }
    .summary-actions { width: 100%; }
    .summary-actions .btn-pay-multiple { flex: 1; min-height: 42px; white-space: normal; }
    #oms-toast-container { top: 12px; right: 12px; left: 12px; max-width: none; }
    .oms-toast { max-width: none; }
}
