/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header Styles */
.main-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #667eea;
}

.logo i {
    font-size: 2rem;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.main-nav ul {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.main-nav a {
    text-decoration: none;
    color: #555;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.main-nav a:hover,
.main-nav a.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

/* Main Content */
.main-content {
    padding: 2rem 0;
    min-height: calc(100vh - 200px);
}

/* Betslip Styles */
.betslip-container {
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    padding: 2rem;
    margin-bottom: 2rem;
}

.betslip-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.betslip-header h2 {
    color: #667eea;
    font-size: 1.8rem;
}

.match-time-input {
    display: flex;
    align-items: center;
    gap: 10px;
}

.match-time-input label {
    font-weight: 600;
    color: #555;
}

.match-time-input input[type="datetime-local"] {
    padding: 0.5rem 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.match-time-input input[type="datetime-local"]:focus {
    outline: none;
    border-color: #667eea;
}

/* Betslip Grid */
.betslip-grid {
    display: grid;
    grid-template-columns: 150px repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.grid-header {
    font-weight: 700;
    color: white;
    padding: 1rem;
    text-align: center;
    border-radius: 8px;
    font-size: 1.1rem;
}

.grid-header:nth-child(1) {
    background: transparent;
}

.grid-header:nth-child(2) {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
}

.grid-header:nth-child(3) {
    background: linear-gradient(135deg, #FFC107 0%, #FFA000 100%);
}

.grid-header:nth-child(4) {
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
}

.grid-label {
    display: flex;
    align-items: center;
    font-weight: 600;
    color: #555;
    padding: 0.5rem;
}

.grid-input {
    padding: 0.5rem;
}

.grid-input input[type="text"],
.grid-input input[type="number"],
.grid-input select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.grid-input input:focus,
.grid-input select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.grid-input select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23667eea' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 35px;
}

.grid-output {
    padding: 0.75rem;
    background: linear-gradient(135deg, #f5f7fa 0%, #e9ecef 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    color: #667eea;
    border: 2px solid #e0e0e0;
}

.betslip-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.btn {
    padding: 1rem 2rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    flex: 1;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
}

.btn-secondary:hover {
    background: #667eea;
    color: white;
}

/* Account Card Styles */
.accounts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.account-card {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.account-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.account-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.account-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
}

.account-site {
    font-size: 1.3rem;
    font-weight: 700;
    color: #667eea;
}

.account-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    width: 35px;
    height: 35px;
    border: none;
    border-radius: 50%;
    background: #f5f7fa;
    color: #667eea;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.btn-icon i {
    pointer-events: none; /* Prevent icon from intercepting clicks */
}

.btn-icon:hover {
    background: #667eea;
    color: white;
}

.account-holder {
    color: #888;
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

.account-balances {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.balance-item {
    background: #f5f7fa;
    padding: 1rem;
    border-radius: 8px;
}

.balance-label {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 0.5rem;
}

.balance-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: #333;
}

.account-bonus {
    background: linear-gradient(135deg, #FFC107 0%, #FFA000 100%);
    color: white;
    padding: 0.75rem;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bonus-badge {
    font-weight: 700;
    font-size: 1.1rem;
}

.bonus-expiry {
    font-size: 0.85rem;
}

/* Modal Styles */
.modal {
    display: none !important;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 99999; /* Increased from 9999 to 99999 */
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex !important;
}

.modal-content {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
    z-index: 100000; /* Added this line */
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-header h2 {
    color: #667eea;
    font-size: 1.5rem;
}

.modal-close {
    width: 35px;
    height: 35px;
    border: none;
    background: #f5f7fa;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    color: #888;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: #e0e0e0;
    color: #333;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #555;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.bonus-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Footer Styles */
.main-footer {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 2rem 0;
    margin-top: 3rem;
}

.footer-content {
    text-align: center;
    color: #888;
}

.footer-content p {
    margin-bottom: 0.5rem;
}

.footer-links a {
    color: #667eea;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: #764ba2;
}

/* Alert Messages */
.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* History Table */
.history-table {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.history-table table {
    width: 100%;
    border-collapse: collapse;
}

.history-table th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem;
    text-align: left;
    font-weight: 600;
}

.history-table td {
    padding: 1rem;
    border-bottom: 1px solid #e0e0e0;
}

.history-table tr:last-child td {
    border-bottom: none;
}

.history-table tr:hover {
    background: #f5f7fa;
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.status-pending {
    background: #fff3cd;
    color: #856404;
}

.status-completed {
    background: #d4edda;
    color: #155724;
}

.status-cancelled {
    background: #f8d7da;
    color: #721c24;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .main-nav ul {
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
    }
    
    .main-nav a {
        width: 100%;
        justify-content: center;
    }
    
    .betslip-grid {
        grid-template-columns: 1fr;
    }
    
    .grid-header:nth-child(1) {
        display: none;
    }
    
    .accounts-grid {
        grid-template-columns: 1fr;
    }
    
    .betslip-actions {
        flex-direction: column;
    }
    
    .bonus-fields {
        grid-template-columns: 1fr;
    }
}
/* ── SNR (Stake Not Returned) styles ─────────────────────────────────────── */
.grid-output.snr-cell {
    background: #fff3e0;
    border-color: #ffb74d;
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
}

.snr-badge {
    display: inline-block;
    background: #e65100;
    color: white;
    font-size: 0.7rem;
    padding: 0.15rem 0.55rem;
    border-radius: 12px;
    font-weight: 700;
    letter-spacing: 0.05em;
}

/* ── Withdraw button ─────────────────────────────────────────────────────── */
.btn-withdraw {
    color: #2e7d32;
    transition: color 0.2s, transform 0.15s;
}
.btn-withdraw:hover {
    color: #1b5e20;
    transform: scale(1.15);
}

/* Modal withdraw header override */
#withdrawModal .modal-header {
    background: linear-gradient(135deg, #2e7d32, #388e3c);
}
#withdrawModal .modal-header h2,
#withdrawModal .modal-close {
    color: white;
}

/* ─── Betslip Tab Navigation ─────────────────────────────────────── */
.betslip-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 0;
    border-radius: 14px 14px 0 0;
    overflow: hidden;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.08);
}

.betslip-tab {
    flex: 1;
    padding: 0.9rem 1.5rem;
    border: none;
    background: rgba(255,255,255,0.55);
    color: #667eea;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    backdrop-filter: blur(6px);
    border-bottom: 3px solid transparent;
}

.betslip-tab:hover {
    background: rgba(255,255,255,0.78);
    color: #764ba2;
}

.betslip-tab.active {
    background: #fff;
    color: #764ba2;
    border-bottom: 3px solid #764ba2;
}

.betslip-panel > .betslip-container {
    border-radius: 0 0 16px 16px;
    margin-bottom: 2rem;
}

/* ─── Back / Lay Grid ────────────────────────────────────────────── */
.backlay-container {
    border-top: 3px solid #764ba2;
}

.bl-grid {
    display: grid;
    grid-template-columns: 180px 1fr 1fr;
    gap: 0.6rem 1rem;
    align-items: center;
    margin-bottom: 1.5rem;
}

.bl-header-empty { /* spacer */ }

.bl-col-header {
    text-align: center;
    font-weight: 700;
    font-size: 0.95rem;
    padding: 0.7rem 1rem;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    letter-spacing: 0.5px;
}

.bl-col-back {
    background: linear-gradient(135deg, #1565c0 0%, #1976d2 100%);
    color: white;
}

.bl-col-lay {
    background: linear-gradient(135deg, #c62828 0%, #e53935 100%);
    color: white;
}

.bl-label {
    font-weight: 600;
    color: #555;
    font-size: 0.9rem;
    padding: 0.25rem 0;
}

.bl-input {
    position: relative;
}

.bl-input input,
.bl-input select {
    width: 100%;
    padding: 0.65rem 0.9rem;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 0.9rem;
    color: #333;
    background: #fafafa;
    transition: border-color 0.2s ease;
    outline: none;
}

.bl-input input:focus,
.bl-input select:focus {
    border-color: #667eea;
    background: #fff;
}

.bl-auto-cell {
    position: relative;
}

.bl-calc-field {
    background: #f0f4ff !important;
    color: #764ba2 !important;
    font-weight: 600 !important;
    border-color: #c5cfe8 !important;
    cursor: default;
}

.bl-auto-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 5px;
    border: none;
    border-radius: 20px;
    padding: 3px 8px 3px 4px;
    cursor: pointer;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: white;
    transition: background 0.3s ease, box-shadow 0.2s ease;
    user-select: none;
    outline: none;
    box-shadow: 0 1px 4px rgba(0,0,0,0.18);
}

.bl-auto-toggle:hover {
    filter: brightness(1.1);
    box-shadow: 0 2px 8px rgba(0,0,0,0.22);
}

.bl-auto-on {
    background: linear-gradient(135deg, #c62828, #e53935);
}

.bl-auto-off {
    background: linear-gradient(135deg, #9e9e9e, #bdbdbd);
}

.bl-toggle-knob {
    width: 14px;
    height: 14px;
    background: white;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.25);
    transition: transform 0.25s cubic-bezier(.4,0,.2,1), opacity 0.2s;
    position: relative;
}

/* Knob slides right when AUTO is ON, left when OFF */
.bl-auto-on  .bl-toggle-knob { transform: translateX(0px);  }
.bl-auto-off .bl-toggle-knob { transform: translateX(-2px); opacity: 0.7; }

.bl-toggle-label {
    transition: opacity 0.2s;
    white-space: nowrap;
}

.bl-auto-off .bl-toggle-label {
    opacity: 0.85;
}
/* Override old badge style just in case */
.bl-auto-badge { display: none !important; }

.bl-output {
    text-align: center;
    font-weight: 700;
    font-size: 0.95rem;
    color: #2e7d32;
    background: #f5f5f5;
    border-radius: 10px;
    padding: 0.6rem 0.9rem;
    min-height: 2.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bl-liability-val {
    color: #c62828 !important;
    background: #fff8f8 !important;
    border: 2px solid #ffcdd2;
}

.lay-liability-label {
    color: #c62828;
}

.profit-label {
    color: #333;
    font-weight: 700;
}

.profit-cell {
    font-size: 1rem;
    font-weight: 800;
    border: 2px solid #e8f5e9;
}

/* Responsive Back/Lay */
@media (max-width: 600px) {
    .bl-grid {
        grid-template-columns: 120px 1fr 1fr;
        gap: 0.4rem 0.6rem;
    }
    .betslip-tab {
        font-size: 0.82rem;
        padding: 0.75rem 0.75rem;
    }
}

/* Back/Lay — manual override field styling */
.bl-liability-input {
    border-color: #ffcdd2 !important;
    background: #fff8f8 !important;
    color: #c62828 !important;
}

.bl-manual-field {
    border-color: #764ba2 !important;
    background: #f5f0ff !important;
    color: #4a148c !important;
    font-weight: 700 !important;
}

.bl-manual-field + .bl-auto-badge {
    background: linear-gradient(135deg, #4a148c, #764ba2) !important;
}

/* Total Winnings output cell */
.bl-winnings-val {
    font-size: 1rem;
    font-weight: 800;
    border: 2px solid #e8f5e9;
    background: #f9fbe7;
}

/* ─── Funds check banner ─────────────────────────────────────────── */
.bl-funds-ok {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1.5px solid #a5d6a7;
    border-radius: 8px;
    padding: 0.5rem 0.9rem;
    font-size: 0.82rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.bl-funds-warn {
    background: #ffebee;
    color: #c62828;
    border: 1.5px solid #ef9a9a;
    border-radius: 8px;
    padding: 0.5rem 0.9rem;
    font-size: 0.82rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Winnings cell — flex column for value + sub-label */
.bl-winnings-val {
    flex-direction: column;
    gap: 2px;
    font-size: 1rem;
    font-weight: 800;
    border: 2px solid #e8f5e9;
    background: #f9fbe7;
    line-height: 1.3;
}

/* Fund row cells — when hidden must not take up grid space */
#bl_fund_label[style*="display:none"],
#bl_fund_cell[style*="display:none"],
#bl_fund_spacer[style*="display:none"] {
    display: none !important;
}
/* When visible they participate normally in the 3-col grid */
#bl_fund_label,
#bl_fund_cell,
#bl_fund_spacer {
    /* no extra style needed — grid handles it */
}

/* ── Multi-account rows ────────────────────────────────── */
.multi-account-rows {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.account-row {
    background: #f8f9ff;
    border: 1px solid #dde3f5;
    border-radius: 8px;
    padding: 0.5rem 0.6rem;
}

.account-row .leg-account-select {
    width: 100%;
    margin-bottom: 0;
    font-size: 0.85rem;
}

.account-row .leg-stake-input {
    width: 100%;
    box-sizing: border-box;
    font-size: 0.88rem;
    padding: 0.35rem 0.5rem;
    border: 2px solid #c5cfe8;
    border-radius: 7px;
    margin-top: 0.3rem;
}

.account-row .leg-stake-input:focus {
    border-color: #667eea;
    outline: none;
}

.add-account-btn:hover {
    background: #e8eeff !important;
    border-color: #4a5bc7 !important;
    color: #4a5bc7 !important;
}
/* ─── Overlay / Underlay Slider ─────────────────────────────────── */
.bl-slider-row {
    padding: 0.5rem 0.8rem 0.3rem;
    background: #fafafa;
    border: 1.5px solid #e0e0e0;
    border-radius: 12px;
    transition: opacity 0.2s, border-color 0.2s;
}

.bl-slider-disabled {
    opacity: 0.4;
    pointer-events: none;
}

.bl-slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    font-weight: 700;
    color: #999;
    margin-bottom: 0.15rem;
    padding: 0 1px;
    position: relative;
}

.bl-slider-lbl-underlay { color: #1565c0; position: absolute; left: 23%; transform: translateX(-50%); }
.bl-slider-lbl-standard { color: #555;    position: absolute; left: 50%; transform: translateX(-50%); }
.bl-slider-lbl-overlay  { color: #c62828; position: absolute; right: 23%; transform: translateX(50%); }

.bl-slider-track-wrap {
    position: relative;
    padding: 8px 0 2px;
}

.bl-lay-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(to right, #1565c0 0%, #1565c0 25%, #bbb 25%, #bbb 75%, #c62828 75%, #c62828 100%);
    outline: none;
    cursor: pointer;
}

.bl-lay-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    border: 3px solid #555;
    cursor: pointer;
    box-shadow: 0 1px 5px rgba(0,0,0,0.25);
    transition: border-color 0.2s, transform 0.15s;
}

.bl-lay-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.bl-lay-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    border: 3px solid #555;
    cursor: pointer;
    box-shadow: 0 1px 5px rgba(0,0,0,0.25);
}

/* Pip markers at 0, 25, 50, 75, 100 */
.bl-slider-pip {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ccc;
    pointer-events: none;
    margin-top: 4px;
}
.bl-pip-left   { left: 0%; margin-left: -1px; background: #1565c0; }
.bl-pip-center { left: 50%; transform: translate(-50%,-50%); margin-top: 4px; background: #888; }
.bl-pip-right  { right: 0%; margin-right: -1px; background: #c62828; }

.bl-slider-badge {
    position: relative;
    display: inline-block;
    margin-top: 0.35rem;
    font-size: 0.72rem;
    font-weight: 700;
    color: #555;
    background: #f0f0f0;
    border-radius: 8px;
    padding: 2px 10px;
    left: 50%;
    transform: translateX(-50%);
    transition: color 0.2s;
    white-space: nowrap;
}
/* ─── OCR Scanner (per account row) ────────────────────────────────── */
.ocr-row-wrap {
    margin-bottom: 0.25rem;
}

.ocr-scan-btn {
    width: 100%;
    font-size: 0.75rem;
    padding: 0.28rem 0.6rem;
    border: 1px dashed #9c27b0;
    background: linear-gradient(135deg, #f3e5f5, #ede7f6);
    color: #6a1b9a;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    transition: all 0.18s;
    font-family: inherit;
}

.ocr-scan-btn:hover {
    background: linear-gradient(135deg, #e1bee7, #d1c4e9);
    border-color: #7b1fa2;
    color: #4a148c;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(106, 27, 154, 0.22);
}

.ocr-scan-btn:active {
    transform: translateY(0);
}

.ocr-status {
    font-size: 0.71rem;
    text-align: center;
    margin-top: 0.22rem;
    padding: 0.22rem 0.4rem;
    border-radius: 5px;
    background: #f3e5f5;
    color: #6a1b9a;
}
/* ── Back/Lay multi-account rows ────────────────────── */
.bl-account-row {
    background: #f0f4ff;
    border: 1px solid #c5cfe8;
    border-radius: 8px;
    padding: 0.5rem 0.6rem;
}

.bl-account-row .bl-back-account-select {
    width: 100%;
    font-size: 0.85rem;
    padding: 0.4rem 0.5rem;
    border: 2px solid #c5cfe8;
    border-radius: 8px;
    background: #fff;
    color: #333;
    box-sizing: border-box;
}

.bl-account-row .bl-back-account-select:focus {
    border-color: #1565c0;
    outline: none;
}

.bl-account-row .bl-back-stake-input:focus {
    border-color: #1565c0;
    outline: none;
}

/* ── Searchable Select ─────────────────────────────────────── */
.ss-wrapper {
    position: relative;
    width: 100%;
    font-size: 0.88rem;
}

.ss-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.45rem 0.6rem;
    border: 2px solid #c5cfe8;
    border-radius: 8px;
    background: #fff;
    color: #333;
    cursor: pointer;
    box-sizing: border-box;
    min-height: 38px;
    gap: 0.4rem;
    transition: border-color 0.15s;
    user-select: none;
}
.ss-trigger:hover,
.ss-wrapper.ss-open .ss-trigger {
    border-color: #667eea;
    background: #f7f8ff;
}
.ss-trigger:focus {
    outline: 2px solid #667eea;
    outline-offset: 1px;
}
.ss-trigger-text {
    flex: 1;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 0.85rem;
}
.ss-trigger-text.ss-placeholder-text {
    color: #999;
}
.ss-arrow {
    font-size: 0.65rem;
    color: #999;
    flex-shrink: 0;
    transition: transform 0.15s;
}
.ss-wrapper.ss-open .ss-arrow {
    transform: rotate(180deg);
}

.ss-dropdown {
    position: absolute;
    top: calc(100% + 3px);
    left: 0;
    right: 0;
    background: #fff;
    border: 2px solid #667eea;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(102,126,234,0.18);
    z-index: 999999;
    overflow: hidden;
}

.ss-search-wrap {
    padding: 0.45rem 0.5rem 0.3rem;
    border-bottom: 1px solid #eef0fa;
}
.ss-search {
    width: 100%;
    padding: 0.35rem 0.5rem;
    border: 1.5px solid #c5cfe8;
    border-radius: 7px;
    font-size: 0.84rem;
    box-sizing: border-box;
    outline: none;
    background: #f7f8ff;
}
.ss-search:focus {
    border-color: #667eea;
    background: #fff;
}

.ss-list {
    list-style: none;
    margin: 0;
    padding: 0.25rem 0;
    max-height: 220px;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.ss-list::-webkit-scrollbar { width: 5px; }
.ss-list::-webkit-scrollbar-thumb { background: #c5cfe8; border-radius: 4px; }

.ss-option {
    padding: 0.42rem 0.75rem;
    cursor: pointer;
    font-size: 0.83rem;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    outline: none;
}
.ss-option:hover,
.ss-option:focus {
    background: #eef1ff;
    color: #3d52d5;
}
.ss-option.ss-selected {
    background: #e8edff;
    color: #3d52d5;
    font-weight: 600;
}
.ss-option.ss-placeholder {
    color: #999;
    font-style: italic;
}
.ss-option mark {
    background: #fff3b0;
    color: #333;
    border-radius: 2px;
    padding: 0 1px;
}
.ss-no-results {
    padding: 0.5rem 0.75rem;
    color: #aaa;
    font-size: 0.82rem;
    font-style: italic;
    list-style: none;
}

/* ── Searchable Select — Mobile ──────────────────────────────────── */
@media (max-width: 600px) {
    .ss-trigger {
        font-size: 0.83rem;
        padding: 0.5rem 0.55rem;
        min-height: 42px;
    }
    .ss-trigger-text {
        font-size: 0.82rem;
    }
    .ss-dropdown {
        /* On mobile keep dropdown within viewport width */
        left: 0 !important;
        right: 0 !important;
        width: auto !important;
        min-width: 0 !important;
        /* Clamp to viewport edges with a small gutter */
        max-width: calc(100vw - 1rem);
    }
    .ss-search {
        font-size: 0.88rem;
        padding: 0.45rem 0.55rem;
    }
    .ss-option {
        font-size: 0.85rem;
        padding: 0.55rem 0.75rem;
        white-space: normal;      /* allow wrapping on narrow screens */
        word-break: break-word;
    }
    .ss-list {
        max-height: 180px;
    }
}

/* ── Searchable Select — Rich Account Cards ─────────────────────── */
.ss-option.ss-acc-name,
.ss-acc-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex-wrap: wrap;
}
.ss-acc-detail {
    font-size: 0.74rem;
    color: #777;
    margin-top: 0.18rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    align-items: center;
}
.ss-bal-real    { color: #1565c0; font-weight: 600; }
.ss-bal-bonus   { color: #e65100; font-weight: 600; }
.ss-bal-pending { color: #6a1b9a; font-weight: 600; }
.ss-bal-avail   { color: #2e7d32; font-weight: 700; }
.ss-bal-sep     { color: #ccc; }

.ss-badge {
    font-size: 0.65rem;
    font-weight: 800;
    padding: 0.05rem 0.4rem;
    border-radius: 8px;
    letter-spacing: 0.03em;
    vertical-align: middle;
}
.ss-badge-snr  { background: #fff3e0; color: #e65100; border: 1px solid #ffcc80; }
.ss-badge-flex { background: #ede7f6; color: #6a1b9a; border: 1px solid #ce93d8; }

/* Taller options for two-line cards */
.ss-option:has(.ss-acc-name) {
    padding: 0.5rem 0.75rem;
    white-space: normal;
}

/* ── Searchable Select — Two-line trigger ───────────────────────── */
.ss-trigger-text {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
    overflow: hidden;
}
.ss-trig-name {
    font-size: 0.87rem;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ss-trig-bal {
    font-size: 0.72rem;
    color: #777;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 400;
}
.ss-trigger {
    min-height: 46px;  /* slightly taller for two lines */
    align-items: center;
}