.timetable-card,
.timetable-editor-card {
    padding: 18px;
}

.timetable-title {
    margin: 0 0 18px;
    text-align: center;
}

.timetable-title h2 {
    margin: 0;
    color: var(--navy);
    text-transform: uppercase;
}

.timetable-title p {
    margin: 6px 0 0;
    color: var(--muted);
    font-weight: 700;
}

.timetable {
    width: 100%;
    min-width: 980px;
    border-collapse: collapse;
    table-layout: fixed;
}

.timetable th,
.timetable td {
    padding: 10px 8px;
    border: 1px solid #82909a;
    line-height: 1.25;
    text-align: center;
    vertical-align: middle;
    white-space: normal;
}

.timetable thead th {
    background: #d5e6f2;
    color: #132b40;
    font-size: 13px;
    text-transform: uppercase;
}

.timetable th:first-child {
    width: 145px;
    background: #f3f5f6;
}

.timetable tbody td {
    height: 74px;
    font-weight: 600;
}

.timetable .category-scolaire { background: #9dbde0; }
.timetable .category-educatif { background: #fff47a; }
.timetable .category-recreation { background: #d9ead3; font-weight: 800; }
.timetable .category-repas { background: #fff0c5; font-weight: 800; }
.timetable .category-therapeutique { background: #e8dcf2; }
.timetable .category-transport { background: #e5e9ec; }

.signature-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    margin-top: 26px;
}

.signature-grid > div {
    min-height: 88px;
    padding: 13px;
    border: 1px solid #82909a;
    text-align: center;
}

.timetable-editor th:first-child { width: 180px; }
.timetable-editor td { padding: 5px; }

.timetable-editor textarea {
    width: 100%;
    min-height: 92px;
    padding: 8px;
    resize: vertical;
    border: 1px solid #9dacb7;
    border-radius: 7px;
    background: rgba(255,255,255,.82);
}

.timetable-editor select,
.timetable-editor input {
    width: 100%;
    padding: 7px;
    border: 1px solid #9dacb7;
    border-radius: 7px;
    background: white;
}

.timetable-editor thead th:not(:first-child) {
    position: relative;
    padding-right: 38px;
}

.timetable-editor thead input {
    font-weight: 800;
    text-align: center;
}

.planning-toolbar {
    display: flex;
    gap: 9px;
    margin: 4px 0 18px;
    flex-wrap: wrap;
}

.icon-btn {
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid #9dacb7;
    border-radius: 8px;
    background: white;
    color: var(--danger);
    font-size: 22px;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
}

.timetable-editor thead .icon-btn {
    position: absolute;
    top: 50%;
    right: 5px;
    transform: translateY(-50%);
}

.row-style {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.row-style label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
}

.row-style input[type="color"] {
    width: 44px;
    height: 32px;
    padding: 2px;
}

.time-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
    margin-bottom: 7px;
}

.planning-save {
    position: sticky;
    bottom: 14px;
    margin-top: 18px;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(245,248,250,.96);
    box-shadow: var(--shadow);
}

.planning-child-picker {
    display: flex;
    align-items: end;
    gap: 14px;
}

.planning-child-picker .field {
    flex: 1;
}

.mobile-slot-title {
    display: none;
}

@media (max-width: 900px) {
    .signature-grid { min-width: 720px; }
}

@media (max-width: 700px) {
    .planning-child-picker {
        display: grid;
    }

    .planning-child-picker .btn,
    .planning-save .btn {
        width: 100%;
    }

    .planning-table-wrap {
        overflow: visible;
    }

    .timetable-editor {
        display: block;
        min-width: 0;
    }

    .timetable-editor thead {
        display: block;
        margin-bottom: 16px;
        border: 1px solid #82909a;
        border-radius: 12px;
        background: #d5e6f2;
    }

    .timetable-editor thead tr { margin: 0; border: 0; }
    .timetable-editor thead th:first-child { display: none; }
    .timetable-editor thead th:not(:first-child) { padding: 9px 42px 9px 9px; border-bottom: 1px solid #82909a; }
    .timetable-editor thead th:last-child { border-bottom: 0; }

    .timetable-editor tbody,
    .timetable-editor tr,
    .timetable-editor th,
    .timetable-editor td {
        display: block;
        width: 100%;
    }

    .timetable-editor tr {
        margin-bottom: 18px;
        overflow: hidden;
        border: 1px solid #82909a;
        border-radius: 12px;
    }

    .timetable-editor th,
    .timetable-editor th:first-child {
        width: 100%;
        padding: 12px;
        border: 0;
        border-bottom: 1px solid #82909a;
    }

    .mobile-slot-title {
        display: block;
        margin-bottom: 9px;
        color: var(--navy);
        text-align: left;
    }

    .timetable-editor td {
        height: auto;
        padding: 10px;
        border: 0;
        border-bottom: 1px solid rgba(76,91,102,.35);
        text-align: left;
    }

    .timetable-editor td:last-child {
        border-bottom: 0;
    }

    .timetable-editor td::before {
        display: block;
        margin: 0 0 6px;
        color: #132b40;
        content: attr(data-day);
        font-size: 13px;
        font-weight: 800;
        text-transform: uppercase;
    }

    .timetable-editor textarea {
        min-height: 72px;
    }

    .planning-save {
        display: grid;
        position: static;
    }
}
