.spm-textbooks {
    --spm-books-green: #4e7250;
    --spm-books-green-dark: #3f6142;
    --spm-books-green-mid: #5b7d5d;
    --spm-books-border: #cfd9cb;
    --spm-books-row: #f5f9f1;
    --spm-books-text: #173f35;
    --spm-books-muted: #4a5e56;
    padding: 28px 0 50px;
}

.spm-textbooks,
.spm-textbooks * {
    box-sizing: border-box;
}

.spm-textbooks__top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 28px;
    margin: 0 0 18px;
    padding: 0 0 18px;
    border-bottom: 0;
}

.spm-textbooks__top h2 {
    margin: 0;
    color: var(--spm-books-text);
    font-size: clamp(1.7rem, 3vw, 2.4rem);
    line-height: 1.12;
}

.spm-textbooks__title-block {
    display: block;
}

.spm-textbooks__school-year {
    margin-top: 8px;
    color: var(--spm-books-green);
    font-size: clamp(1.35rem, 2.3vw, 1.9rem);
    font-weight: 900;
    line-height: 1.1;
}

.spm-textbooks a.spm-textbooks__download {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 230px;
    min-height: 48px;
    padding: 11px 18px;
    border: 0;
    border-radius: 9px;
    background: var(--spm-books-green);
    color: #fff;
    font-weight: 800;
    text-align: center;
    text-decoration: none;
    box-shadow: 0 6px 15px rgba(23, 97, 62, .18);
}

.spm-textbooks a.spm-textbooks__download:visited,
.spm-textbooks a.spm-textbooks__download:hover,
.spm-textbooks a.spm-textbooks__download:focus,
.spm-textbooks a.spm-textbooks__download:focus-visible,
.spm-textbooks a.spm-textbooks__download:active {
    color: #fff;
}

.spm-textbooks a.spm-textbooks__download:hover,
.spm-textbooks a.spm-textbooks__download:focus-visible {
    background: var(--spm-books-green-dark);
}

.spm-textbooks__tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 18px;
}

.spm-textbooks__tabs a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 18px;
    border: 1px solid #cbdabb;
    border-radius: 8px;
    background: linear-gradient(180deg, #fff 0%, #f2f7ed 100%);
    color: #173f35;
    font-size: .84rem;
    font-weight: 900;
    text-decoration: none;
    box-shadow: 0 3px 8px rgba(45, 78, 54, .05);
    transition: background-color .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.spm-textbooks__tabs a:hover,
.spm-textbooks__tabs a:focus-visible {
    border-color: var(--spm-books-green);
    background: var(--spm-books-green);
    color: #fff;
    box-shadow: 0 6px 14px rgba(78, 114, 80, .18);
}

.spm-textbooks__tabs a.is-active,
.spm-textbooks__tabs a[aria-current="true"] {
    border-color: var(--spm-books-green);
    background: var(--spm-books-green);
    color: #fff;
    box-shadow: 0 7px 16px rgba(78, 114, 80, .2);
}

/* Jeden spójny komponent klasy: nagłówek + tabela. */
.spm-textbooks__class {
    margin: 0 0 28px;
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--spm-books-border);
    border-radius: 12px;
    background: #fff;
}

.spm-textbooks__class-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 0;
    padding: 15px 18px;
    border: 0;
    background: var(--spm-books-green);
    color: #fff;
    font-weight: 800;
}

.spm-textbooks__class-heading span:first-child {
    font-size: 1.22rem;
}

.spm-textbooks__class-heading span:last-child {
    font-size: .82rem;
    opacity: .9;
}

.spm-textbooks__table-wrap {
    margin: 0;
    padding: 0;
    overflow-x: auto;
}

/*
 * Izolacja od globalnych reguł .entry-content table.
 * Celowo podnosimy specyficzność do zakresu modułu, ale bez !important.
 */
.entry-content .spm-textbooks table.spm-textbooks__table,
.spm-textbooks table.spm-textbooks__table {
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    border-spacing: 0;
    border-collapse: collapse;
    background: transparent;
    box-shadow: none;
    overflow: visible;
    font-size: .93rem;
}

.entry-content .spm-textbooks table.spm-textbooks__table thead,
.entry-content .spm-textbooks table.spm-textbooks__table tbody,
.entry-content .spm-textbooks table.spm-textbooks__table tr,
.entry-content .spm-textbooks table.spm-textbooks__table th,
.entry-content .spm-textbooks table.spm-textbooks__table td {
    border-radius: 0;
    box-shadow: none;
}

.entry-content .spm-textbooks table.spm-textbooks__table th,
.spm-textbooks table.spm-textbooks__table th {
    padding: 11px 12px;
    border-top: 1px solid rgba(255, 255, 255, .28);
    border-right: 1px solid rgba(255, 255, 255, .2);
    border-bottom: 0;
    background: var(--spm-books-green-mid);
    color: #fff;
    font-size: .82rem;
    font-weight: 800;
    text-align: left;
}

.entry-content .spm-textbooks table.spm-textbooks__table th:last-child,
.spm-textbooks table.spm-textbooks__table th:last-child {
    border-right: 0;
}

.spm-textbooks__table th:nth-child(1) { width: 14%; }
.spm-textbooks__table th:nth-child(2) { width: 16%; }
.spm-textbooks__table th:nth-child(3) { width: 38%; }
.spm-textbooks__table th:nth-child(4) { width: 32%; }

.entry-content .spm-textbooks table.spm-textbooks__table td,
.spm-textbooks table.spm-textbooks__table td {
    padding: 12px;
    border-top: 0;
    border-right: 1px solid #dbe2d8;
    border-bottom: 1px solid #dbe2d8;
    border-left: 0;
    background: #fff;
    color: inherit;
    vertical-align: top;
    line-height: 1.4;
}

.entry-content .spm-textbooks table.spm-textbooks__table td:last-child,
.spm-textbooks table.spm-textbooks__table td:last-child {
    border-right: 0;
}

.entry-content .spm-textbooks table.spm-textbooks__table tbody tr:nth-child(even) td,
.spm-textbooks table.spm-textbooks__table tbody tr:nth-child(even) td {
    background: var(--spm-books-row);
}

.entry-content .spm-textbooks table.spm-textbooks__table tbody tr:last-child td,
.spm-textbooks table.spm-textbooks__table tbody tr:last-child td {
    border-bottom: 0;
}

.spm-textbooks__table td:first-child {
    color: #174d3c;
    font-weight: 800;
}

.spm-textbooks__notes {
    margin: 0;
    padding: 16px 18px;
    border: 1px solid #e5c658;
    border-radius: 10px;
    background: #fff9df;
    color: #554812;
    line-height: 1.55;
}

@media (max-width: 760px) {
    .spm-textbooks__top {
        flex-direction: column;
    }

    .spm-textbooks a.spm-textbooks__download {
        width: 100%;
        min-width: 0;
    }

    .entry-content .spm-textbooks table.spm-textbooks__table thead,
    .spm-textbooks table.spm-textbooks__table thead {
        display: none;
    }

    .entry-content .spm-textbooks table.spm-textbooks__table,
    .entry-content .spm-textbooks table.spm-textbooks__table tbody,
    .entry-content .spm-textbooks table.spm-textbooks__table tr,
    .entry-content .spm-textbooks table.spm-textbooks__table td,
    .spm-textbooks table.spm-textbooks__table,
    .spm-textbooks table.spm-textbooks__table tbody,
    .spm-textbooks table.spm-textbooks__table tr,
    .spm-textbooks table.spm-textbooks__table td {
        display: block;
        width: 100%;
    }

    .entry-content .spm-textbooks table.spm-textbooks__table tr,
    .spm-textbooks table.spm-textbooks__table tr {
        padding: 10px 0;
        border: 0;
        border-bottom: 1px solid #dbe2d8;
        background: #fff;
    }

    .entry-content .spm-textbooks table.spm-textbooks__table tr:nth-child(even),
    .spm-textbooks table.spm-textbooks__table tr:nth-child(even) {
        background: var(--spm-books-row);
    }

    .entry-content .spm-textbooks table.spm-textbooks__table td,
    .spm-textbooks table.spm-textbooks__table td {
        display: grid;
        grid-template-columns: 120px 1fr;
        gap: 10px;
        padding: 7px 14px;
        border: 0;
        background: transparent;
    }

    .spm-textbooks__table td::before {
        content: attr(data-label);
        color: var(--spm-books-green);
        font-size: .78rem;
        font-weight: 900;
    }
}


/* 4.4.99 — nagłówek modułu Podręczniki spójny z Kalendarzem */
.spm-school-textbooks__intro,
.spm-school-textbooks__header,
.spm-textbooks__intro,
.spm-textbooks__header {
    border-bottom: 0;
}

.spm-school-textbooks__intro::after,
.spm-school-textbooks__header::after,
.spm-textbooks__intro::after,
.spm-textbooks__header::after {
    content: none;
    display: none;
}


.spm-textbooks__tabs a:first-child {
    border-color: var(--spm-books-green);
    background: var(--spm-books-green);
    color: #fff;
    box-shadow: 0 7px 16px rgba(78, 114, 80, .2);
}
