:root {
    font-family: system-ui, -apple-system, Segoe UI, sans-serif;
    color: #183044;
    background: #f3f7f9;
}

* { box-sizing: border-box; }
body { margin: 0; }

header { background: #073c54; color: white; padding: 22px 0; }
.wrap { max-width: 1200px; margin: auto; padding: 0 22px; }
.top, .toolbar, .toolbar > div, .actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.eyebrow { letter-spacing: .2em; font-size: 11px; color: #9fd5dd; }
h1 { font-size: 25px; margin: 6px 0; }
h1 span { font-size: 15px; font-weight: 400; color: #c2dce5; margin-left: 12px; }

button {
    cursor: pointer;
    border: 1px solid #d3e0e6;
    background: white;
    color: #164057;
    padding: 10px 14px;
    border-radius: 9px;
    font: inherit;
}
button:hover, .active { background: #e0f2f5; }
button.primary, #new, button[type=submit] {
    background: #087b91;
    color: white;
    border-color: #087b91;
}
button:disabled { opacity: .45; cursor: not-allowed; }
.toolbar { margin: 24px 0; }
.toolbar strong { font-size: 20px; min-width: 180px; text-align: center; text-transform: capitalize; }

/* Deux panneaux côte à côte sur toutes les tailles d'écran */
.layout {
    display: grid;
    grid-template-columns: minmax(0, 35fr) minmax(0, 65fr);
    gap: 20px;
    align-items: start;
}
.main-panel, .detail {
    min-width: 0;
    background: white;
    border: 1px solid #e0e9ed;
    border-radius: 16px;
    padding: 18px;
    box-shadow: 0 5px 24px #103a4b0a;
}
.detail { align-self: start; position: sticky; top: 20px; }

.weekdays, .days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.weekdays { text-align: center; color: #728693; font-size: 12px; font-weight: 700; margin-bottom: 9px; }
.day { min-width: 0; min-height: 104px; border: 1px solid #e8eef1; border-radius: 9px; padding: 7px; text-align: left; overflow: hidden; }
.day.other { background: #f7f9fa; opacity: .45; }
.day.today { border-color: #078aa1; }
.day.selected { outline: 2px solid #078aa1; }
.number { font-size: 13px; font-weight: 700; }
.event { display: block; background: #e0f3f3; color: #07566c; border-radius: 5px; padding: 4px; margin-top: 5px; font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.event small { display: block; color: #43737b; }

.entry { display: block; width: 100%; text-align: left; margin: 8px 0; padding: 14px; overflow-wrap: anywhere; }
.entry strong { display: block; }
.entry small, .muted { color: #708692; }
h2 { font-size: 19px; margin: 0 0 12px; }
.names { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0; }
.chip { padding: 6px 9px; border-radius: 20px; background: #edf5f6; font-size: 13px; }
#error { color: #a83232; }

dialog { border: 0; border-radius: 16px; padding: 25px; width: min(430px, 95vw); box-shadow: 0 20px 90px #0004; }
dialog::backdrop { background: #052b3b88; }
label { display: block; margin: 12px 0; }
input, textarea { width: 100%; border: 1px solid #cbdbe1; border-radius: 8px; padding: 10px; font: inherit; margin-top: 5px; }

.participant-select { width: 100%; padding: 12px; margin: 12px 0; border: 1px solid #cbd5e1; border-radius: 8px; background: white; }
.remove-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.remove-participant { font-size: 12px; border: 1px solid #ddd; border-radius: 15px; padding: 5px 9px; background: #fff; color: #a33; cursor: pointer; }

.participant-rows { display: grid; gap: 8px; margin: 12px 0 22px; }
.participant-row {
    display: grid;
    grid-template-columns: minmax(85px, 1fr) 112px minmax(110px, 1.3fr);
    gap: 8px;
    align-items: center;
}
.participant-name { min-width: 0; overflow-wrap: anywhere; }
.status-select {
    width: 100%; min-width: 0; max-width: none;
    padding: 7px 5px;
    border: 1px solid #cbdbe1;
    border-radius: 8px;
    background: white;
}
.status-present { background: #e4f6eb; color: #176b3b; }
.status-peut-etre { background: #fff3d7; color: #855a00; }
.status-absent { background: #fbe8e8; color: #963636; }
.status---- { background: #f1f5f9; color: #64748b; }
.participant-comment { width: 100%; min-width: 0; margin: 0; padding: 8px; }
.participant-row .remove-participant { margin: 0; font-size: 19px; line-height: 1; padding: 5px 10px; }



.title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.title-row h2 {
    margin: 0;
    flex: 1;
}

.edit-title {
    font-size: 12px;
    padding: 5px 9px;
}

.title-input {
    flex: 1 1 180px;
    min-width: 0;
    margin: 0;
}

/* Préserver l'attribut hidden, même avec les mises en page flex/grid */
[hidden] { display: none !important; }

@media (max-width: 800px) {
    .wrap { padding: 0 8px; }
    .layout {
        grid-template-columns: minmax(0, 35fr) minmax(0, 65fr);
        gap: 8px;
    }
    .main-panel, .detail { padding: 10px; border-radius: 10px; }
    .detail { position: static; }
    .entry { padding: 8px 5px; margin: 5px 0; font-size: 12px; }
    .entry small { font-size: 10px; line-height: 1.3; }
    .participant-row {
        grid-template-columns: minmax(0, 1fr);
        gap: 4px;
        padding: 6px 0;
        border-bottom: 1px solid #edf1f3;
    }
    .participant-name { font-size: 13px; font-weight: 600; }
    .status-select, .participant-comment {
        width: 100%; max-width: none; min-width: 0;
        margin: 0; font-size: 13px; padding: 7px;
    }
    .day { min-height: 72px; padding: 4px; }
    .event { font-size: 10px; padding: 3px; }
    .event small { display: none; }
    h1 span { display: block; margin: 4px 0; }
    .toolbar strong { min-width: 130px; }
}
