/* ---- BASE ---- */
.jcp2p-shortcode-container,
.jcp2p-checkout-wrapper,
.jcp2p-agent-portal,
#jcp2p-modal {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    box-sizing: border-box;
    --primary: #0f172a;
    --accent: #3b82f6;
    --accent-bg: rgba(59,130,246,0.08);
    --success: #10b981;
    --success-bg: #ecfdf5;
    --warning: #f59e0b;
    --warning-bg: #fffbeb;
    --danger: #ef4444;
    --danger-bg: #fef2f2;
    --border: #e2e8f0;
    --text-muted: #64748b;
    --surface: #f8fafc;
}

*, *::before, *::after { box-sizing: inherit; }

/* ---- NAV BAR ---- */
.jcp2p-nav-bar { margin-bottom: 20px; }
.jcp2p-back-action-link {
    display: inline-flex; align-items: center; gap: 6px;
    color: #475569; text-decoration: none; font-size: 14px; font-weight: 600;
    background: #f1f5f9; padding: 8px 14px; border-radius: 8px;
    transition: background 0.2s;
}
.jcp2p-back-action-link:hover { background: #e2e8f0; }

/* ---- RESUME BANNER ---- */
.jcp2p-resume-banner {
    background: #fff7ed; border: 1px solid #ffedd5; border-left: 4px solid #ea580c;
    border-radius: 12px; padding: 16px 20px; margin-bottom: 28px;
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 14px;
}
.jcp2p-resume-banner h4 { margin: 0 0 4px 0; color: #c2410c; font-size: 15px; font-weight: 700; }
.jcp2p-resume-banner p { margin: 0; color: #9a3412; font-size: 13px; }
.jcp2p-resume-btn {
    background: #ea580c; color: #fff; text-decoration: none;
    padding: 10px 16px; border-radius: 8px; font-size: 13px; font-weight: 600;
    white-space: nowrap; transition: opacity 0.2s;
}
.jcp2p-resume-btn:hover { opacity: 0.9; }

/* ---- SECTION HEADER ---- */
.jcp2p-section-header { margin-bottom: 24px; }
.jcp2p-section-header h2 { margin: 0 0 8px 0; font-size: 22px; font-weight: 700; color: var(--primary); }
.jcp2p-section-header p { margin: 0; color: var(--text-muted); font-size: 15px; line-height: 1.5; }

/* ---- AGENT CARDS GRID ---- */
.jcp2p-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 18px;
    margin-top: 10px;
}
.jcp2p-card {
    background: #fff; border: 1px solid var(--border); border-radius: 18px;
    padding: 22px; transition: all 0.25s;
    position: relative; overflow: hidden;
}
.jcp2p-card:hover { transform: translateY(-3px); box-shadow: 0 10px 25px rgba(15,23,42,0.07); border-color: #cbd5e1; }
.jcp2p-card-offline { opacity: 0.55; pointer-events: auto; }
.jcp2p-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.jcp2p-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.jcp2p-card h3 { margin: 0 0 6px 0; font-size: 17px; font-weight: 700; }
.jcp2p-fee-tag { font-size: 13px; color: var(--text-muted); margin: 0 0 18px 0; }
.jcp2p-fee-tag span { color: var(--success); font-weight: 700; background: var(--success-bg); padding: 2px 8px; border-radius: 6px; }

/* ---- BUTTONS ---- */
.jcp2p-card button,
#jcp2p-submit,
#jcp2p-paid-btn,
.jcp2p-open-modal,
#jcp2p-send-chat-btn,
.jcp2p-portal-approve-btn,
.jcp2p-btn-primary {
    display: block; width: 100%; padding: 13px 18px;
    border-radius: 12px; border: none; cursor: pointer;
    font-size: 14px; font-weight: 600; color: #fff;
    background: linear-gradient(135deg, #1e293b, var(--primary));
    box-shadow: 0 4px 12px rgba(15,23,42,0.12);
    transition: all 0.2s; text-align: center;
}
.jcp2p-card button:hover, #jcp2p-submit:hover, .jcp2p-btn-primary:hover,
#jcp2p-paid-btn:hover, .jcp2p-portal-approve-btn:hover {
    opacity: 0.92; transform: translateY(-1px); box-shadow: 0 6px 16px rgba(15,23,42,0.2);
}
.jcp2p-card button:disabled { background: #94a3b8; cursor: not-allowed; transform: none; box-shadow: none; }
#jcp2p-paid-btn, .jcp2p-btn-primary { background: linear-gradient(135deg, var(--accent), #1d4ed8); box-shadow: 0 4px 14px rgba(59,130,246,0.25); }
.jcp2p-portal-approve-btn, .jcp2p-btn-approve {
    background: linear-gradient(135deg, var(--success), #059669);
    box-shadow: 0 4px 14px rgba(16,185,129,0.25);
    border-radius: 10px; padding: 11px 16px; font-size: 13px;
    font-weight: 700; border: none; cursor: pointer; color: #fff;
    transition: all 0.2s; white-space: nowrap;
}
.jcp2p-btn-danger {
    background: var(--danger); color: #fff; border: none;
    border-radius: 10px; padding: 11px 16px; font-size: 13px;
    font-weight: 600; cursor: pointer; transition: all 0.2s; white-space: nowrap;
}
.jcp2p-btn-danger:hover { background: #b91c1c; }
/* NEW: Agent cancel button */
.jcp2p-btn-agent-cancel {
    background: #fff; color: #475569; border: 1.5px solid #cbd5e1;
    border-radius: 10px; padding: 11px 16px; font-size: 13px;
    font-weight: 600; cursor: pointer; transition: all 0.2s; white-space: nowrap;
}
.jcp2p-btn-agent-cancel:hover { background: #f8fafc; border-color: #94a3b8; color: #0f172a; }
.jcp2p-btn-dispute {
    background: var(--danger); color: #fff; border: none;
    border-radius: 8px; padding: 9px 14px; font-size: 12px;
    font-weight: 600; cursor: pointer; white-space: nowrap;
}
/* Side panel small action buttons */
.jcp2p-btn-danger-sm {
    width: 100%; padding: 9px 12px; background: var(--danger); color: #fff;
    border: none; border-radius: 8px; font-size: 12px; font-weight: 600;
    cursor: pointer; transition: background 0.2s;
}
.jcp2p-btn-agent-cancel-sm {
    width: 100%; padding: 9px 12px; background: #fff; color: #475569;
    border: 1.5px solid #cbd5e1; border-radius: 8px; font-size: 12px;
    font-weight: 600; cursor: pointer; transition: all 0.2s;
}
.jcp2p-btn-agent-cancel-sm:hover { background: #f8fafc; border-color: #94a3b8; }

/* ---- MODAL ---- */
#jcp2p-modal {
    display: none; position: fixed; inset: 0;
    background: rgba(15,23,42,0.55); backdrop-filter: blur(5px);
    z-index: 999998;
    /* FIX: Use flex with scroll for small screens */
    display: none;
    overflow-y: auto;
}
/* When shown, use flex */
#jcp2p-modal.jcp2p-modal-open {
    display: flex !important;
    align-items: flex-start;
    justify-content: center;
    padding: 20px;
}
.jcp2p-modal-content {
    background: #fff; width: 100%; max-width: 440px;
    margin: auto;
    padding: 28px 24px; border-radius: 20px; position: relative;
}
.jcp2p-modal-close {
    position: absolute; top: 16px; right: 16px; cursor: pointer;
    font-size: 22px; color: #94a3b8; background: none; border: none;
    padding: 0; line-height: 1;
}
.jcp2p-modal-content h2 { margin: 0 0 6px 0; font-size: 20px; font-weight: 700; color: var(--primary); }
.jcp2p-modal-sub { color: var(--text-muted); font-size: 13px; margin: 0 0 18px 0; }
.jcp2p-modal-content label { display: block; font-size: 12px; font-weight: 600; color: #475569; margin-bottom: 4px; }
.jcp2p-modal-content input,
.jcp2p-modal-content select {
    width: 100%; padding: 11px 14px; margin-bottom: 14px;
    border-radius: 10px; border: 1px solid #cbd5e1;
    background: var(--surface); font-size: 14px; outline: none;
}
.jcp2p-modal-content input:focus,
.jcp2p-modal-content select:focus { border-color: var(--accent); background: #fff; }
.jcp2p-hint { color: var(--text-muted); font-size: 11px; display: block; margin: -10px 0 14px 0; }
#jcp2p-response { margin-top: 10px; color: var(--danger); font-weight: 600; font-size: 13px; }

/* ---- STATUS BADGES ---- */
.jcp2p-status {
    display: inline-block; padding: 5px 12px; border-radius: 8px;
    font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em;
}
.status-pending    { background: var(--warning-bg); color: #b45309; }
.status-payment_sent { background: var(--accent-bg); color: var(--accent); }
.status-completed  { background: var(--success-bg); color: #047857; }
.status-cancelled  { background: #f1f5f9; color: #475569; }
.status-expired    { background: var(--danger-bg); color: #b91c1c; }
.status-disputed   { background: var(--danger-bg); color: #b91c1c; border: 1px solid #fca5a5; }
.status-online     { background: var(--success-bg); color: #047857; }
.status-offline    { background: #f1f5f9; color: #64748b; }

/* ---- CHECKOUT WRAPPER ---- */
.jcp2p-checkout-wrapper {
    width: 100%; max-width: 860px; margin: 30px auto;
    background: #fff; padding: 28px 24px;
    border-radius: 20px; border: 1px solid var(--border);
}
.jcp2p-checkout-header {
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; gap: 12px;
}
.jcp2p-checkout-header h2 { margin: 0; font-size: 18px; font-weight: 700; color: var(--primary); word-break: break-all; }
.jcp2p-order-ref { color: var(--accent); }
.jcp2p-divider { height: 1px; background: var(--border); margin: 18px 0; }

/* ---- COUNTDOWN ---- */
.jcp2p-countdown-banner {
    padding: 13px 16px; background: #fff7ed; border: 1px solid #ffedd5;
    border-radius: 10px; color: #c2410c; font-weight: 600;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    font-size: 14px; margin-bottom: 18px;
}
#jcp2p-timer { font-variant-numeric: tabular-nums; font-size: 16px; font-weight: 800; }
.pulse-dot {
    height: 8px; width: 8px; background: #ea580c; border-radius: 50%; display: inline-block;
    animation: corePulse 1.5s infinite ease-in-out;
}
@keyframes corePulse {
    0%   { transform: scale(0.8); opacity: 0.5; }
    50%  { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(0.8); opacity: 0.5; }
}
.jcp2p-instructions { padding: 12px 16px; background: #f0f9ff; border-radius: 8px; font-size: 14px; color: #0369a1; margin-bottom: 16px; }

/* ---- CHECKOUT TABLE ---- */
.jcp2p-checkout-table { width: 100%; border-collapse: collapse; margin-top: 14px; }
.jcp2p-checkout-table th, .jcp2p-checkout-table td { padding: 11px 12px; border-bottom: 1px solid #f1f5f9; font-size: 14px; text-align: left; }
.jcp2p-checkout-table th { font-weight: 600; color: var(--text-muted); width: 42%; }
.jcp2p-total-row th, .jcp2p-total-row td { border-bottom: 2px solid var(--primary); background: var(--surface); }
.jcp2p-total-amount { font-weight: 700; color: var(--accent); font-size: 17px; }
.jcp2p-fee-col { color: var(--danger); }
.jcp2p-credit-col { color: var(--success); font-weight: 700; }
.jcp2p-sub-label { color: var(--text-muted); font-size: 12px; }
.jcp2p-provider-badge { background: #f1f5f9; color: var(--primary); padding: 3px 10px; border-radius: 6px; font-weight: 700; font-size: 12px; }

/* ---- COPY FLEX ---- */
.jcp2p-copy-flex { display: flex; align-items: center; gap: 10px; flex-wrap: nowrap; }
.jcp2p-copy-btn {
    flex-shrink: 0;
    padding: 6px 12px !important; font-size: 11px !important;
    background: #f1f5f9 !important; color: var(--primary) !important;
    border: 1px solid #cbd5e1 !important; border-radius: 6px !important;
    box-shadow: none !important; cursor: pointer; width: auto !important;
    font-weight: 600; transition: all 0.15s;
}
.jcp2p-copy-btn.copied { background: var(--success-bg) !important; color: var(--success) !important; border-color: #a7f3d0 !important; }

/* ---- ACTION ROWS ---- */
.jcp2p-action-row { display: flex; gap: 10px; margin-top: 24px; flex-wrap: wrap; }
.jcp2p-action-row .jcp2p-btn-primary { flex: 2; min-width: 180px; }
.jcp2p-action-row .jcp2p-btn-danger  { flex: 1; min-width: 110px; display: flex; align-items: center; justify-content: center; }
#checkout-action-response { margin-top: 10px; font-size: 13px; }

/* ---- SUMMARY BOX ---- */
.jcp2p-summary-box { padding: 18px 20px; border-radius: 14px; text-align: center; margin-bottom: 20px; }
.jcp2p-summary-box h3 { margin: 0 0 8px 0; font-size: 17px; font-weight: 700; }
.jcp2p-summary-box p { margin: 0; font-size: 14px; line-height: 1.5; }
.state-payment_sent { background: var(--accent-bg); color: #1e40af; }
.state-completed    { background: var(--success-bg); color: #065f46; }
.state-disputed     { background: var(--danger-bg); color: #991b1b; border: 1px solid #fca5a5; }
.state-cancelled, .state-expired { background: #f1f5f9; color: #334155; }
.jcp2p-dispute-reason-box { background: #fff; border: 1px solid #fca5a5; border-radius: 8px; padding: 10px 12px; font-size: 13px; color: #991b1b; text-align: left; margin-top: 10px; }

/* ---- DISPUTE ZONE ---- */
.jcp2p-dispute-trigger-zone {
    margin-top: 22px; padding: 16px; background: #fff5f5;
    border: 1px solid #fee2e2; border-radius: 12px;
}
.jcp2p-dispute-trigger-zone h4 { margin: 0 0 5px 0; color: #991b1b; font-size: 14px; }
.jcp2p-dispute-trigger-zone p { font-size: 12px; color: #7f1d1d; margin: 0 0 10px 0; }
.jcp2p-dispute-input-row { display: flex; gap: 10px; flex-wrap: wrap; }
.jcp2p-dispute-input-row input { flex: 1; min-width: 150px; padding: 9px 12px; font-size: 13px; border-radius: 8px; border: 1px solid #fca5a5; outline: none; }
.jcp2p-dispute-notice { margin: 0 0 14px 0; background: #fffbeb; border-left: 4px solid #d97706; padding: 10px 14px; font-size: 13px; color: #92400e; border-radius: 0 8px 8px 0; }

/* ---- AGENT ACTION BOX ---- */
.jcp2p-agent-action-box {
    margin-top: 28px; padding: 20px 22px;
    border: 1px solid var(--border); background: var(--surface); border-radius: 16px;
}
.jcp2p-agent-action-box h3 { margin: 0 0 6px 0; color: var(--primary); font-size: 16px; }
.jcp2p-agent-action-box p { color: var(--text-muted); font-size: 13px; margin: 0 0 16px 0; }
.jcp2p-agent-btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.jcp2p-agent-btn-row .jcp2p-btn-approve { flex: 2; min-width: 180px; }
.jcp2p-agent-btn-row .jcp2p-btn-danger  { min-width: 110px; }
.jcp2p-agent-btn-row .jcp2p-btn-agent-cancel { min-width: 120px; }
#agent-action-response { margin-top: 10px; font-size: 13px; }

/* ---- CHAT ---- */
.jcp2p-customer-chat-section { margin-top: 32px; border-top: 1px solid #f1f5f9; padding-top: 22px; }
.jcp2p-customer-chat-section h3 { margin-bottom: 14px; color: var(--primary); font-size: 16px; }

.jcp2p-chat-box {
    border: 1px solid var(--border); border-radius: 12px; background: var(--surface);
    padding: 12px; overflow-y: auto; display: flex; flex-direction: column;
    gap: 8px; min-height: 180px; max-height: 260px;
}

.jcp2p-chat-bubble { max-width: 80%; padding: 9px 13px; border-radius: 14px; font-size: 13px; line-height: 1.45; word-break: break-word; }

/* USER: Customize these colors (e.g., deep blue) */
.msg-me { background: #1e3a8a; color: #fff; align-self: flex-end; border-bottom-right-radius: 3px; }

/* AGENT: Customize these colors (e.g., light gray/green) */
.msg-them { background: #dcfce7; color: #064e3b; align-self: flex-start; border-bottom-left-radius: 3px; }

.chat-time { font-size: 9px; opacity: 0.55; text-align: right; margin-top: 4px; }
.no-msg-hint { text-align: center; color: #94a3b8; font-size: 12px; margin: auto; }

/* FIXED INPUT AREA */
.jcp2p-chat-input-area {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden; /* prevents overflow */
}

.jcp2p-chat-input-area input {
    flex: 1;
    min-width: 0; /* VERY important for flex overflow */
    width: 100%;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid #cbd5e1;
    font-size: 13px;
    outline: none;
    box-sizing: border-box;
}

.jcp2p-chat-input-area button {
    flex: 0 0 auto;
    max-width: 100px; /* stop oversized button */
    padding: 10px 16px;
    border-radius: 10px;
    border: none;
    background: var(--primary);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    box-sizing: border-box;
}
	/* ---- TRANSACTION HISTORY TABLE ---- */
.jcp2p-user-history-section { margin-top: 44px; }
.jcp2p-user-history-section h3 { color: var(--primary); font-weight: 700; font-size: 17px; margin-bottom: 14px; }
.jcp2p-table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--border); border-radius: 14px; }
.jcp2p-history-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 520px; }
.jcp2p-history-table thead tr { background: var(--surface); border-bottom: 1px solid var(--border); }
.jcp2p-history-table th { padding: 13px 14px; font-weight: 600; color: #475569; text-align: left; }
.jcp2p-history-table td { padding: 13px 14px; border-bottom: 1px solid #f8fafc; vertical-align: middle; }
.jcp2p-ts { color: #94a3b8; }
.jcp2p-empty-row { text-align: center; padding: 30px; color: #94a3b8; }
.jcp2p-track-link { color: var(--accent); text-decoration: none; font-weight: 600; }
.jcp2p-track-link:hover { text-decoration: underline; }

/* ---- PAGINATION ---- */
.jcp2p-pagination { margin-top: 18px; display: flex; gap: 8px; flex-wrap: wrap; }
.jcp2p-page-btn {
    padding: 6px 12px; border-radius: 7px; text-decoration: none;
    font-size: 13px; font-weight: 600; color: var(--primary);
    border: 1px solid #cbd5e1; background: #fff; transition: all 0.15s;
}
.jcp2p-page-btn.active, .jcp2p-page-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---- ACCESS DENIED ---- */
.jcp2p-access-denied { text-align: center; padding: 40px 20px; }
.jcp2p-access-denied h3 { color: var(--danger); margin-top: 0; }
.jcp2p-error-msg { color: var(--danger); font-weight: 600; }

/* ---- AGENT PORTAL ---- */
.jcp2p-agent-portal {
    width: 100%; background: #fff; padding: 24px 22px;
    border-radius: 18px; border: 1px solid var(--border);
}
.jcp2p-portal-header {
    display: flex; justify-content: space-between; align-items: flex-start;
    margin-bottom: 24px; border-bottom: 1px solid #f1f5f9;
    padding-bottom: 18px; flex-wrap: wrap; gap: 14px;
}
.jcp2p-portal-header h2 { margin: 0 0 4px 0; font-size: 20px; font-weight: 700; }
.jcp2p-portal-header p  { margin: 0; color: var(--text-muted); font-size: 13px; }
.jcp2p-status-toggle-btn { padding: 10px 16px; border-radius: 10px; border: none; font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.status-is-online  { background: #fee2e2; color: #b91c1c; }
.status-is-offline { background: var(--success-bg); color: #065f46; }

/* ---- STATS GRID ---- */
.jcp2p-stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 28px; }
.jcp2p-stat-card {
    background: #fff; border-radius: 14px; padding: 18px 20px;
    display: flex; align-items: center; justify-content: space-between;
    border: 1px solid var(--border); box-shadow: 0 2px 6px rgba(0,0,0,0.03);
}
.jcp2p-stat-card > div p { margin: 0; font-size: 11px; font-weight: 600; text-transform: uppercase; }
.jcp2p-stat-card > div h2 { margin: 7px 0 0 0; font-size: 20px; font-weight: 800; }
.jcp2p-stat-card > span { font-size: 18px; width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.stat-blue { border-color: #e0f2fe; }
.stat-blue > div p { color: #0369a1; }
.stat-blue > div h2 { color: #0284c7; }
.stat-blue > span { background: #e0f2fe; }
.stat-red  { border-color: #fee2e2; }
.stat-red  > div p { color: #991b1b; }
.stat-red  > div h2 { color: #dc2626; }
.stat-red  > span  { background: #fee2e2; }
.stat-slate { border-color: var(--border); }
.stat-slate > div p { color: #475569; }
.stat-slate > div h2 { color: var(--primary); }
.stat-slate > span  { background: #f1f5f9; }

/* ---- QUEUE TITLE ---- */
.jcp2p-queue-title { color: var(--primary); font-size: 16px; font-weight: 700; margin-bottom: 14px; }

/* ---- SPLIT WORKSPACE ---- */
.jcp2p-split-workspace { display: flex; gap: 22px; align-items: flex-start; width: 100%; }
.jcp2p-workspace-left  { flex: 1.3; min-width: 0; }
.jcp2p-workspace-right {
    flex: 1; border: 1px solid var(--border); border-radius: 16px;
    background: var(--surface); padding: 18px;
    position: sticky; top: 20px; min-height: 380px; min-width: 0;
    overflow-y: auto; max-height: calc(100vh - 60px);
}
.jcp2p-table-scroll-wrap { overflow-x: auto; width: 100%; }

/* ---- PORTAL TABLE ---- */
.jcp2p-portal-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 13px; min-width: 300px; }
.jcp2p-portal-table thead tr { background: var(--surface); }
.jcp2p-portal-table th { padding: 11px 13px; font-weight: 600; color: #475569; }
.jcp2p-portal-table td { padding: 12px 13px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.jcp2p-clickable-order-row { cursor: pointer; transition: background 0.15s; }
.jcp2p-clickable-order-row:hover { background: #f8fafc; }
.active-panel-row { background: var(--accent-bg) !important; border-left: 3px solid var(--accent); }
.jcp2p-mini-network { font-size: 11px; color: #94a3b8; font-weight: 500; }

/* ---- SIDE PANEL ---- */
.jcp2p-panel-placeholder-hint { display: flex; align-items: center; justify-content: center; min-height: 300px; text-align: center; color: #94a3b8; font-size: 14px; }
.jcp2p-panel-details h4 { margin: 0 0 8px 0; color: var(--primary); font-size: 15px; }
.jcp2p-panel-actions { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.jcp2p-panel-chat { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 14px; }
.jcp2p-panel-chat h4 { margin: 0 0 10px 0; color: var(--primary); font-size: 14px; }

/* ---- ALERT BANNER ---- */
#jcp2p-live-alert-banner {
    background: linear-gradient(135deg, #1e3a8a, var(--primary));
    border-radius: 12px; padding: 13px 18px; margin-bottom: 22px;
    box-shadow: 0 4px 12px rgba(30,58,138,0.2);
}
.jcp2p-alert-inner { display: flex; justify-content: space-between; align-items: center; color: #fff; font-size: 13px; font-weight: 600; flex-wrap: wrap; gap: 10px; }
.jcp2p-alert-refresh-btn { background: var(--accent); border: none; color: #fff; padding: 6px 14px; border-radius: 6px; cursor: pointer; font-size: 12px; font-weight: 700; transition: background 0.2s; }
.jcp2p-alert-refresh-btn:hover { background: #2563eb; }

/* ---- NOTIFICATION TOGGLE (floating) ---- */
.jcp2p-notif-toggle-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99998;
    background: #0f172a;
    color: #fff;
    border: none;
    padding: 10px 16px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(15,23,42,0.25);
    transition: transform 0.15s, background 0.2s;
}
.jcp2p-notif-toggle-btn:hover { background: #1e293b; transform: translateY(-1px); }

@media (max-width: 600px) {
    .jcp2p-notif-toggle-btn { bottom: 14px; right: 14px; padding: 9px 13px; font-size: 12px; }
}

/* ================================================================
   RESPONSIVE — MOBILE FIRST
   All breakpoints use max-width so they cascade correctly.
================================================================ */

/* ---- Tablet (≤900px) ---- */
@media (max-width: 900px) {
    .jcp2p-split-workspace {
        flex-direction: column;
    }
    .jcp2p-workspace-left,
    .jcp2p-workspace-right {
        flex: none;
        width: 100%;
    }
    .jcp2p-workspace-right {
        position: static;
        top: unset;
        max-height: none;
        min-height: auto;
        margin-top: 20px;
    }
    .jcp2p-stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    }
}

/* ---- Mobile (≤640px) ---- */
@media (max-width: 640px) {
    /* Checkout wrapper — tighter padding */
    .jcp2p-checkout-wrapper {
        padding: 18px 14px;
        margin: 14px auto;
        border-radius: 14px;
    }

    /* Agent portal — tighter padding */
    .jcp2p-agent-portal {
        padding: 16px 14px;
        border-radius: 14px;
    }

    /* Portal header: stack vertically */
    .jcp2p-portal-header {
        flex-direction: column;
        align-items: flex-start;
    }

    /* Stats: single column */
    .jcp2p-stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    .jcp2p-stat-card { padding: 14px 14px; }
    .jcp2p-stat-card > div h2 { font-size: 17px; }

    /* Checkout table: allow text wrap */
    .jcp2p-checkout-table th,
    .jcp2p-checkout-table td {
        padding: 9px 8px;
        font-size: 13px;
        word-break: break-word;
    }
    .jcp2p-checkout-table th { width: auto; }

    /* Copy flex: allow wrap on very small screens */
    .jcp2p-copy-flex { flex-wrap: wrap; }

    /* Action row: stack buttons */
    .jcp2p-action-row {
        flex-direction: column;
    }
    .jcp2p-action-row .jcp2p-btn-primary,
    .jcp2p-action-row .jcp2p-btn-danger {
        flex: none;
        width: 100%;
    }

    /* Agent button row: stack */
    .jcp2p-agent-btn-row {
        flex-direction: column;
    }
    .jcp2p-agent-btn-row .jcp2p-btn-approve,
    .jcp2p-agent-btn-row .jcp2p-btn-danger,
    .jcp2p-agent-btn-row .jcp2p-btn-agent-cancel {
        min-width: unset;
        width: 100%;
    }

    /* Dispute input row: stack */
    .jcp2p-dispute-input-row { flex-direction: column; }
    .jcp2p-dispute-input-row input,
    .jcp2p-dispute-input-row .jcp2p-btn-dispute { width: 100%; }

    /* Resume banner: stack */
    .jcp2p-resume-banner { flex-direction: column; align-items: flex-start; }

    /* Card grid: single column */
    .jcp2p-grid { grid-template-columns: 1fr; gap: 14px; }

    /* Modal: occupy most of screen */
    .jcp2p-modal-content {
        padding: 22px 16px;
        border-radius: 16px;
    }

    /* History table scroll hint */
    .jcp2p-table-wrap { -webkit-overflow-scrolling: touch; }

    /* Section header */
    .jcp2p-section-header h2 { font-size: 18px; }

    /* Chat box smaller on mobile */
    .jcp2p-chat-box { min-height: 140px; max-height: 200px; }

    /* Pagination: smaller buttons */
    .jcp2p-page-btn { padding: 5px 9px; font-size: 12px; }
}

/* ---- Very small (≤380px) ---- */
@media (max-width: 380px) {
    .jcp2p-stats-grid { grid-template-columns: 1fr; }
    .jcp2p-checkout-wrapper, .jcp2p-agent-portal { padding: 14px 10px; }
    .jcp2p-copy-flex { flex-direction: column; align-items: flex-start; }
    .jcp2p-copy-btn { align-self: flex-start; }
}
