/* ===== MOTYW: LIGHT (domyślny / jasny) ===== */
:root,
[data-theme="light"] {
    --primary: #4F46E5;
    --primary-hover: #4338CA;
    --bg-color: #F3F4F6;
    --card-bg: #FFFFFF;
    --text-main: #111827;
    --text-muted: #6B7280;
    --border: #E5E7EB;
    --success: #10B981;
    --error: #EF4444;
    /* dodatkowe tokeny dla stats */
    --row-head-bg: #F9FAFB;
    --th-text: #4B5563;
    --input-bg: #F9FAFB;
    --toggle-bg: #FFFFFF;
    --toggle-active: #EEF2FF;
}

/* ===== MOTYW: DARK (ciemny) ===== */
[data-theme="dark"] {
    --primary: #818CF8;
    --primary-hover: #6366F1;
    --bg-color: #0A0F1A;
    --card-bg: #111827;
    --text-main: #F1F5F9;
    --text-muted: #94A3B8;
    --border: rgba(255,255,255,0.08);
    --success: #34D399;
    --error: #F87171;
    --row-head-bg: #1A2235;
    --th-text: #94A3B8;
    --input-bg: #0A0F1A;
    --toggle-bg: #1A2235;
    --toggle-active: #111827;
}

/* ===== MOTYW: AUTO → ciemny gdy system woła o ciemny ===== */
@media (prefers-color-scheme: dark) {
    [data-theme="auto"] {
        --primary: #818CF8;
        --primary-hover: #6366F1;
        --bg-color: #0A0F1A;
        --card-bg: #111827;
        --text-main: #F1F5F9;
        --text-muted: #94A3B8;
        --border: rgba(255,255,255,0.08);
        --success: #34D399;
        --error: #F87171;
        --row-head-bg: #1A2235;
        --th-text: #94A3B8;
        --input-bg: #0A0F1A;
        --toggle-bg: #1A2235;
        --toggle-active: #111827;
    }
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh; /* uwzględnia pasek adresu na mobile (Pixel/Chrome) */
    padding: 20px;
    transition: background-color 0.25s ease, color 0.25s ease;
}

/* --- 2. LAYOUT I WSPÓLNE KOMPONENTY --- */
.generator-card, 
.thankyou-card {
    background: var(--card-bg);
    width: 100%;
    max-width: 480px;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
    margin: auto; /* centruje gdy jest miejsce; przy braku trzyma od góry bez ucinania */
    overflow: hidden;
}

.btn,
.btn-submit {
    display: inline-block;
    width: 100%;
    padding: 14px 32px;
    background-color: var(--primary);
    color: white;
    text-decoration: none;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    text-align: center;
}

.btn:hover,
.btn-submit:hover {
    background-color: var(--primary-hover);
}

/* --- 3. GENERATOR LINKÓW (index.php) --- */
.card-body { padding: 32px; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; font-size: 0.875rem; font-weight: 500; }
.form-control { width: 100%; padding: 12px 16px; border: 1px solid var(--border); border-radius: 8px; font-size: 1rem; color: var(--text-main); transition: all 0.2s; background-color: var(--input-bg); }
.form-control:focus { outline: none; border-color: var(--primary); background-color: #FFFFFF; box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1); }
.input-group { position: relative; display: flex; align-items: center; }
.input-group input { padding-right: 60px; }
.input-group .currency { position: absolute; right: 16px; color: var(--text-muted); font-weight: 500; }

.btn-submit:disabled { background-color: #9CA3AF; cursor: not-allowed; }
.action-buttons { display: flex; gap: 12px; margin-top: 10px; }
.action-buttons .btn-submit { margin-top: 0; flex: 1; }
.btn-clear { display: none; flex: 1; padding: 14px; background-color: transparent; color: var(--text-muted); border: 1px solid var(--border); border-radius: 8px; font-size: 1rem; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.btn-clear:hover { background-color: #F9FAFB; color: var(--text-main); border-color: #D1D5DB; }

.result-box { display: none; margin-top: 24px; padding: 20px; background-color: #ECFDF5; border: 1px dashed var(--success); border-radius: 8px; text-align: center; }
.result-box p { color: #065F46; font-size: 0.875rem; font-weight: 500; margin-bottom: 12px; }
.link-container { display: flex; gap: 8px; }
.link-input { flex: 1; padding: 10px; border: 1px solid #A7F3D0; border-radius: 6px; font-size: 0.875rem; color: #047857; background: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn-copy { padding: 10px 16px; background-color: var(--success); color: white; border: none; border-radius: 6px; font-weight: 600; cursor: pointer; font-size: 0.875rem; transition: background 0.2s; }
.btn-copy:hover { background-color: #059669; }

.loader { display: none; text-align: center; margin-top: 20px; color: var(--text-muted); font-size: 0.875rem; }
.checkbox-group { display: flex; gap: 20px; margin-bottom: 24px; }
.checkbox-label { display: flex; align-items: center; gap: 8px; font-size: 0.875rem; font-weight: 500; cursor: pointer; }
.checkbox-label input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer; border-radius: 4px; }
.card-footer { padding: 16px 32px; border-top: 1px solid var(--border); text-align: center; font-size: 0.75rem; color: var(--text-muted); background-color: #F9FAFB; letter-spacing: 0.03em; }

/* --- 4. WIDOK STATYSTYK (stats.php) --- */
.dashboard { width: 100%; max-width: 1480px; margin: 0 auto; flex-grow: 1; overflow-x: hidden; }
.dashboard h2 { margin-bottom: 24px; }
.header-arenapay {
    background: linear-gradient(135deg, #E11D48, #2563EB);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
    font-family: 'Montserrat', sans-serif;
    font-weight: 800;
}
.arena-logo{
    width: 40px;
    border-radius: 100px;
    vertical-align: middle;
}
.summary-cards { display: flex; gap: 20px; margin-bottom: 30px; }
.card { background: var(--card-bg); padding: 20px; border-radius: 12px; box-shadow: 0 2px 4px rgba(0,0,0,0.05); flex: 1; text-align: center; }
.card-title { font-size: 0.825rem; color: var(--text-muted); text-transform: uppercase; font-weight: 600; letter-spacing: 0.05em; }
.card-value { font-size: 1.8rem; font-weight: 700; margin-top: 8px; color: var(--text-main); }
.val-total { color: var(--primary); }
.val-paid { color: var(--success); }
.val-pending { color: #D97706; }

.table-container { background: var(--card-bg); border-radius: 12px; overflow: hidden; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 16px; border-bottom: 1px solid var(--border); text-align: left; font-size: 0.95rem; }
th { background: var(--row-head-bg); font-weight: 600; color: var(--th-text); }
.badge { padding: 6px 12px; border-radius: 20px; font-size: 0.8rem; font-weight: 600; display: inline-block; }

/*tr:hover {background: #f5f5f5;cursor: pointer;}*/
tr.row-opłacona:hover { background-color: #ecfdf5; }
tr.row-odrzucona:hover { background-color: #fef2f2; }
tr.row-wygasła:hover { background-color: #f3f4f6; }
tr.row-oczekuje:hover { background-color: #fffbeb; }

.amount { font-weight: 600; }
.date { color: var(--text-muted); font-size: 0.85rem; }

.pagination { padding: 16px; background: var(--card-bg); border-top: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.pagination-info { font-size: 0.875rem; color: var(--text-muted); }
.pagination-buttons { display: flex; gap: 8px; }
.page-btn { padding: 8px 16px; border: 1px solid var(--border); background: var(--card-bg); border-radius: 6px; text-decoration: none; color: #374151; font-size: 0.875rem; font-weight: 500; transition: all 0.2s; }
.page-btn:hover { background: var(--bg-color); }
.page-btn.disabled { opacity: 0.5; pointer-events: none; background: #F9FAFB; }

.badge-notify { padding: 4px 8px; border-radius: 4px; font-size: 0.75rem; font-weight: 600; display: inline-block; }
.notify-wrap { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: center; }
.notify-email { background: #D1FAE5; color: #065F46; border: 1px solid #A7F3D0; }
.notify-sms { background: #DBEAFE; color: #1E40AF; border: 1px solid #BFDBFE; }
.notify-none { background: var(--bg-color); color: #9CA3AF; border: 1px solid var(--border); }

.app-footer { text-align: center; margin-top: 32px; padding-bottom: 24px; font-size: 0.8rem; color: #9CA3AF; letter-spacing: 0.03em; }

/* --- 5. EKRAN PODZIĘKOWANIA (thankyou.php) --- */
.thankyou-card { padding: 40px 32px; box-sizing: border-box; text-align: center; }
.merchant-logo { max-height: 50px; max-width: 200px; object-fit: contain; margin-bottom: 24px; }
.company-name { font-size: 0.95rem; font-weight: 600; color: #4B5563; margin-top: -12px; margin-bottom: 24px; }

.icon-circle {
    width: 80px; height: 80px; border-radius: 50%;
    display: flex; justify-content: center; align-items: center;
    font-size: 40px; font-weight: bold; margin: 0 auto 24px;
}
.icon-success { background-color: #D1FAE5; color: var(--success); }
.icon-error { background-color: #FEE2E2; color: var(--error); }

.thankyou-card h1 { color: var(--text-main); font-size: 1.5rem; margin-bottom: 16px; }
.thankyou-card p { color: #4B5563; line-height: 1.6; margin-bottom: 32px; }

/* --- 6. RWD (URZĄDZENIA MOBILNE) --- */
@media (max-width: 768px) {
    body { padding: 12px 10px; }
    .generator-card, .thankyou-card { border-radius: 12px; }
    .card-body { padding: 20px 16px; }
    .form-group { margin-bottom: 14px; }
    .checkbox-group { flex-direction: column; gap: 10px; margin-bottom: 16px; }
    .card-footer { padding: 12px 20px; }
    .action-buttons { flex-direction: column; }
    
    /* Karty na samej górze */
    .summary-cards { flex-direction: column; gap: 12px; margin-bottom: 24px; }

    /* Wyłączamy białe tło i cień głównego kontenera na telefonach */
    .table-container { 
        background: transparent; 
        box-shadow: none; 
    }
    
    /* Magia łamania tabeli w pionowe karty */
    .table-container table, 
    .table-container tbody, 
    .table-container td, 
    .table-container tr { 
        display: block; 
    }
    
    /* Całkowicie ukrywamy nagłówki th na telefonach */
    .table-container th { 
        display: none; 
    }
    
    .table-container tr { 
        border: 1px solid var(--border); 
        border-radius: 8px; 
        margin-bottom: 16px; 
        background: var(--card-bg);
        padding: 8px 0;
    }
    
    .table-container td { 
        border: none; 
        border-bottom: 1px solid #F9FAFB; 
        position: relative; 
        padding: 12px 16px 12px 45%; 
        min-height: 44px; 
        display: flex; 
        align-items: center; 
        justify-content: flex-end; 
        text-align: right; 
    }
    
    .table-container td:last-child { 
        border-bottom: 0; 
    }
    
    /* Wstawianie etykiet z atrybutu data-label */
    .table-container td::before { 
        content: attr(data-label); 
        position: absolute; 
        left: 16px; 
        width: 40%; 
        white-space: nowrap; 
        font-weight: 600; 
        text-align: left; 
        font-size: 0.85rem; 
        color: var(--text-muted); 
    }

    /* Paginacja w pionie */
    .pagination { 
        flex-direction: column; 
        gap: 16px; 
        text-align: center; 
    }
}

/* ===== PRZEŁĄCZNIK MOTYWU (stats.php) ===== */
.theme-toggle {
    display: flex;
    gap: 2px;
    background: var(--toggle-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 3px;
}
.theme-btn {
    width: 34px;
    height: 30px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: color 0.15s, background 0.15s;
}
.theme-btn:hover { color: var(--text-main); }
.theme-btn.active {
    background: var(--toggle-active);
    color: var(--primary);
}

/* Przycisk Nowa płatność (zamiana z inline na klasę) */
.btn-new-payment {
    background: var(--primary);
    color: #fff;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    box-shadow: 0 4px 6px rgba(79, 70, 229, 0.2);
    transition: background 0.2s, opacity 0.2s;
    white-space: nowrap;
}
.btn-new-payment:hover { opacity: 0.9; }

/* Drobna korekta logo w dark mode - gradient tekstu zostaje czytelny */
[data-theme="dark"] .header-arenapay { filter: brightness(1.15); }
@media (prefers-color-scheme: dark) {
    [data-theme="auto"] .header-arenapay { filter: brightness(1.15); }
}

/* Badge w dark mode - delikatne tła zamiast jaskrawych */
[data-theme="dark"] .notify-email { background: rgba(52,211,153,0.12); color: #34D399; border-color: rgba(52,211,153,0.25); }
[data-theme="dark"] .notify-sms { background: rgba(96,165,250,0.12); color: #60A5FA; border-color: rgba(96,165,250,0.25); }
[data-theme="dark"] .notify-none { background: rgba(255,255,255,0.05); color: #64748B; border-color: var(--border); }

/* Hover wierszy w dark mode */
[data-theme="dark"] tr.row-opłacona:hover { background-color: rgba(52,211,153,0.08); }
[data-theme="dark"] tr.row-odrzucona:hover { background-color: rgba(248,113,113,0.08); }
[data-theme="dark"] tr.row-wygasła:hover { background-color: rgba(255,255,255,0.03); }
[data-theme="dark"] tr.row-oczekuje:hover { background-color: rgba(251,191,36,0.08); }

@media (prefers-color-scheme: dark) {
    [data-theme="auto"] .notify-email { background: rgba(52,211,153,0.12); color: #34D399; border-color: rgba(52,211,153,0.25); }
    [data-theme="auto"] .notify-sms { background: rgba(96,165,250,0.12); color: #60A5FA; border-color: rgba(96,165,250,0.25); }
    [data-theme="auto"] .notify-none { background: rgba(255,255,255,0.05); color: #64748B; border-color: var(--border); }
    [data-theme="auto"] tr.row-opłacona:hover { background-color: rgba(52,211,153,0.08); }
    [data-theme="auto"] tr.row-odrzucona:hover { background-color: rgba(248,113,113,0.08); }
    [data-theme="auto"] tr.row-wygasła:hover { background-color: rgba(255,255,255,0.03); }
    [data-theme="auto"] tr.row-oczekuje:hover { background-color: rgba(251,191,36,0.08); }
}
/* ===== STATUSY (badge) - reagują na motyw [dla stats.php] ===== */
.badge--paid    { color: #065F46; background: #D1FAE5; }
.badge--reject  { color: #991B1B; background: #FEE2E2; }
.badge--expired { color: #374151; background: #E5E7EB; }
.badge--pending { color: #92400E; background: #FEF3C7; }
.badge--retried { color: #3730A3; background: #E0E7FF; }
.badge--chargeback { color: #831843; background: #FCE7F3; }
[data-theme="dark"] .badge--paid    { color: #34D399; background: rgba(52,211,153,0.15); }
[data-theme="dark"] .badge--reject  { color: #F87171; background: rgba(248,113,113,0.15); }
[data-theme="dark"] .badge--expired { color: #94A3B8; background: rgba(255,255,255,0.08); }
[data-theme="dark"] .badge--pending { color: #FBBF24; background: rgba(251,191,36,0.15); }
[data-theme="dark"] .badge--retried { color: #A5B4FC; background: rgba(129,140,248,0.15); }
[data-theme="dark"] .badge--chargeback { color: #F472B6; background: rgba(244,114,182,0.15); }
@media (prefers-color-scheme: dark) {
    [data-theme="auto"] .badge--paid    { color: #34D399; background: rgba(52,211,153,0.15); }
    [data-theme="auto"] .badge--reject  { color: #F87171; background: rgba(248,113,113,0.15); }
    [data-theme="auto"] .badge--expired { color: #94A3B8; background: rgba(255,255,255,0.08); }
    [data-theme="auto"] .badge--pending { color: #FBBF24; background: rgba(251,191,36,0.15); }
    [data-theme="auto"] .badge--retried { color: #A5B4FC; background: rgba(129,140,248,0.15); }
    [data-theme="auto"] .badge--chargeback { color: #F472B6; background: rgba(244,114,182,0.15); }
}

/* ===== PRZYCISK WYLOGUJ [dla stats.php] ===== */
.btn-logout {
    display: inline-flex; align-items: center; gap: 7px;
    background: rgba(239,68,68,0.08); color: var(--error);
    text-decoration: none; padding: 10px 16px;
    border: 1px solid rgba(239,68,68,0.3); border-radius: 8px;
    font-weight: 600; font-size: 14px; transition: all 0.2s; white-space: nowrap;
}
.btn-logout:hover { color: #fff; border-color: var(--error); background: var(--error); }
[data-theme="dark"] .btn-logout { background: rgba(248,113,113,0.1); border-color: rgba(248,113,113,0.35); }
[data-theme="dark"] .btn-logout:hover { background: var(--error); color: #0A0F1A; }
@media (max-width: 600px) {
    .btn-logout span { display: none; }
    .btn-logout { padding: 10px 12px; }
}

/* ===== STOPKA GENERATORA z przełącznikiem (index.php) ===== */
.card-footer--flex {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    text-align: left;
}
.card-footer--flex .footer-text {
    flex: 1;
    min-width: 0;
}
@media (max-width: 420px) {
    .card-footer--flex {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
}

/* ===== BANERY LICENCJI / AKTUALIZACJI (index.php) - reagują na motyw ===== */
.lic-banner {
    padding: 20px; border-radius: 8px; text-align: center; margin-bottom: 20px;
    border: 1px solid transparent;
}
.lic-banner--expired {
    background: #FEE2E2; border-color: #FCA5A5; color: #991B1B; padding: 25px;
}
.lic-banner--expired svg { color: #DC2626; }
.lic-banner--update {
    background: #FEF3C7; border-color: #F59E0B; color: #92400E; padding: 15px;
}
[data-theme="dark"] .lic-banner--expired {
    background: rgba(248,113,113,0.1); border-color: rgba(248,113,113,0.3); color: #FCA5A5;
}
[data-theme="dark"] .lic-banner--expired svg { color: #F87171; }
[data-theme="dark"] .lic-banner--update {
    background: rgba(251,191,36,0.1); border-color: rgba(251,191,36,0.3); color: #FBBF24;
}
@media (prefers-color-scheme: dark) {
    [data-theme="auto"] .lic-banner--expired {
        background: rgba(248,113,113,0.1); border-color: rgba(248,113,113,0.3); color: #FCA5A5;
    }
    [data-theme="auto"] .lic-banner--expired svg { color: #F87171; }
    [data-theme="auto"] .lic-banner--update {
        background: rgba(251,191,36,0.1); border-color: rgba(251,191,36,0.3); color: #FBBF24;
    }
}
.lic-btn {
    display: inline-block; padding: 10px 24px; color: #fff; text-decoration: none;
    border-radius: 6px; font-weight: 600; font-size: 14px; transition: opacity 0.2s;
}
.lic-btn:hover { opacity: 0.9; }
.lic-btn--red { background: #DC2626; box-shadow: 0 4px 6px rgba(220,38,38,0.2); }
.lic-btn--yellow { background: #D97706; padding: 6px 14px; font-size: 13px; }

/* ===== RESULT-BOX (index.php) - dark mode ===== */
[data-theme="dark"] .result-box { background-color: rgba(52,211,153,0.08); }
[data-theme="dark"] .result-box p { color: #34D399; }
[data-theme="dark"] .link-input { background: var(--card-bg); border-color: rgba(52,211,153,0.3); color: #34D399; }
@media (prefers-color-scheme: dark) {
    [data-theme="auto"] .result-box { background-color: rgba(52,211,153,0.08); }
    [data-theme="auto"] .result-box p { color: #34D399; }
    [data-theme="auto"] .link-input { background: var(--card-bg); border-color: rgba(52,211,153,0.3); color: #34D399; }
}

/* ===== CARD-FOOTER w dark ===== */
[data-theme="dark"] .card-footer { background-color: var(--row-head-bg); }
@media (prefers-color-scheme: dark) {
    [data-theme="auto"] .card-footer { background-color: var(--row-head-bg); }
}

/* ===== FORM-CONTROL focus w dark (białe tło → ciemne) ===== */
[data-theme="dark"] .form-control:focus { background-color: var(--card-bg); }
@media (prefers-color-scheme: dark) {
    [data-theme="auto"] .form-control:focus { background-color: var(--card-bg); }
}

/* ===== PODWARTOŚĆ W KARTACH KPI (stats.php) ===== */
.card-subvalue {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 6px;
    font-weight: 500;
}

/* ===== WYSZUKIWARKA (stats.php) ===== */
.search-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.search-field {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 240px;
    max-width: 420px;
}
.search-field svg {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    pointer-events: none;
}
.search-input {
    width: 100%;
    font-size: 0.95rem;
    padding: 11px 14px 11px 40px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--card-bg);
    color: var(--text-main);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.search-input::placeholder { color: var(--text-muted); }
.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}
.search-clear {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-decoration: none;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: all 0.15s;
    white-space: nowrap;
}
.search-clear:hover {
    color: var(--error);
    border-color: var(--error);
}
.search-count {
    font-size: 0.85rem;
    color: var(--text-muted);
    white-space: nowrap;
}
@media (max-width: 600px) {
    .search-field { max-width: 100%; }
}

/* ===== CHIPY FILTROWANIA STATUSU (stats.php) ===== */
.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}
.chip {
    font-size: 0.82rem;
    font-weight: 500;
    padding: 7px 14px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.15s;
    white-space: nowrap;
}
.chip:hover {
    border-color: var(--primary);
    color: var(--text-main);
}
.chip--active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
.chip--active:hover {
    color: #fff;
    opacity: 0.92;
}
/* Aktywne chipy w kolorach statusów */
.chip--paid.chip--active    { background: #10B981; border-color: #10B981; }
.chip--pending.chip--active { background: #D97706; border-color: #D97706; }
.chip--reject.chip--active  { background: #DC2626; border-color: #DC2626; }
.chip--expired.chip--active { background: #6B7280; border-color: #6B7280; }
.chip--retried.chip--active { background: #6366F1; border-color: #6366F1; }
.chip--chargeback.chip--active { background: #DB2777; border-color: #DB2777; }

/* --- Radiony czasu ważności linku (generator) --- */
/* Wizualnie spójne z .chip, ale jako radio (wybór jednej wartości). */
.validity-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.validity-pill {
    position: relative;
    cursor: pointer;
}
.validity-pill input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.validity-pill span {
    display: inline-block;
    font-size: 0.82rem;
    font-weight: 500;
    padding: 7px 14px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text-muted);
    transition: all 0.15s;
    white-space: nowrap;
}
.validity-pill:hover span {
    border-color: var(--primary);
    color: var(--text-main);
}
.validity-pill input:checked + span {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
.validity-pill input:focus-visible + span {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

@media (max-width: 600px) {
    .filter-chips { gap: 6px; }
    .chip { font-size: 0.78rem; padding: 6px 12px; }
}

/* ===== WSPÓLNY RZĄD: wyszukiwarka (lewa) + chipy (prawa) ===== */
.filters-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.filters-row .search-bar {
    margin-bottom: 0;
    flex: 1;
    min-width: 260px;
}
.filters-row .filter-chips {
    margin-bottom: 0;
    justify-content: flex-end;
}
/* Na wąskich ekranach: chipy pod wyszukiwarką, do lewej */
@media (max-width: 760px) {
    .filters-row { flex-direction: column; align-items: stretch; }
    .filters-row .filter-chips { justify-content: flex-start; }
}

/* ===== NAGŁÓWEK STATYSTYK - responsywny ===== */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.dashboard-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* Telefon: logo nad kontrolkami, wszystko ładnie zawinięte */
@media (max-width: 600px) {
    .dashboard-header {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
    }
    .dashboard-actions {
        justify-content: space-between;
        gap: 8px;
    }
    .dashboard-actions .btn-new-payment {
        flex: 1;
        text-align: center;
    }
    .header-arenapay {
        font-size: 1.6rem;
    }
}

/* Bardzo wąskie ekrany: przełącznik w osobnym rzędzie */
@media (max-width: 380px) {
    .dashboard-actions .theme-toggle {
        order: 2;
        flex-basis: 100%;
        justify-content: center;
    }
}

/* ===== PRZYCISK PONÓW (stats.php) ===== */
.btn-retry {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 7px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.btn-retry:hover {
    border-color: var(--text-main);
    color: var(--text-main);
}
.btn-retry:disabled {
    opacity: 0.6;
    cursor: wait;
}

/* ===== TOAST (powiadomienia) ===== */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(90px);
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 22px;
    font-size: 0.9rem;
    color: var(--text-main);
    box-shadow: 0 8px 30px rgba(0,0,0,0.25);
    z-index: 500;
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    max-width: 90vw;
    text-align: center;
}
.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}
.toast--ok { border-left: 4px solid var(--success); }
.toast--err { border-left: 4px solid var(--error); }

/* ===== PRZYCISKI AKCJI (Ponów + Edytuj) ===== */
.action-btns {
    display: inline-flex;
    gap: 4px;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
}
.btn-edit,
.btn-copy-link,
.btn-copy-button {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 7px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
    white-space: nowrap;
}
.btn-edit:hover,
.btn-copy-link:hover,
.btn-copy-button:hover {
    border-color: var(--text-main);
    color: var(--text-main);
}
/* Przycisk usuwania — wariant destrukcyjny (czerwony na hover) */
.btn-delete:hover {
    border-color: #DC2626;
    color: #DC2626;
}
/* ===== MODAL Z LINKIEM (retry "tylko link") ===== */
.link-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}
.link-modal-overlay.show { display: flex; }
.link-modal {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 28px;
    max-width: 480px;
    width: 100%;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
}
.link-modal h3 {
    margin: 0 0 10px;
    color: var(--text-main);
    font-size: 1.15rem;
}
.link-modal p {
    margin: 0 0 18px;
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
}
.link-modal-row {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}
.link-modal-row input {
    flex: 1;
    min-width: 0;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--bg-color);
    color: var(--text-main);
    font-size: 0.9rem;
}
.link-modal-row .btn-new-payment {
    white-space: nowrap;
    flex-shrink: 0;
}
.link-modal-close {
    width: 100%;
    padding: 11px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.15s;
}
.link-modal-close:hover {
    color: var(--text-main);
    border-color: var(--text-main);
}

/* ===== PRZYCISKI AKCJI TYLKO IKONY ===== */
.btn-icon {
    width: 28px;
    height: 28px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    flex-shrink: 0;
}
.btn-icon svg { width: 13px; height: 13px; }
.btn-icon span { display: none; }

/* ===== PRZYCISK "SKOPIUJ JAKO PRZYCISK" W MODALU ===== */
.link-modal-copybtn {
    width: 100%;
    padding: 11px;
    margin-bottom: 10px;
    border: 1px solid var(--primary);
    border-radius: 9px;
    background: transparent;
    color: var(--primary);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.link-modal-copybtn:hover {
    background: var(--primary);
    color: #fff;
}
/* === Wiadomość dla klienta (pojawia się gdy zaznaczono Wyślij E-mail) === */
.custom-msg-block {
    margin-bottom: 24px;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px;
}
.custom-msg-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}
.custom-msg-head-text {
    display: flex;
    flex-direction: column;
}
.custom-msg-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-main);
}
.custom-msg-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}
/* Przełącznik (switch) */
.custom-msg-switch {
    position: relative;
    width: 42px;
    height: 24px;
    flex-shrink: 0;
}
.custom-msg-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.custom-msg-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--border);
    border-radius: 24px;
    transition: background .2s;
}
.custom-msg-slider:before {
    content: "";
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform .2s;
    box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.custom-msg-switch input:checked + .custom-msg-slider {
    background: var(--primary);
}
.custom-msg-switch input:checked + .custom-msg-slider:before {
    transform: translateX(18px);
}
.custom-msg-switch input:focus-visible + .custom-msg-slider {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
.custom-msg-field {
    margin-top: 14px;
}
.custom-msg-field textarea {
    width: 100%;
    box-sizing: border-box;
    resize: vertical;
    min-height: 70px;
}
.custom-msg-hint {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-muted);
}
/* === Strona statusu transakcji (thankyou.php) === */
.ty-icon { width: 84px; height: 84px; margin: 0 auto 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; position: relative; }
.ty-icon svg { width: 38px; height: 38px; z-index: 1; }
.ty-icon.is-success { background: #ECFDF5; }
.ty-icon.is-success svg { stroke: #059669; }
.ty-icon.is-error { background: #FEF2F2; }
.ty-icon.is-error svg { stroke: #DC2626; }
.ty-icon.is-wait { background: #FFFBEB; }
.ty-icon.is-wait svg { stroke: #D97706; }
.ty-ring { position: absolute; inset: 0; border-radius: 50%; border: 2px solid #FDE68A; animation: ty-pulse 1.8s ease-out infinite; }
@keyframes ty-pulse { 0% { transform: scale(1); opacity: .8; } 100% { transform: scale(1.25); opacity: 0; } }
.ty-check { stroke-dasharray: 48; stroke-dashoffset: 48; animation: ty-draw .5s ease-out .15s forwards; }
@keyframes ty-draw { to { stroke-dashoffset: 0; } }
.ty-spin { animation: ty-rotate 1s linear infinite; transform-origin: center; }
@keyframes ty-rotate { to { transform: rotate(360deg); } }

.ty-btn { display: inline-block; width: 100%; max-width: 280px; box-sizing: border-box; padding: 14px 20px; background: #4F46E5; color: #fff !important; text-decoration: none; border-radius: 11px; font-size: 15px; font-weight: 700; transition: background .15s; }
.ty-btn:hover { background: #4338CA; }
.ty-btn.is-ghost { background: transparent; color: #6B7280 !important; border: 1px solid #E5E7EB; }
.ty-btn.is-ghost:hover { background: #F9FAFB; color: #111827 !important; }

/* === Podstrona kodu QR (qr.php) === */
.pos-wrap {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(1200px 600px at 50% -10%, #E0E7FF 0%, transparent 60%),
        #EEF0FB;
}
.pos-container {
    background: #FFFFFF;
    width: 100%;
    max-width: 460px;
    border-radius: 28px;
    box-shadow: 0 30px 60px -15px rgba(79, 70, 229, 0.25), 0 10px 20px -10px rgba(0,0,0,0.1);
    overflow: hidden;
    text-align: center;
    position: relative;
    animation: pos-in 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes pos-in {
    from { opacity: 0; transform: translateY(16px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.pos-header {
    background: linear-gradient(135deg, #4F46E5 0%, #6366F1 100%);
    color: #fff;
    padding: 38px 24px 34px;
    position: relative;
    overflow: hidden;
}
.pos-header::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(400px 200px at 80% -40%, rgba(255,255,255,0.18), transparent 70%);
    pointer-events: none;
}
.pos-close {
    position: absolute;
    top: 18px;
    right: 18px;
    background: rgba(255,255,255,0.18);
    border: none;
    color: #fff;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 2;
}
.pos-close:hover { background: rgba(255,255,255,0.32); }
.pos-company {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.85;
    margin-bottom: 10px;
}
.pos-header h1 {
    font-size: 27px;
    font-weight: 800;
    letter-spacing: -0.5px;
}
.pos-body { padding: 36px 32px 30px; }
.pos-amount {
    display: inline-block;
    background: #ECFDF5;
    color: #059669;
    padding: 13px 32px;
    border-radius: 100px;
    font-size: 34px;
    font-weight: 800;
    margin-bottom: 10px;
    letter-spacing: -1px;
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.12);
}
.pos-amount span { font-size: 18px; font-weight: 700; opacity: 0.7; }
.pos-desc {
    font-size: 14px;
    color: #6B7280;
    margin-bottom: 30px;
    font-weight: 500;
    word-break: break-word;
}
.qr-wrapper {
    background: #fff;
    padding: 22px;
    border-radius: 24px;
    border: 2px dashed #D1D5DB;
    display: inline-block;
    margin-bottom: 30px;
    position: relative;
    line-height: 0;
}
.qr-wrapper img {
    display: block;
    width: 240px;
    height: 240px;
    image-rendering: pixelated;
    border-radius: 6px;
}
.qr-error {
    display: block;
    width: 240px;
    padding: 90px 10px;
    font-size: 14px;
    line-height: 1.5;
    color: #DC2626;
    font-weight: 600;
}
.pulse-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    border-radius: 24px;
    animation: qr-pulse 2.4s infinite;
    pointer-events: none;
}
@keyframes qr-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.35); }
    70%  { box-shadow: 0 0 0 18px rgba(79, 70, 229, 0); }
    100% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0); }
}
.pos-instruction {
    font-size: 15px;
    color: #6B7280;
    line-height: 1.6;
    font-weight: 500;
    max-width: 340px;
    margin: 0 auto;
}
.pos-instruction strong { color: #111827; font-weight: 700; }
.pos-actions {
    padding: 0 32px 28px;
}
.pos-actions .ty-btn {
    display: block;
    width: 100%;
    max-width: 100%;
    padding: 13px;
    font-size: 14px;
    text-align: center;
}
.pos-footer {
    padding: 18px;
    background: #F9FAFB;
    border-top: 1px solid #F3F4F6;
    font-size: 12.5px;
    color: #6B7280;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    letter-spacing: 0.02em;
}
.pos-footer a { color: inherit; text-decoration: none; }


/* ============================================================
   SIDEBAR NAWIGACYJNY (stats.php) — branding ArenaPay
   Ciemny granat (#0f172a) niezależnie od motywu treści.
   ============================================================ */
:root { --ap-sidebar-w: 270px; }

.ap-layout { display: flex; min-height: 100vh; }

.ap-sidebar {
    width: var(--ap-sidebar-w);
    flex-shrink: 0;
    background: #0f172a;
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 1000;
    overflow-y: auto;
    transition: transform 0.28s cubic-bezier(0.16,1,0.3,1);
}
.ap-sidebar__brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 11px;
    padding: 22px 22px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    text-decoration: none;
    transition: opacity 0.15s;
}
.ap-sidebar__brand:hover { opacity: 0.85; }
.ap-sidebar__brand img { width: 34px; height: 34px; border-radius: 8px; }
.ap-sidebar__brand span {
    font-family: 'Montserrat', sans-serif;
    font-weight: 800;
    font-size: 1.25rem;
    color: #fff;
    letter-spacing: -0.3px;
}
.ap-nav { padding: 14px 12px; flex: 1; }
.ap-nav__label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: #64748b;
    padding: 16px 12px 7px;
}
.ap-nav__label:first-child { padding-top: 4px; }
.ap-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    border-radius: 10px;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
    margin-bottom: 2px;
}
.ap-nav a svg { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.85; }
.ap-nav a:hover { background: rgba(255,255,255,0.06); color: #fff; }
.ap-nav a.is-active {
    background: linear-gradient(135deg, #4F46E5 0%, #6366F1 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(79,70,229,0.35);
}
.ap-nav a.is-active svg { opacity: 1; }
.ap-nav a.is-ext .ap-ext-ico { margin-left: auto; opacity: 0.4; width: 14px; height: 14px; }

.ap-sidebar__footer {
    padding: 16px 20px 20px;
    border-top: 1px solid rgba(255,255,255,0.07);
    font-size: 0.78rem;
    color: #64748b;
    line-height: 1.5;
    text-align: center;
}
.ap-sidebar__footer a { color: #94a3b8; text-decoration: none; }
.ap-sidebar__footer a:hover { color: #fff; }
.ap-sidebar__footer .ap-foot-contact { margin-top: 8px; display: flex; flex-direction: column; align-items: center; gap: 4px; }

/* Główny obszar przesunięty o szerokość sidebara */
.ap-main {
    flex: 1;
    margin-left: var(--ap-sidebar-w);
    min-width: 0;
}

/* Pasek mobilny z hamburgerem (ukryty na desktop) */
.ap-topbar {
    display: none;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    background: #0f172a;
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 900;
}
.ap-topbar__burger {
    background: rgba(255,255,255,0.1);
    border: none;
    color: #fff;
    width: 40px; height: 40px;
    border-radius: 9px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.ap-topbar__logo {
    width: 30px;
    height: 30px;
    border-radius: 7px;
    flex-shrink: 0;
}
.ap-topbar__title {
    font-family: 'Montserrat', sans-serif;
    font-weight: 800;
    font-size: 1.1rem;
}
.ap-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.28s;
}

@media (max-width: 900px) {
    .ap-sidebar { transform: translateX(-100%); width: 280px; }
    .ap-sidebar.is-open { transform: translateX(0); box-shadow: 0 0 40px rgba(0,0,0,0.4); }
    .ap-main { margin-left: 0; }
    .ap-topbar { display: flex; margin-bottom: 22px; }
    .ap-backdrop.is-open { display: block; opacity: 1; }
}


/* ============================================================
   USTAWIENIA (settings.php)
   ============================================================ */

/* ── Nawigacja zakładkowa ── */
.set-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 22px;
    padding: 6px;
    background: var(--card-bg, #fff);
    border: 1px solid var(--border);
    border-radius: 14px;
    position: sticky;
    top: 12px;
    z-index: 20;
}
.set-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 9px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}
.set-tab:hover { color: var(--text-main); background: rgba(127,127,127,0.08); }
.set-tab.active {
    background: var(--primary);
    color: #fff;
}
.set-tab__ico { width: 17px; height: 17px; flex-shrink: 0; }

.set-panel { display: none; animation: setFade 0.2s ease; }
.set-panel.active { display: block; }
@keyframes setFade {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Tytuł panelu (zastępuje powtarzane set-h3 na górze karty) */
.set-panel__head { margin-bottom: 4px; }
.set-panel__title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0 0 4px;
}
.set-panel__sub {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin: 0 0 20px;
    line-height: 1.5;
}

@media (max-width: 720px) {
    .set-tabs { position: static; overflow-x: auto; flex-wrap: nowrap; }
    .set-tab { padding: 9px 13px; font-size: 0.86rem; }
    .set-tab__label { display: inline; }
}

.set-card {
    background: var(--card-bg, #fff);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 26px 28px;
    margin-bottom: 22px;
}

/* Pasek zapisu — przyklejony na dole, zawsze dostępny niezależnie od zakładki */
.set-savebar {
    position: sticky;
    bottom: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 20px;
    background: var(--card-bg, #fff);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 8px 28px rgba(17,24,39,0.12);
    margin-top: 4px;
}
.set-savebtn {
    padding: 12px 28px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 9px;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
}
.set-savebtn:hover { background: var(--primary-hover); }
.set-savebar__note { font-size: 0.85rem; color: var(--text-muted); }

.set-h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 26px 0 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}
.set-h3:first-of-type { margin-top: 0; }

.set-alert {
    padding: 13px 18px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.92rem;
    margin-bottom: 20px;
}
.set-alert--ok  { background: #ECFDF5; color: #059669; border: 1px solid #A7F3D0; }
.set-alert--err { background: #FEF2F2; color: #DC2626; border: 1px solid #FECACA; }

.set-toggles { display: flex; flex-direction: column; gap: 4px; }
.set-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 14px 4px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
}
.set-toggle:last-child { border-bottom: none; }
.set-toggle__info { display: flex; flex-direction: column; gap: 3px; }
.set-toggle__label { font-weight: 600; color: var(--text-main); font-size: 0.95rem; }
.set-toggle__desc { font-size: 0.83rem; color: var(--text-muted); line-height: 1.45; max-width: 560px; }

/* Przełącznik (switch) */
.set-switch { position: relative; flex-shrink: 0; width: 46px; height: 26px; }
.set-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.set-switch__slider {
    position: absolute;
    inset: 0;
    background: #CBD5E1;
    border-radius: 26px;
    transition: background 0.2s;
}
.set-switch__slider::before {
    content: "";
    position: absolute;
    height: 20px; width: 20px;
    left: 3px; top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.set-switch input:checked + .set-switch__slider { background: #4F46E5; }
.set-switch input:checked + .set-switch__slider::before { transform: translateX(20px); }
[data-theme="dark"] .set-switch__slider { background: #475569; }

.set-field { margin-bottom: 16px; }
.set-field__label { display: block; font-weight: 600; color: var(--text-main); font-size: 0.9rem; margin-bottom: 7px; }
.set-select {
    width: 100%;
    max-width: 340px;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--input-bg, #fff);
    color: var(--text-main);
    font-size: 0.95rem;
    font-family: inherit;
}
[data-theme="dark"] .set-select { background: #0f1626; }

.set-actions { display: flex; align-items: center; gap: 16px; margin-top: 24px; }
.set-localnote { font-size: 0.82rem; color: var(--text-muted); }
.set-hint { font-size: 0.86rem; color: var(--text-muted); line-height: 1.5; margin: 0 0 16px; }
.set-hint code { background: rgba(127,127,127,0.12); padding: 2px 6px; border-radius: 5px; font-size: 0.85em; }

/* Drzewo podglądu config */
.cfg-tree {
    font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    font-size: 0.84rem;
    background: rgba(127,127,127,0.05);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 18px;
    overflow-x: auto;
    line-height: 1.65;
}
.cfg-row { display: flex; align-items: baseline; gap: 8px; white-space: nowrap; }
.cfg-group { margin-top: 6px; }
.cfg-group .cfg-key { color: var(--primary); font-weight: 700; }
.cfg-key { color: var(--text-main); font-weight: 600; }
.cfg-sep { color: var(--text-muted); }
.cfg-val { color: #0891B2; }
[data-theme="dark"] .cfg-val { color: #67E8F9; }
.cfg-secret { color: #94A3B8; font-style: italic; letter-spacing: 1px; }
.cfg-bool--on  { color: #059669; font-weight: 700; }
.cfg-bool--off { color: #DC2626; font-weight: 700; }

/* === Ustawienia: pola wpisywane (settings.php) === */
.set-input {
    width: 100%;
    max-width: 420px;
    padding: 10px 13px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--input-bg, #fff);
    color: var(--text-main);
    font-size: 0.94rem;
    font-family: inherit;
    box-sizing: border-box;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.set-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.12);
}
[data-theme="dark"] .set-input { background: #0f1626; }
.set-textarea { max-width: 560px; resize: vertical; min-height: 46px; line-height: 1.5; }
.set-field__hint { display: block; font-size: 0.8rem; color: var(--text-muted); margin-top: 5px; line-height: 1.45; max-width: 560px; }

.set-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px 22px; max-width: 720px; }
.set-grid .set-field { margin-bottom: 0; }

/* Pigułki czasu ważności */
.set-vo { display: flex; flex-direction: column; gap: 10px; max-width: 480px; margin-bottom: 12px; }
.set-vo__row { display: flex; gap: 10px; align-items: center; }
.set-vo__row .set-input:first-child { flex: 1; }
.set-vo__row .set-input:nth-child(2) { width: 120px; flex-shrink: 0; }
.set-vo__del {
    flex-shrink: 0;
    width: 38px; height: 38px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    border-radius: 9px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.15s;
}
.set-vo__del:hover { background: #FEF2F2; color: #DC2626; border-color: #FCA5A5; }
.set-vo__add {
    background: transparent;
    border: 1px dashed var(--border);
    color: var(--primary);
    padding: 9px 16px;
    border-radius: 9px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    font-family: inherit;
    transition: all 0.15s;
}
.set-vo__add:hover { background: rgba(79,70,229,0.06); border-color: var(--primary); }


/* === Ustawienia: sekcje zwijane zależnie od flag === */
.set-section {
    overflow: hidden;
    max-height: 1500px;
    opacity: 1;
    transition: max-height 0.35s ease, opacity 0.25s ease, margin 0.3s ease;
}
.set-section.is-hidden {
    max-height: 0;
    opacity: 0;
    margin: 0;
    pointer-events: none;
}
/* Ukrycie pojedynczego przełącznika (np. wypłata PayU przy innej bramce) */
.set-toggle.is-hidden { display: none; }
/* Ukrycie pojedynczego pola (np. szablon SMS nieaktywnej bramki) */
.set-field.is-hidden { display: none; }

/* === WYPŁATA PayU (stats.php) === */
.btn-payout {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: linear-gradient(135deg, #059669 0%, #10B981 100%);
    color: #fff;
    border: none;
    padding: 9px 16px;
    border-radius: 9px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: filter 0.15s, transform 0.1s;
}
.btn-payout:hover { filter: brightness(1.08); }
.btn-payout:active { transform: translateY(1px); }

.payout-alert {
    padding: 13px 18px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.92rem;
    margin-bottom: 18px;
}
.payout-alert--ok  { background: #ECFDF5; color: #059669; border: 1px solid #A7F3D0; }
.payout-alert--err { background: #FEF2F2; color: #DC2626; border: 1px solid #FECACA; }
[data-theme="dark"] .payout-alert--ok  { background: rgba(16,185,129,0.12); color: #34D399; border-color: rgba(16,185,129,0.3); }
[data-theme="dark"] .payout-alert--err { background: rgba(248,113,113,0.12); color: #F87171; border-color: rgba(248,113,113,0.3); }

/* Modal potwierdzenia wypłaty */
.payout-modal {
    position: fixed; inset: 0; z-index: 2000;
    display: none; align-items: center; justify-content: center;
    padding: 20px;
}
.payout-modal.is-open { display: flex; }
.payout-modal__backdrop {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(2px);
}
.payout-modal__box {
    position: relative;
    background: var(--card-bg, #fff);
    color: var(--text-main);
    border-radius: 16px;
    padding: 28px;
    max-width: 440px; width: 100%;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    border: 1px solid var(--border);
}
.payout-modal__box h3 { margin: 0 0 14px; font-size: 1.25rem; color: var(--text-main); }
.payout-modal__box p { margin: 0 0 12px; line-height: 1.55; color: var(--text-main); font-size: 0.95rem; }
.payout-modal__warn {
    background: rgba(251,191,36,0.12);
    border: 1px solid rgba(251,191,36,0.35);
    color: #B45309;
    padding: 11px 14px;
    border-radius: 9px;
    font-size: 0.88rem !important;
}
[data-theme="dark"] .payout-modal__warn { color: #FBBF24; }
.payout-modal__actions { display: flex; gap: 12px; margin-top: 20px; justify-content: flex-end; }
.btn-payout-cancel {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 10px 18px;
    border-radius: 9px;
    font-weight: 600; font-family: inherit;
    cursor: pointer;
}
.btn-payout-cancel:hover { background: rgba(127,127,127,0.08); }
.btn-payout-confirm {
    background: linear-gradient(135deg, #059669 0%, #10B981 100%);
    color: #fff; border: none;
    padding: 10px 20px;
    border-radius: 9px;
    font-weight: 700; font-family: inherit;
    cursor: pointer;
    transition: filter 0.15s;
}
.btn-payout-confirm:hover { filter: brightness(1.08); }
.btn-payout-confirm--danger {
    background: linear-gradient(135deg, #DC2626 0%, #EF4444 100%);
}


/* === Przełącznik zablokowany przez zależność (np. QR wymaga krótkich linków) === */
.set-toggle.is-disabled { opacity: 0.55; }
.set-toggle.is-disabled .set-switch { cursor: not-allowed; }
.set-toggle.is-disabled .set-switch__slider { background: #94A3B8 !important; }
[data-theme="dark"] .set-toggle.is-disabled .set-switch__slider { background: #475569 !important; }
.set-toggle__req {
    color: #B45309;
    font-weight: 600;
}
[data-theme="dark"] .set-toggle__req { color: #FBBF24; }

/* === Przycisk „do góry" (tylko mobile) === */
.ap-scrolltop {
    position: fixed;
    right: 18px;
    bottom: 18px;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: none;
    background: #4F46E5;
    color: #fff;
    display: none;            /* domyślnie ukryty; pokazywany przez JS na mobile */
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 950;
    box-shadow: 0 6px 18px rgba(79,70,229,0.4);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.25s ease, transform 0.25s ease, background 0.15s;
}
.ap-scrolltop:hover { background: #4338CA; }
.ap-scrolltop.is-visible { opacity: 1; transform: translateY(0); }
.ap-scrolltop svg { width: 22px; height: 22px; }

/* Pokazuj tylko na mobile (gdy sidebar jest chowany za hamburgerem) */
@media (max-width: 900px) {
    .ap-scrolltop.is-visible { display: flex; }
}

/* === Pod-sekcja: pola należące do przełącznika nad nią === */
.set-subsection {
    margin: 2px 0 6px 14px;
    padding-left: 18px;
    border-left: 2px solid var(--border);
}
.set-subsection .set-grid { margin-top: 4px; }
.set-subsection > .set-hint:first-child { margin-top: 4px; }
/* Gdy pod-sekcja jest widoczna (max-height z animacji), dodaj oddech od przełącznika niżej */
.set-subsection:not(.is-hidden) { padding-top: 4px; padding-bottom: 8px; }
/* ===== PASEK BEZPIECZEŃSTWA: ostatnie logowania (stats.php) ===== */
.ap-login-strip {
    display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px;
    background: var(--card-bg); border: 1px solid var(--border);
    border-radius: 10px; padding: 10px 16px; margin-bottom: 20px;
    text-decoration: none; color: var(--text-main); font-size: 13px;
    transition: border-color .15s, box-shadow .15s;
}
.ap-login-strip:hover { border-color: var(--primary); box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.ap-login-strip__ico { display: inline-flex; color: var(--text-muted); flex-shrink: 0; }
.ap-login-strip__item b { font-weight: 600; color: var(--text-muted); margin-right: 4px; }
.ap-login-strip__item--fail b { color: #DC2626; }
.ap-login-strip__meta { color: var(--text-muted); font-family: monospace; font-size: 12px; }
.ap-login-strip__sep { width: 1px; align-self: stretch; background: var(--border); margin: -4px 0; }
.ap-login-strip__more { margin-left: auto; color: var(--primary); font-weight: 600; font-size: 12px; }
/* Akcent gdy ostatnia nieudana próba w ostatnich 24h */
.ap-login-strip--alert { border-color: #DC2626; background: rgba(220,38,38,.04); }
.ap-login-strip--alert .ap-login-strip__item--fail { font-weight: 600; }
[data-theme="dark"] .ap-login-strip__item--fail b { color: #F87171; }
[data-theme="dark"] .ap-login-strip--alert { border-color: #F87171; background: rgba(248,113,113,.06); }
@media (max-width: 640px) {
    .ap-login-strip__sep { display: none; }
    .ap-login-strip__more { margin-left: 0; width: 100%; }
}
/* ===================== ZAKŁADKA: POWIADOMIENIA ===================== */
/* Macierz zdarzeń: label | E-mail | SMS | switch. Reużywa --card-bg/--border/--accent. */
.notif-grp {
    display: flex; align-items: center; gap: 8px;
    font-size: .76rem; letter-spacing: .05em; text-transform: uppercase;
    font-weight: 700; color: var(--text-muted);
    padding: 4px 0 10px; margin: 0;
}
.notif-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.notif-dot--guest { background: #34D399; }
.notif-dot--op    { background: #60A5FA; }
.notif-dot--adm   { background: #F472B6; }

.notif-row {
    display: grid;
    grid-template-columns: 1fr 60px 60px 56px;
    align-items: center; gap: 8px;
    padding: 13px 0; border-bottom: 1px solid var(--border);
}
.notif-row:last-child { border-bottom: none; }
.notif-row--head { padding: 6px 0; border-bottom: 1px solid var(--border); }
.notif-col-h {
    font-size: .7rem; text-transform: uppercase; letter-spacing: .04em;
    color: var(--text-muted); text-align: center; font-weight: 700;
}
.notif-ev__label { font-weight: 600; color: var(--text-main); font-size: .94rem; }
.notif-ev__desc { font-size: .82rem; color: var(--text-muted); margin-top: 2px; line-height: 1.4; max-width: 440px; }

/* badge „wymaga cron” */
.notif-badge {
    display: inline-block; font-size: .66rem; font-weight: 700;
    padding: 2px 7px; border-radius: 5px; margin-left: 6px; vertical-align: middle;
    background: rgba(245,158,11,.15); color: #B45309;
}
[data-theme="dark"] .notif-badge { color: #FBBF24; }

/* tryb op_paid: pigułki radio */
.notif-mode { display: flex; gap: 8px; margin-top: 9px; flex-wrap: wrap; }
.notif-mode__pill {
    font-size: .76rem; padding: 5px 11px; border-radius: 7px;
    border: 1px solid var(--border); color: var(--text-muted);
    cursor: pointer; background: var(--input-bg); user-select: none;
    display: inline-flex; align-items: center;
    transition: border-color .15s, background .15s, color .15s;
}
.notif-mode__pill input { position: absolute; opacity: 0; width: 0; height: 0; }
.notif-mode__pill:hover {
    border-color: #2563EB; color: var(--text-main);
}
/* Stan wybrany oparty wyłącznie na radio:checked (przez :has) — radio jest
   zaznaczany serwerowo na właściwej opcji, a klik przełącza widok natychmiast,
   bez JS i bez czekania na zapis. Klasa .is-active nie jest już potrzebna do wyglądu. */
.notif-mode__pill:has(input:checked) {
    border-color: #2563EB; color: var(--text-main);
    background: rgba(37,99,235,.14);
}

/* Kanał SMS niedostępny dla zdarzenia (np. Awaria bramki SMS) — kreska zamiast checkboxa. */
.notif-chk-na { color: var(--text-muted); opacity: .5; font-weight: 700; user-select: none; }

/* checkboxy kanałów — różne kolory: e-mail niebieski, SMS czerwony */
.notif-chk-cell { display: flex; justify-content: center; }
.notif-chk { position: relative; cursor: pointer; display: block; }
.notif-chk input { position: absolute; opacity: 0; width: 0; height: 0; }
.notif-chk__box {
    display: block; width: 26px; height: 26px; border-radius: 7px;
    border: 1.5px solid var(--border); background: var(--input-bg);
    transition: all .15s; position: relative;
}
.notif-chk__box::after {
    content: ""; position: absolute; left: 8px; top: 4px;
    width: 6px; height: 11px; border: solid #fff; border-width: 0 2.5px 2.5px 0;
    transform: rotate(45deg) scale(0); transition: transform .15s;
}
.notif-chk--email input:checked + .notif-chk__box {
    background: #2563EB; border-color: #2563EB;
}
.notif-chk--sms input:checked + .notif-chk__box {
    background: #E11D48; border-color: #E11D48;
}
.notif-chk input:checked + .notif-chk__box::after { transform: rotate(45deg) scale(1); }

/* master switch */
.notif-sw-cell { display: flex; justify-content: center; }
.notif-sw { position: relative; width: 40px; height: 22px; display: block; cursor: pointer; }
.notif-sw input { position: absolute; opacity: 0; width: 0; height: 0; }
.notif-sw__track {
    position: absolute; inset: 0; background: #9CA3AF; border-radius: 999px; transition: .2s;
}
[data-theme="dark"] .notif-sw__track { background: #374151; }
.notif-sw__thumb {
    position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
    background: #fff; border-radius: 50%; transition: .2s; pointer-events: none;
}
.notif-sw input:checked + .notif-sw__track {
    background: linear-gradient(135deg, #E11D48, #2563EB);
}
.notif-sw input:checked ~ .notif-sw__thumb { transform: translateX(18px); }

/* pola odbiorcy: 2 kolumny */
.notif-fields {
    display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
    padding-top: 16px; margin-top: 6px; border-top: 1px solid var(--border);
}
.notif-fields .set-field { margin-bottom: 0; }

/* WYSZARZANIE kolumny SMS gdy brak bramki: JS dodaje .notif-sms-off na <body>/panel */
.notif-sms-off [data-requires-sms] .notif-chk { opacity: .3; pointer-events: none; }
.notif-sms-off [data-requires-sms] .set-input { opacity: .45; pointer-events: none; }
.notif-sms-off .notif-col-h:nth-child(3) { opacity: .4; }

@media (max-width: 640px) {
    .notif-row { grid-template-columns: 1fr 48px 48px 46px; gap: 4px; }
    .notif-ev__desc { max-width: none; }
    .notif-fields { grid-template-columns: 1fr; }
}

/* Pasek statusu bramki SMS na górze panelu Powiadomienia */
.notif-status {
    display: flex; align-items: center; gap: 10px;
    padding: 11px 16px; border-radius: 10px; margin-bottom: 18px;
    font-size: .88rem; line-height: 1.45; border: 1px solid var(--border);
}
.notif-status__dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.notif-status--on  { background: rgba(16,185,129,.10); border-color: rgba(16,185,129,.35); color: var(--text-main); }
.notif-status--on  .notif-status__dot { background: #10B981; box-shadow: 0 0 0 3px rgba(16,185,129,.18); }
.notif-status--off { background: rgba(245,158,11,.10); border-color: rgba(245,158,11,.35); color: var(--text-main); }
.notif-status--off .notif-status__dot { background: #F59E0B; box-shadow: 0 0 0 3px rgba(245,158,11,.18); }
.notif-status strong { font-weight: 700; }
/* === Prowizja: badge przy kwocie + karta (stats.php) === */
.comm-badge {
    display: inline-block;
    font-size: 0.72rem;
    color: #92400E;
    background: #FEF3C7;
    border-radius: 5px;
    padding: 1px 6px;
    margin-left: 6px;
    font-weight: 600;
    vertical-align: middle;
    white-space: nowrap;
}
[data-theme="dark"] .comm-badge { color: #FCD34D; background: rgba(217,119,6,0.18); }

/* === Prowizja: ostrzeżenie prawne (settings.php) === */
.set-warn-legal {
    margin: 2px 0 14px;
    padding: 11px 15px 11px 16px;
    border-left: 3px solid #D97706;
    background: #FFFBEB;
    border-radius: 0 8px 8px 0;
    font-size: 0.83rem;
    color: #92400E;
    line-height: 1.5;
    max-width: 680px;
}
[data-theme="dark"] .set-warn-legal { background: rgba(217,119,6,0.12); color: #FCD34D; border-left-color: #D97706; }
