/* ==========================================================================
   WSPÓLNE ZMIENNE I BAZA
   ========================================================================== */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --bg-color: #f4f6f9;
    --text-color: #333;
    --success: #28a745;
    --danger: #e74c3c;
    --warning: #ffc107;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

h1, h2, h3 { color: var(--primary-color); }

/* --- Wspólne Przyciski --- */
.btn {
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none; 
    display: inline-block;
    transition: background 0.3s, transform 0.2s; 
    font-weight: bold;
    text-align: center;
    box-sizing: border-box;
}
.btn:hover { transform: translateY(-1px); }

/* --- Wspólne Alerty --- */
.alert { padding: 15px; margin-bottom: 20px; border-radius: 5px; }
.alert.success, .success { background: #d4edda; color: #155724; border-left: 5px solid var(--success); }
.alert.error, .error { background: #f8d7da; color: #721c24; border-left: 5px solid var(--danger); margin-bottom: 15px; font-weight: bold; }

/* --- Wspólne Formularze --- */
input[type="text"], input[type="password"], input[type="email"], input[type="date"], select {
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 5px; 
    font-size: 16px;
    font-family: inherit;
    width: 100%;
    box-sizing: border-box;
}

textarea {
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 16px;
    font-family: inherit;
    width: 100%;
    box-sizing: border-box;
    resize: vertical;
}

.site-footer {
    margin-top: 8px;
    padding: 0 20px 24px;
}

.site-footer-inner {
    max-width: 1180px;
    margin: 0 auto;
    text-align: center;
}

.site-footer p {
    margin: 0;
    color: #6f7f8d;
    font-size: 14px;
}

/* ==========================================================================
   UKŁAD 1: STRONA GŁÓWNA (index.php)
   ========================================================================== */
body.page-index {
    background:
        radial-gradient(circle at top left, rgba(52, 152, 219, 0.18), transparent 28%),
        radial-gradient(circle at bottom right, rgba(44, 62, 80, 0.16), transparent 30%),
        linear-gradient(180deg, #eef5fb 0%, #f7f9fc 55%, #eef3f8 100%);
}

body.page-index .container { max-width: 1180px; margin: 0 auto; padding: 42px 20px 56px; }
.hero { text-align: center; background: #fff; padding: 50px 30px; border-radius: 12px; box-shadow: 0 5px 20px rgba(0,0,0,0.05); margin-bottom: 40px; }
.hero.hero-split {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
    gap: 32px;
    align-items: center;
    text-align: left;
    background: linear-gradient(135deg, rgba(255,255,255,0.98) 0%, rgba(244,248,252,0.96) 100%);
    border: 1px solid rgba(214, 225, 236, 0.95);
    box-shadow: 0 24px 60px rgba(30, 55, 90, 0.10);
    overflow: hidden;
    position: relative;
}

.hero.hero-split::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, rgba(52, 152, 219, 0.08), transparent 45%, rgba(44, 62, 80, 0.06));
    pointer-events: none;
}

.hero-copy,
.hero-visual {
    position: relative;
    z-index: 1;
}

.hero-copy {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.hero h1 { font-size: 48px; line-height: 1.05; margin: 0; letter-spacing: -0.03em; }
.hero p { font-size: 18px; color: #506172; max-width: 640px; margin: 0; }
.btn-download { background: var(--secondary-color); color: #fff; padding: 15px 30px; font-size: 18px; margin-right: 10px; }
.btn-download:hover { background: #2980b9; }
.btn-coffee { background: #ffdd00; color: #000; border: 1px solid #e6c800; padding: 15px 30px; font-size: 18px; display: inline-flex; align-items: center; gap: 8px; }
.btn-coffee:hover { background: #ffea4d; }
.hero-tag { display: inline-block; background: #e8f4fd; color: #1d4f7a; padding: 8px 14px; border-radius: 999px; font-size: 13px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; margin-bottom: 4px; align-self: flex-start; }
.hero-actions { display: flex; justify-content: flex-start; gap: 14px; flex-wrap: wrap; }
.btn-index-primary { background: linear-gradient(135deg, #3498db 0%, #2f80c8 100%); color: #fff; padding: 14px 24px; font-size: 16px; min-width: 220px; box-shadow: 0 12px 24px rgba(52, 152, 219, 0.22); }
.btn-index-primary:hover { background: #2980b9; }
.btn-index-secondary { background: rgba(238, 242, 247, 0.9); color: var(--primary-color); border: 1px solid #d8e1ea; padding: 14px 24px; font-size: 16px; min-width: 220px; }
.btn-index-secondary:hover { background: #e3ebf3; }
.hero-pills { display: flex; flex-wrap: wrap; gap: 10px; }
.hero-pill { background: rgba(255,255,255,0.86); color: #314355; border: 1px solid #dbe6f0; border-radius: 999px; padding: 10px 14px; font-size: 13px; font-weight: 700; }
.hero-image-card {
    position: relative;
    padding: 26px;
    border-radius: 28px;
    background: linear-gradient(160deg, #fefefe 0%, #edf4fa 100%);
    border: 1px solid rgba(210, 223, 236, 0.95);
    box-shadow: 0 18px 40px rgba(44, 62, 80, 0.12);
}

.hero-image {
    width: 100%;
    display: block;
    border-radius: 18px;
    background: #fff;
}

.hero-image-badge {
    position: absolute;
    max-width: 220px;
    background: rgba(44, 62, 80, 0.92);
    color: #fff;
    padding: 12px 14px;
    border-radius: 14px;
    font-size: 13px;
    font-weight: 700;
    box-shadow: 0 12px 24px rgba(20, 29, 38, 0.22);
}

.badge-top { top: 14px; right: 14px; }
.badge-bottom { left: 14px; bottom: 14px; background: rgba(52, 152, 219, 0.96); }

.section { background: rgba(255,255,255,0.94); padding: 35px; border-radius: 22px; box-shadow: 0 16px 40px rgba(30,55,90,0.08); margin-bottom: 32px; border: 1px solid rgba(220,229,238,0.95); }
.section h2 { margin: 0; font-size: 30px; letter-spacing: -0.02em; }
.section-soft { background: linear-gradient(180deg, rgba(255,255,255,0.97), rgba(247,250,253,0.95)); }
.section-dark-accent {
    background: linear-gradient(135deg, rgba(37, 59, 79, 0.97) 0%, rgba(49, 80, 108, 0.96) 100%);
    color: #eef5fb;
}

.section-dark-accent h2,
.section-dark-accent h3,
.section-dark-accent .section-kicker,
.section-dark-accent .feature-card p {
    color: inherit;
}

.section-heading {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 24px;
}

.section-kicker {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #5f7287;
}

.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; margin-top: 20px; }
.feature-card { background: rgba(255,255,255,0.10); padding: 24px; border-radius: 18px; border: 1px solid rgba(255,255,255,0.12); backdrop-filter: blur(4px); }
.feature-card h3 { margin: 0 0 10px 0; font-size: 18px; }
.feature-card p { margin: 0; font-size: 14px; color: #dce7f2; }
.feature-icon,
.portal-icon,
.info-icon {
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    font-size: 22px;
    margin-bottom: 14px;
}

.feature-icon {
    background: rgba(255,255,255,0.14);
}

.portal-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.portal-card { background: linear-gradient(180deg, #ffffff 0%, #f7fafc 100%); border: 1px solid #dbe5ef; border-radius: 18px; padding: 24px; box-shadow: 0 8px 24px rgba(44, 62, 80, 0.06); }
.portal-card h3 { margin: 0 0 10px 0; }
.portal-card p { margin: 0 0 18px 0; color: #5b6670; }
.portal-meta { display: block; font-size: 13px; color: #6b7280; margin-bottom: 14px; }
.portal-card .btn { width: 100%; }
.portal-icon { background: #eaf4fd; }
.portal-card-admin .portal-icon { background: #e8f1fb; }
.portal-card-user .portal-icon { background: #eef6f1; }
.info-grid-index { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.info-card-index { background: #f8fafc; border: 1px solid #e5edf5; border-radius: 18px; padding: 22px; }
.info-card-index h3 { margin: 0 0 10px 0; font-size: 18px; }
.info-card-index p { margin: 0; color: #5f6b76; }
.info-icon { background: #eaf3fb; }
.system-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.system-card { background: #f8fafc; border: 1px solid #dfe9f2; border-radius: 16px; padding: 20px; }
.system-card strong { display: block; margin-bottom: 10px; color: #22384d; }
.system-card p { margin: 0; color: #5f6b76; }
.license-box { background: linear-gradient(135deg, #e8f4fd 0%, #f3f9fe 100%); padding: 22px; border-radius: 16px; border: 1px solid #bce0fd; margin-top: 22px; color: #314355; }
.license-box strong { color: var(--secondary-color); }
.section-contact {
    background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(243,248,252,0.96) 100%);
}

.contact-layout {
    display: grid;
    grid-template-columns: minmax(260px, 0.9fr) minmax(0, 1.1fr);
    gap: 24px;
    align-items: start;
}

.contact-copy {
    background: linear-gradient(135deg, #253b4f 0%, #31506c 100%);
    color: #edf5fb;
    border-radius: 20px;
    padding: 28px;
    box-shadow: 0 18px 35px rgba(37, 59, 79, 0.18);
}

.contact-copy h3 {
    color: #fff;
    margin: 0 0 12px 0;
    font-size: 24px;
}

.contact-copy p {
    margin: 0 0 18px 0;
    color: #dbe8f3;
}

.contact-icon {
    width: 60px;
    height: 60px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 18px;
    font-size: 28px;
    background: rgba(255,255,255,0.14);
    margin-bottom: 16px;
}

.contact-points {
    margin: 0;
    padding-left: 18px;
}

.contact-points li {
    margin-bottom: 10px;
    color: #e4eef6;
}

.contact-form-card {
    background: #fff;
    border: 1px solid #dce6ef;
    border-radius: 20px;
    padding: 26px;
    box-shadow: 0 14px 34px rgba(34, 56, 77, 0.08);
}

.contact-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.contact-form .form-group {
    margin-bottom: 16px;
}

.contact-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
    color: #253b4f;
}

.contact-form input,
.contact-form textarea {
    border: 1px solid #ccd8e4;
    border-radius: 12px;
    padding: 13px 14px;
    box-shadow: inset 0 1px 2px rgba(31, 48, 64, 0.03);
}

.contact-form input:focus,
.contact-form textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.12);
}

.contact-submit {
    width: 100%;
    margin-top: 8px;
}

.spam-trap {
    position: absolute;
    left: -9999px;
    opacity: 0;
    pointer-events: none;
}
.changelog-item { margin-bottom: 25px; padding-left: 20px; border-left: 2px solid #ddd; position: relative; }
.changelog-item::before { content: ''; position: absolute; left: -6px; top: 5px; width: 10px; height: 10px; background: var(--secondary-color); border-radius: 50%; }
.changelog-version { font-weight: bold; color: var(--primary-color); font-size: 18px; margin-bottom: 5px; display: block; }
.changelog-date { font-size: 13px; color: #888; margin-left: 10px; font-weight: normal; }
.changelog-list { margin: 10px 0 0 0; padding-left: 20px; color: #555; }
.changelog-list li { margin-bottom: 5px; }
.badge-new { background: #2ecc71; color: white; padding: 2px 6px; border-radius: 4px; font-size: 11px; font-weight: bold; margin-right: 5px; vertical-align: middle; }
.badge-fix { background: #f39c12; color: white; padding: 2px 6px; border-radius: 4px; font-size: 11px; font-weight: bold; margin-right: 5px; vertical-align: middle; }

@media (max-width: 768px) {
    body.page-index .container { padding: 24px 14px 34px; }
    .hero { padding: 26px 18px; }
    .hero.hero-split { grid-template-columns: 1fr; gap: 24px; }
    .hero h1 { font-size: 34px; }
    .hero p { font-size: 16px; }
    .hero-actions { flex-direction: column; }
    .btn-index-primary, .btn-index-secondary { width: 100%; min-width: 0; }
    .hero-image-badge { position: static; max-width: none; margin-top: 12px; display: block; }
    .section { padding: 24px 18px; border-radius: 18px; }
    .section h2 { font-size: 25px; }
    .contact-layout,
    .contact-grid { grid-template-columns: 1fr; }
    .contact-copy,
    .contact-form-card { padding: 20px; }
    .site-footer { padding: 0 14px 22px; }
}

/* ==========================================================================
   UKŁAD 2: STRONY AKTYWACJI I ZAKUPU ORAZ LOGOWANIA
   ========================================================================== */
body.page-auth { display: flex; flex-direction: column; justify-content: center; align-items: center; min-height: 100vh; padding: 15px; box-sizing: border-box; overflow: visible; }
body.page-auth .container, .login-box { background: #fff; padding: 40px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,0.1); max-width: 450px; width: 100%; text-align: center; overflow: visible; }
body.page-auth .site-footer { width: 100%; margin-top: auto; padding-left: 0; padding-right: 0; }
body.page-auth h1 { font-size: 24px; margin-top: 0; margin-bottom: 5px; }
body.page-auth h2 { color: #007bff; font-size: 32px; margin: 10px 0 20px 0; }
.hwid-box { background: #eef2f5; padding: 15px; font-family: monospace; font-size: 18px; color: #000; border-radius: 6px; border: 1px dashed #b0bec5; margin: 15px 0; letter-spacing: 2px; }
.status { font-weight: bold; font-size: 16px; margin: 20px 0; padding: 10px; border-radius: 6px; background: #fff3cd; color: #856404; }
.status.active { background: #d4edda; color: #155724; }
.features { text-align: left; margin: 25px 0; padding: 0; list-style: none; }
.features li { margin-bottom: 10px; font-size: 15px; }
.features li::before { content: "✔️"; margin-right: 10px; color: var(--success); }
.form-group { text-align: left; margin-bottom: 20px; overflow: visible; }
.form-group label { display: block; font-weight: bold; margin-bottom: 8px; color: var(--primary-color); }
.btn-trial { background: #007bff; color: white; padding: 12px 20px; font-size: 16px; width: 100%; }
.btn-buy { background: var(--success); color: white; margin-top: 15px; padding: 15px 20px; font-size: 18px; width: 100%; }
.btn-paypal { background: #003087; color: white; margin-top: 10px; padding: 15px 20px; font-size: 18px; width: 100%; }
.btn-paypal:hover { background: #001c52; }
.info { font-size: 13px; color: #6c757d; margin-top: 30px; border-top: 1px solid #dee2e6; padding-top: 15px; text-align: left; }
.loader { border: 4px solid #f3f3f3; border-top: 4px solid #007bff; border-radius: 50%; width: 40px; height: 40px; animation: spin 1s linear infinite; margin: 20px auto; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* ==========================================================================
   UKŁAD 3: PANEL ZARZĄDZANIA
   ========================================================================== */
body.page-panel { padding: 15px; }
body.page-panel .container { max-width: 1300px; margin: 0 auto; }
.header { background: #fff; padding: 20px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); margin-bottom: 20px; display: flex; justify-content: space-between; flex-wrap: wrap; align-items: center; gap: 15px; }
.header-title h1 { margin: 0 0 10px 0; font-size: 22px; }
.stats { display: inline-block; font-size: 14px; background: var(--secondary-color); color: white; padding: 6px 12px; border-radius: 15px; font-weight: bold; margin-top: 5px; }

/* Przycisk wyloguj */
.logout { background:#f8d7da; color:#e74c3c!important; padding:8px 15px; border-radius:6px; text-decoration:none!important; font-weight:bold; font-size:13px; display:inline-block; transition:0.3s; border:1px solid #f5c6cb; text-align: center; } 
.logout:hover { background:#e74c3c; color:#fff!important; text-decoration:none!important; transform:translateY(-2px); }

.search-box { background: #fff; padding: 20px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); margin-bottom: 20px; display: flex; align-items: center; gap: 10px; }
.search-box button, .search-box a.clear { padding: 10px 20px; text-align: center; font-size: 16px; white-space: nowrap; flex-shrink: 0; }
.search-box button { background: var(--primary-color); color: white; }
.search-box a.clear { background: #95a5a6; color: white; }

/* Tabela */
.table-wrapper { width: 100%; overflow-x: auto; overflow-y: visible; background: #fff; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); }
table { width: 100%; border-collapse: collapse; min-width: 1050px; position: relative; }
th, td { padding: 12px 10px; text-align: left; border-bottom: 1px solid #eee; vertical-align: middle; box-sizing: border-box; }
th { background: var(--primary-color); color: white; font-weight: 500; font-size: 14px; }
tr:hover { background: #f8f9fa; }

/* --- Wyszukiwarka i Licznik (Licencje) --- */
.table-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.total-licenses {
    background: #e8f4fd;
    color: #2c3e50;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: bold;
    border: 1px solid #bce0fd;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}

.total-licenses span {
    background: #3498db;
    color: white;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 14px;
}

.modern-search {
    flex-grow: 1;
    max-width: 550px;
    position: relative;
}

.modern-search input {
    width: 100%;
    padding: 14px 20px 14px 45px !important;
    border: 2px solid #e1e8ed !important;
    border-radius: 30px !important;
    font-size: 15px !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
    transition: 0.3s;
    box-sizing: border-box;
    background: #fff;
}

.modern-search input:focus {
    border-color: #3498db !important;
    outline: none;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.15);
}

.modern-search::before {
    content: '\1F50D'; /* Ikonka lupy w bezpiecznym formacie unicode */
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    pointer-events: none;
    z-index: 1;
    opacity: 0.6;
}

/* Łamanie HWID w domyślnym widoku PC */
.input-hwid { font-family: monospace; font-weight: bold; background: transparent; border: none; color: #333; padding: 0; width: 100%; box-sizing: border-box; word-break: break-all; }

.action-btns { display: flex; gap: 6px; flex-wrap: nowrap; min-width: 145px; }
.action-btns button { flex: 0 0 auto; white-space: nowrap; padding: 8px 12px; font-size: 13px; border: none; border-radius: 5px; color: white; box-sizing: border-box; cursor: pointer; }
.action-btns button:hover { transform: translateY(-1px); }

.btn-save { background: #27ae60; padding: 8px 10px; font-size: 13px; border: none; border-radius: 5px; color: white; }
.btn-delete { background: var(--danger); padding: 8px 10px; font-size: 13px; border: none; border-radius: 5px; color: white; }
.btn-toggle { background: #007bff; padding: 8px 10px; font-size: 13px; border: none; border-radius: 5px; color: white; }
.btn-toggle.btn-activate { background: #2ecc71; }
.btn-toggle.btn-deactivate { background: #e74c3c; }

@media (max-width: 768px) {
    .action-btns { flex-direction: column; }
    .action-btns button { width: 100%; }
}

.app-label { font-size: 12px; background: #eee; padding: 3px 6px; border-radius: 4px; font-weight: bold; color: #555; }

/* Badges */
.badge-t, .badge-f, .badge-s, .badge-exp { 
    color: white; padding: 4px 10px; border-radius: 12px; font-size: 12px; 
    font-weight: bold; display: inline-block; text-align: center; 
    width: fit-content !important; margin-bottom: 5px; 
}
.badge-t { background: var(--secondary-color); }
.badge-f { background: #2ecc71; }
.badge-s { background: #9b59b6; }
.badge-exp { background: #e67e22; }
.badge-active { background: #2ecc71; color: white; padding: 4px 10px; border-radius: 12px; font-size: 12px; font-weight: bold; display: inline-block; text-align: center; width: fit-content !important; margin-bottom: 5px; }
.badge-inactive { background: var(--danger); color: white; padding: 4px 10px; border-radius: 12px; font-size: 12px; font-weight: bold; display: inline-block; text-align: center; width: fit-content !important; margin-bottom: 5px; }

/* --- ZAKŁADKI I FORMULARZ CENNIKA --- */
.tabs { margin-bottom: 20px; display: flex; gap: 10px; }
.tabs a { padding: 10px 20px; background: #fff; color: var(--primary-color); text-decoration: none; border-radius: 8px; font-weight: bold; box-shadow: 0 2px 5px rgba(0,0,0,0.05); transition: 0.2s; }
.tabs a:hover { background: #f0f2f5; }
.tabs a.active { background: var(--secondary-color); color: #fff; }
.input-price { font-weight: bold; font-size: 16px; text-align: center; }

.add-program-box { 
    background: #e8f4fd; border: 1px solid #bce0fd; padding: 15px 20px; 
    border-radius: 8px; margin-bottom: 20px; display: flex; gap: 10px; 
    flex-wrap: nowrap; align-items: center; overflow-x: auto;
}
.add-program-box strong { color: var(--primary-color); white-space: nowrap; }
.add-program-box input[name="nowy_app_name"] { flex-grow: 1; min-width: 250px; }
.add-program-box button { white-space: nowrap; flex-shrink: 0; padding: 10px 20px; }
.add-program-box input { background: #fff; color: #1a1a1a; }
.add-program-box input::placeholder { color: #9ca3af; opacity: 1; }

/* Kody form */
.kody-form label.form-label { display: block; font-size: 12px; font-weight: 600; color: #555; margin-bottom: 3px; margin-top: 8px; }
.kody-form select, .kody-form input[type="number"], .kody-form input[type="text"], .kody-form input[type="date"] { width: 100%; padding: 7px 9px; font-size: 13px; border: 1px solid #ccc; border-radius: 5px; box-sizing: border-box; margin-bottom: 0; }
.kody-form .inline-row { display: flex; gap: 10px; align-items: flex-end; }
.kody-form .inline-row > div { flex: 1; min-width: 0; }

@media (max-width: 768px) {
    .kody-cards {
        display: block !important;
    }

    .kody-form {
        width: 100% !important;
        max-width: none !important;
        min-width: 0 !important;
        box-sizing: border-box;
        margin-bottom: 16px;
    }
}

/* ==========================================================================
   UKŁAD 4: STATYSTYKI, USTAWIENIA I DZIENNIK
   ========================================================================== */
.kpi-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-bottom: 30px; }
@media (max-width: 1100px) { .kpi-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px)  { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }
.kpi-card { background: #fff; padding: 20px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); text-align: center; border-bottom: 4px solid var(--secondary-color); }
.kpi-card h3 { margin: 0; font-size: 14px; color: #7f8c8d; text-transform: uppercase; letter-spacing: 1px; }
.kpi-card .val { font-size: 28px; font-weight: bold; color: var(--primary-color); margin: 10px 0 5px 0; }
.kpi-card .sub { font-size: 12px; color: #95a5a6; }
.charts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); gap: 20px; margin-bottom: 30px; }
.chart-box { background: #fff; padding: 20px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); }

/* Integracje */
.integration-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 20px;
}

.integration-card {
    background: #fff;
    padding: 24px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    border-top: 4px solid #3498db;
}

.integration-card h2,
.integration-card h3 {
    margin-top: 0;
}

.integration-note {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-left: 4px solid #2ecc71;
    border-radius: 6px;
    padding: 12px 14px;
    font-size: 14px;
    color: #495057;
}

.integration-code {
    background: #1f2933;
    color: #d9e2ec;
    border-radius: 8px;
    padding: 14px;
    font-family: Consolas, Monaco, 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-x: auto;
}

.integration-table {
    width: 100%;
    min-width: 0;
    border-collapse: collapse;
    margin-top: 10px;
}

.integration-table th,
.integration-table td {
    border-bottom: 1px solid #eceff1;
    padding: 9px 8px;
    font-size: 14px;
}

.integration-table th {
    background: #f4f7fb;
    color: #2c3e50;
}

/* Ustawienia Kolumnowe (Masonry) */
.settings-grid { 
    column-count: 3; 
    column-gap: 20px; 
}
.settings-card { 
    background: #fff; 
    padding: 30px; 
    border-radius: 8px; 
    box-shadow: 0 2px 10px rgba(0,0,0,0.05); 
    box-sizing: border-box; 
    width: 100%; 
    break-inside: avoid;
    margin-bottom: 20px;
    display: inline-block; 
}
.settings-card h2 { margin-top: 0; font-size: 20px; margin-bottom: 20px; }
.settings-card label.form-label { display: block; margin-bottom: 8px; font-weight: bold; color: var(--primary-color); font-size: 14px; }

/* Dziennik Zdarzeń - Specyficzne Style */
.log-row-error { color: #c0392b; font-weight: bold; background: #fdf2f2 !important; }
.log-row-zakup { color: #27ae60; font-weight: bold; background: #f2fdf5 !important; }
.log-badge { font-size: 11px; padding: 2px 6px; border-radius: 4px; color: #fff; text-transform: uppercase; }
.log-badge.login { background: #34495e; }
.log-badge.zakup { background: #27ae60; }
.log-badge.error { background: #e74c3c; }
.log-badge.info { background: #3498db; }

/* Style dla powiadomień e-mail */
.title-email { color: #16a085; }

.check-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    padding: 15px;
    background: #f8f9fa;
    border: 1px solid #eee;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    color: #2c3e50;
    transition: background 0.2s;
    min-height: 48px;
}

.check-container:hover { background: #f1f2f6; }

.check-container input[type="checkbox"] {
    width: 22px;
    height: 22px;
    cursor: pointer;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .check-container {
        padding: 12px;
        font-size: 15px;
        gap: 10px;
    }
    .check-container input[type="checkbox"] {
        width: 22px;
        height: 22px;
    }
    .check-container span {
        font-size: 14px;
    }
}

/* ==========================================================================
   MEDIA QUERIES (Responsywność)
   ========================================================================== */
@media (max-width: 1024px) {
    .settings-grid { column-count: 2; }
}

@media (max-width: 768px) {
    /* Ogólne */
    body.page-index .btn { display: block; margin: 10px 0; width: 100%; text-align: center; }
    
    /* Panel zarządzania (Układ 3) */
    body.page-panel .header { flex-direction: column; align-items: stretch; }
    body.page-panel .tabs { flex-wrap: wrap; }
    body.page-panel .tabs a { flex: 1 1 calc(50% - 10px); text-align: center; padding: 12px 5px; font-size: 14px; box-sizing: border-box; }
    body.page-panel .logout { margin-top: 15px; display: block; text-align: center; }
    body.page-panel .search-box { flex-direction: column; align-items: stretch; }
    body.page-panel .search-box button, body.page-panel .search-box a.clear { width: 100%; display: block; white-space: normal; }
    
    .add-program-box { flex-direction: column; align-items: stretch; }
    .add-program-box input { width: 100% !important; margin-bottom: 10px; }
    
    body.page-panel tr form { display: flex; flex-direction: column; gap: 10px; padding: 10px 0; }
    body.page-panel td input, body.page-panel td select { width: 100% !important; max-width: none !important; margin-bottom: 5px; }
    body.page-panel .edit-name-input { font-weight: bold; background: #f1f2f6; }

    table { min-width: 0 !important; }
    body.page-panel .table-wrapper { background: transparent; box-shadow: none; overflow: visible; }
    body.page-panel table, body.page-panel thead, body.page-panel tbody, body.page-panel th, body.page-panel td, body.page-panel tr { display: block; width: 100%; box-sizing: border-box; }
    body.page-panel thead { display: none; } 
    body.page-panel tr { border: 1px solid #ddd; border-radius: 8px; margin-bottom: 20px; background: #fff; padding: 10px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
    body.page-panel td { border: none; padding: 10px 5px; display: flex; flex-direction: column; text-align: left; word-break: break-all; }
    body.page-panel td::before { content: attr(data-label); font-weight: bold; color: #7f8c8d; margin-bottom: 5px; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; }
    
    .charts-grid { grid-template-columns: 1fr; }
    .settings-grid { column-count: 1; }
    .table-controls { flex-direction: column; align-items: stretch; }
    .modern-search { max-width: 100%; }

    /* Panel użytkownika - Licencje (Układ 5) */
    .client-header { flex-direction: column; text-align: center; justify-content: center; }
    .client-header > div { margin-bottom: 15px; }
    .license-header { flex-direction: column; align-items: flex-start; }
    .action-bar { flex-direction: column; }
    .btn-action, .btn-outline { width: 100%; justify-content: center; text-align: center; }
    .info-grid { grid-template-columns: 1fr; }
}

/* ==========================================================================
   MEDIA QUERIES (Responsywność)
   ========================================================================== */
@media (max-width: 1024px) {
    .settings-grid { column-count: 2; }
}

@media (max-width: 768px) {
    body.page-index .btn { display: block; margin: 10px 0; width: 100%; text-align: center; }
    body.page-panel .header { flex-direction: column; align-items: stretch; }
    body.page-panel .tabs { flex-wrap: wrap; }
    body.page-panel .tabs a { flex: 1 1 calc(50% - 10px); text-align: center; padding: 12px 5px; font-size: 14px; box-sizing: border-box; }
    body.page-panel .logout { margin-top: 15px; display: block; text-align: center; }
    body.page-panel .search-box { flex-direction: column; align-items: stretch; }
    body.page-panel .search-box button, body.page-panel .search-box a.clear { width: 100%; display: block; white-space: normal; }
    
    .add-program-box { flex-direction: column; align-items: stretch; }
    .add-program-box input { width: 100% !important; margin-bottom: 10px; }
    
    /* Poprawka dla rozjeżdżających się pól w cenniku na telefonach */
    body.page-panel tr form { display: flex; flex-direction: column; gap: 10px; padding: 10px 0; }
    body.page-panel td input, body.page-panel td select { width: 100% !important; max-width: none !important; margin-bottom: 5px; }
    body.page-panel .edit-name-input { font-weight: bold; background: #f1f2f6; }

    table { min-width: 0 !important; }
    body.page-panel .table-wrapper { background: transparent; box-shadow: none; overflow: visible; }
    body.page-panel table, body.page-panel thead, body.page-panel tbody, body.page-panel th, body.page-panel td, body.page-panel tr { display: block; width: 100%; box-sizing: border-box; }
    body.page-panel thead { display: none; } 
    body.page-panel tr { border: 1px solid #ddd; border-radius: 8px; margin-bottom: 20px; background: #fff; padding: 10px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
    body.page-panel td { border: none; padding: 10px 5px; display: flex; flex-direction: column; text-align: left; word-break: break-all; }
    body.page-panel td::before { content: attr(data-label); font-weight: bold; color: #7f8c8d; margin-bottom: 5px; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; }
    
    .charts-grid { grid-template-columns: 1fr; }
    .settings-grid { column-count: 1; }

    .table-controls { flex-direction: column; align-items: stretch; }
    .modern-search { max-width: 100%; }
}

/* ========================================================================== 
   UKLAD 5: PANEL UZYTKOWNIKA (mojekonto.php)
   ========================================================================== */
body.page-dashboard {
    padding: 15px;
}

body.page-dashboard .container {
    max-width: 1300px;
    margin: 0 auto;
}

body.page-dashboard .client-header {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    align-items: center;
    gap: 15px;
}

body.page-dashboard .client-tabs {
    margin-bottom: 20px;
}

body.page-dashboard .client-tabs a {
    min-width: 160px;
    text-align: center;
}

body.page-dashboard .client-header h1 {
    margin: 0 0 10px 0;
    font-size: 22px;
    color: var(--primary-color);
}

body.page-dashboard .user-email {
    display: block;
    color: #7f8c8d;
    font-size: 14px;
    font-weight: 600;
}

body.page-dashboard .btn-logout {
    background: #f8d7da;
    color: #e74c3c;
    padding: 8px 15px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: bold;
    font-size: 13px;
    display: inline-block;
    transition: 0.3s;
    border: 1px solid #f5c6cb;
    text-align: center;
}

body.page-dashboard .btn-logout:hover {
    background: #e74c3c;
    color: #fff;
    transform: translateY(-2px);
}

body.page-dashboard .license-card {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 20px;
    border: 1px solid #edf2f7;
}

body.page-dashboard .client-sales-table table {
    min-width: 900px;
}

body.page-dashboard .license-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    padding-bottom: 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
}

body.page-dashboard .app-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--primary-color);
}

body.page-dashboard .info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

body.page-dashboard .info-item {
    display: flex;
    flex-direction: column;
}

body.page-dashboard .info-label {
    font-size: 12px;
    color: #95a5a6;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 8px;
    font-weight: bold;
}

body.page-dashboard .info-value {
    font-size: 15px;
    font-weight: 600;
    color: #2c3e50;
    word-break: break-word;
}

body.page-dashboard .assign-form {
    background: #f8fafc;
    padding: 20px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-top: 10px;
}

body.page-dashboard .assign-form p {
    margin-top: 0;
    font-size: 14px;
    color: #475569;
    line-height: 1.5;
}

body.page-dashboard .assign-select,
body.page-dashboard .assign-input-manual {
    width: 100%;
    margin-bottom: 15px;
}

body.page-dashboard .update-box {
    background: #fffbeb;
    border-left: 4px solid #f59e0b;
    padding: 20px;
    border-radius: 6px;
    margin-top: 20px;
}

body.page-dashboard .update-box h4 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #b45309;
    font-size: 16px;
}

body.page-dashboard .update-box ol {
    margin: 0 0 15px 0;
    padding-left: 20px;
    color: #78350f;
    font-size: 14px;
    line-height: 1.6;
}

body.page-dashboard .btn-update {
    background: #f59e0b;
    color: #fff;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: bold;
    text-decoration: none;
    display: inline-block;
    font-size: 14px;
    transition: 0.3s;
}

body.page-dashboard .btn-update:hover {
    background: #d97706;
}

body.page-dashboard .action-bar {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    padding-top: 20px;
    border-top: 1px solid #edf2f7;
}

body.page-dashboard .btn-outline {
    background: transparent;
    border: 2px solid #94a3b8;
    color: #64748b;
    padding: 12px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
    box-sizing: border-box;
}

body.page-dashboard .btn-outline:hover {
    background: #f1f5f9;
    color: #0f172a;
    border-color: #64748b;
}

body.page-dashboard .btn-action {
    background: #22c55e;
    color: #fff;
    padding: 12px 20px;
    border-radius: 6px;
    font-weight: bold;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    cursor: pointer;
    transition: 0.3s;
    font-size: 14px;
    box-sizing: border-box;
}

body.page-dashboard .btn-action:hover {
    background: #16a34a;
    transform: translateY(-1px);
}

@media (max-width: 768px) {
    body.page-dashboard .client-header {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    body.page-dashboard .license-header {
        flex-direction: column;
        align-items: flex-start;
    }

    body.page-dashboard .info-grid {
        grid-template-columns: 1fr;
    }

    body.page-dashboard .client-tabs {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
    }

    body.page-dashboard .client-tabs a {
        flex: 1 1 calc(50% - 10px);
        min-width: 0;
        box-sizing: border-box;
    }

    body.page-dashboard .action-bar {
        flex-direction: column;
    }

    body.page-dashboard .action-bar form {
        width: 100%;
        margin: 0;
    }

    body.page-dashboard .btn-action,
    body.page-dashboard .btn-outline,
    body.page-dashboard .btn-update,
    body.page-dashboard .btn-logout {
        width: 100%;
        justify-content: center;
        text-align: center;
        box-sizing: border-box;
    }

    body.page-dashboard .license-card {
        padding: 20px;
    }

    body.page-dashboard .client-sales-table {
        background: transparent;
        box-shadow: none;
        overflow: visible;
    }

    body.page-dashboard .client-sales-table table,
    body.page-dashboard .client-sales-table thead,
    body.page-dashboard .client-sales-table tbody,
    body.page-dashboard .client-sales-table th,
    body.page-dashboard .client-sales-table td,
    body.page-dashboard .client-sales-table tr {
        display: block;
        width: 100%;
        box-sizing: border-box;
    }

    body.page-dashboard .client-sales-table thead {
        display: none;
    }

    body.page-dashboard .client-sales-table tr {
        border: 1px solid #ddd;
        border-radius: 8px;
        margin-bottom: 16px;
        background: #fff;
        padding: 10px;
        box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    }

    body.page-dashboard .client-sales-table td {
        border: none;
        padding: 8px 5px;
        display: flex;
        flex-direction: column;
        text-align: left;
        word-break: break-all;
    }

    body.page-dashboard .client-sales-table td::before {
        content: attr(data-label);
        font-weight: bold;
        color: #7f8c8d;
        margin-bottom: 4px;
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: 1px;
    }
}

/* Ukrycie formularza po wysłaniu maila */
.login-box .alert.success ~ form,
.login-box .alert.success ~ p {
    display: none;
}