* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, sans-serif;
    background-color: #f0f4f8;
    margin: 0;
    padding: 20px;
    color: #333;
    -webkit-text-size-adjust: 100%;
}

.wrapper {
    max-width: 960px;
    margin: 0 auto;
}

.naglowek {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #2c3e50;
    color: #fff;
    padding: 15px 25px;
    border-radius: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.naglowek h1 {
    margin: 0;
    font-size: 20px;
}

.nawigacja {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.btn-powrot, .btn-usun-strona, .btn-wyloguj {
    color: #fff;
    text-decoration: none;
    padding: 9px 14px;
    border-radius: 5px;
    font-size: 14px;
    font-weight: bold;
    text-align: center;
    display: inline-block;
}

.btn-powrot {
    background: #27ae60;
}
.btn-powrot:hover {
    background: #219150;
}

.btn-usun-strona {
    background: #e74c3c;
}
.btn-usun-strona:hover {
    background: #c0392b;
}

.btn-wyloguj {
    background: #7f8c8d;
}
.btn-wyloguj:hover {
    background: #636e72;
}

.karta {
    background: #fff;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    margin-bottom: 25px;
}

h2 {
    margin-top: 0;
    color: #2c3e50;
    border-bottom: 2px solid #27ae60;
    padding-bottom: 10px;
    font-size: 18px;
}

h2.naglowek-usun {
    color: #c0392b;
    border-bottom: 2px solid #e74c3c;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    font-size: 14px;
    color: #34495e;
}

input, select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccd1d9;
    border-radius: 5px;
    font-size: 16px;
    background-color: #fff;
}

input:focus, select:focus {
    border-color: #27ae60;
    outline: none;
}

button.btn-zapisz {
    width: 100%;
    padding: 13px;
    background-color: #27ae60;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 15px;
}
button.btn-zapisz:hover {
    background-color: #219150;
}

.btn-usun {
    background-color: #e74c3c;
    color: white;
    border: none;
    padding: 8px 14px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    font-weight: bold;
}
.btn-usun:hover {
    background-color: #c0392b;
}

.alert {
    padding: 12px;
    border-radius: 5px;
    margin-bottom: 15px;
    text-align: center;
    font-weight: 500;
}
.sukces {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}
.blad {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 15px;
}

th, td {
    padding: 12px 10px;
    text-align: left;
    border-bottom: 1px solid #e1e8ed;
    white-space: nowrap;
}

th {
    background-color: #f8f9fa;
    color: #2c3e50;
    font-weight: 600;
}

tr:hover {
    background-color: #f4f8fb;
}

.tabela-usun tr:hover {
    background-color: #fdf2f2;
}

.kwota {
    text-align: right;
    font-family: monospace;
    font-size: 15px;
}

.akcje {
    text-align: center;
}

.brak-danych {
    text-align: center;
    color: #7f8c8d;
    padding: 20px;
}

tfoot tr {
    background-color: #eafaf1;
    font-weight: bold;
    border-top: 2px solid #27ae60;
}

.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 15px;
}

.login-box {
    background: #fff;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 380px;
    text-align: center;
}

/* ==================================================
   DOSTOSOWANIE DO TELEFONÓW I TABLETÓW (EKRAN < 768px)
   ================================================== */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .naglowek {
        flex-direction: column;
        align-items: stretch;
        padding: 15px;
        text-align: center;
    }

    .naglowek h1 {
        font-size: 18px;
        margin-bottom: 5px;
    }

    .nawigacja {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .nawigacja a:last-child {
        grid-column: span 2;
    }

    .karta {
        padding: 15px;
        margin-bottom: 15px;
        border-radius: 8px;
    }

    h2 {
        font-size: 16px;
    }

    .form-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    table {
        font-size: 14px;
    }

    th, td {
        padding: 10px 8px;
    }

    /* Wygodniejsze przewijanie tabel na telefonie */
    div[style*="overflow-x"] {
        -webkit-overflow-scrolling: touch;
        border-radius: 6px;
        border: 1px solid #e1e8ed;
    }

    .rachunek-naglowek {
        flex-direction: column;
        align-items: flex-start !important;
        padding: 12px 15px !important;
    }

    .rachunek-naglowek h2 {
        font-size: 18px !important;
    }

    .btn-drukuj {
        width: 100%;
        text-align: center;
    }
}
