body {
    font-family: Arial, sans-serif;
    background: #f5f7fa;
    margin: 0;
    padding: 15px;
    transform: translateZ(0);
}

/* Main card */
.container {
    max-width: 700px;
    margin: 0 auto;
    background: white;
    padding: 18px;
    border-radius: 14px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.08);
}

h1 {
    font-size: 26px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 25px;
}

/* Form controls */
.form {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    margin-bottom: 12px;
}

input {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 5px;
}

#nazwa { flex: 2; }
#ilosc { flex: 1; }

.form input {
    flex: 1;
    min-width: 120px;
}

.add {
    background: greenyellow;
    width: 100%;
    margin-top: 6px;
}

/* Filters row */
.filters {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 12px;
}

.filters button {
    background: #eeeeee;
}

.filters button.active {
    background: #d1d5db;
}

#lista {
    width: 100%;
    padding: 0;
    margin: 0;
    list-style: none;
}

/* Product item (shared) */
.produkt {
    list-style: none;
    margin-bottom: 14px;
}

.produkt.kupione {
    background: #f3f4f6;
    border-color: #e5e7eb;
    box-shadow: inset 3px 0 0 #22c55e;
}

.produkt.kupione .nazwa,
.produkt.kupione .ilosc {
    color: #6b7280;
}

.produkt.kupione .edit,
.produkt.kupione .delete,
.produkt.kupione .number,
.produkt.kupione .sort,
.produkt.kupione .plus,
.produkt.kupione .minus {
    opacity: 0.55;
}

.produkt-top,
.produkt-controls,
.produkt-actions {
    display: contents;
}

.nazwa {
    font-size: 20px;
    min-width: 0;
    word-break: break-word;
    justify-content: flex-start;
    justify-self: start;
}

.ilosc {
    text-align: center;
    font-size: 20px;
    font-weight: 600;
}

button {
    font-weight: 600;
    padding: 10px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.delete {
    background: #ef4444;
    color: white;
}

.edit {
    background: lightblue;
}

.number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: lightcyan;
}

.sort {
    width: 40px;
    height: 40px;
    background: #eeeeee;
    display: flex;
    align-items: center;
    justify-content: center;
}

.edit,
.delete {
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 100%;
}

.checkbox {
    width: 20px;
    height: 20px;
}

.produkt {
    display: grid;
    grid-template-columns: 40px 30px minmax(0, 1fr) 40px 60px 40px;
    grid-template-rows: auto auto;
    justify-content: stretch;
    justify-items: stretch;
    align-items: center;
    box-sizing: border-box;
    width: 100%;
    padding: 12px;
    border: 1px solid #eee;
    border-radius: 12px;
    gap: 10px;
    background: #fafafa;
    transition: opacity 200ms ease, transform 200ms ease;
}

.produkt.usuwany {
    opacity: 0;
    transform: scale(0.98);
}

.sort-up { grid-column: 1; grid-row: 1; }
.checkbox { grid-column: 2; grid-row: 1; }
.nazwa { grid-column: 3; grid-row: 1; }

.minus { grid-column: 4; grid-row: 1; }
.ilosc { grid-column: 5; grid-row: 1; }
.plus { grid-column: 6; grid-row: 1; }

.sort-down { grid-column: 1; grid-row: 2; }

.sort-up,
.sort-down,
.checkbox,
.plus,
.minus {
    align-self: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.edit {
    grid-column: 2 / 4;
    grid-row: 2;
    justify-self: stretch;
}

.delete {
    grid-column: 4 / 7;
    grid-row: 2;
    justify-self: stretch;
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%) translateY(8px);
    background: #111827;
    color: #f9fafb;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 200ms ease, transform 200ms ease;
    z-index: 1000;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Desktop layout */
@media (min-width: 769px) {
    body {
        padding: 40px 15px;
    }

    .container {
        max-width: 900px;
        padding: 35px;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    h1 {
        font-size: 30px;
    }

    .form,
    .filters,
    #lista {
        width: 100%;
        max-width: 400px;
    }

    .form {
        flex-wrap: nowrap;
        gap: 10px;
    }

    .form input {
        min-width: 0;
    }

    .add {
        width: auto;
        margin-top: 0;
    }

    .filters {
        display: flex;
        justify-content: center;
    }

    .filters button {
        flex: 1;
    }

    #lista {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .produkt {
        grid-template-columns: 40px 30px minmax(0, 1fr) 40px 70px 40px;
        width: 100%;
        max-width: 400px;
        margin-bottom: 12px;
    }

    .number,
    .sort {
        width: 32px;
        height: 32px;
    }

    .edit,
    .delete {
        height: auto;
        width: auto;
    }

    .checkbox {
        width: auto;
        height: auto;
    }
}

.toast.success {
    background: #16a34a;
}

.toast.error {
    background: #dc2626;
}