* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    width: 100%;
    min-height: 100%;
    overflow-x: hidden;
    font-family: "Segoe UI", sans-serif;
}

body {
    min-height: 100vh;
}

/* PAGES - affichage direct pour accélérer le site */
.page {
    display: none;
    position: relative;
    width: 100%;
    min-height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
}

.page.active {
    display: block;
}

.page:not(.active) {
    display: none !important;
}

.page.exit {
    display: none;
}

/* HOME */
#home {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 100px 20px 40px;
    background: linear-gradient(135deg, #0f2027, #2c5364, #00c9ff);
    color: white;
    text-align: center;
}

#home h1 {
    margin: 0;
    font-size: clamp(34px, 5vw, 56px);
    line-height: 1.1;
}

.cards {
    width: 100%;
    max-width: 980px;
    margin: 30px auto 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 22px;
}

.card {
    width: min(100%, 260px);
    min-width: 220px;
    text-align: center;
    padding: 18px 28px;
    border-radius: 12px;
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(6px);
    cursor: pointer;
    transition: all 0.25s ease;
    font-weight: 600;
}

.card:hover {
    transform: translateY(-5px) scale(1.05);
    background: rgba(255,255,255,0.3);
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
}

/* PAGES */
#calendar,
#mission,
#missionCatalog,
#people {
    padding: 22px;
    color: white;
    background: linear-gradient(135deg, #202e34, #203a43, #8f95b7);
}

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

/* CALENDAR */
.calendar-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    text-align: center;
    margin-bottom: 20px;
}

#monthTitle {
    font-size: clamp(20px, 3vw, 30px);
    font-weight: 700;
}

/* MISSION PAGE */
.form-container {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 12px;
    align-items: start;
    width: 100%;
}

.form-container > * {
    min-width: 0;
    width: 100%;
}

input, select, textarea {
    padding: 10px;
    border-radius: 8px;
    border: none;
    width: 100%;
}

textarea {
    min-height: 58px;
    resize: vertical;
}

.mission-item {
    background: white;
    color: black;
    padding: 12px;
    border-radius: 10px;
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
}

.mission-item > div:last-child {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* PEOPLE PAGE */
.people-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr 1fr;
    gap: 18px;
}

.people-card {
    background: rgba(255,255,255,0.12);
    border-radius: 14px;
    padding: 18px;
    backdrop-filter: blur(5px);
    box-shadow: 0 10px 22px rgba(0,0,0,0.16);
}

.people-card h3 {
    margin-top: 0;
}

.people-form {
    display: grid;
    gap: 12px;
}

.people-list {
    display: grid;
    gap: 10px;
}

.person-item {
    background: rgba(255,255,255,0.14);
    border-radius: 10px;
    padding: 12px;
}

.person-item strong {
    display: block;
    margin-bottom: 4px;
}

.person-item small {
    display: block;
    opacity: 0.92;
}

.empty-text {
    opacity: 0.75;
    font-style: italic;
}

/* NOUVEAU CALENDRIER TYPE TABLEAU / POST-IT */
#calendarGrid {
    display: block;
}

.planning-board {
    width: 100%;
    background: rgba(255,255,255,0.08);
    border-radius: 16px;
    padding: 18px;
    overflow-x: hidden;
    box-shadow: 0 12px 30px rgba(0,0,0,0.18);
    padding-bottom: 10px;
}

.planning-matrix {
    display: grid;
    gap: 10px;
    width: 100%;
    min-width: 0;
    grid-template-columns: 230px repeat(8, minmax(0, 1fr)) !important;
}

.matrix-corner,
.matrix-week,
.matrix-person,
.matrix-cell {
    border-radius: 12px;
}

.matrix-corner {
    background: rgba(255,255,255,0.14);
    min-height: 70px;
}

.matrix-week {
    background: rgba(255,255,255,0.14);
    padding: 12px;
    text-align: center;
    font-weight: bold;
    color: white;
    min-height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.matrix-week span {
    display: block;
    font-size: 12px;
    opacity: 0.85;
    margin-top: 4px;
    font-weight: 400;
}

.matrix-person {
    background: rgba(255,255,255,0.16);
    color: white;
    padding: 14px;
    font-weight: bold;
    min-height: 110px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: sticky;
    left: 0;
    z-index: 2;
    backdrop-filter: blur(4px);
    width: 100%;
}

.matrix-cell {
    background: rgba(255,255,255,0.06);
    border: 1px dashed rgba(255,255,255,0.18);
    min-height: 110px;
    padding: 10px;
    position: relative;
    transition: all 0.2s ease;
    width: 100%;
}

.matrix-cell:hover {
    background: rgba(255,255,255,0.1);
    transform: translateY(-3px);
}

.sticky-note {
    width: 100%;
    max-width: 100%;
    padding: 10px 12px;
    border-radius: 4px 4px 10px 10px;
    margin-bottom: 8px;
    color: white;
    font-weight: 700;
    box-shadow: 0 8px 18px rgba(0,0,0,0.22);
    transform: rotate(var(--rot, -2deg));
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    word-break: break-word;
}

.sticky-note:hover {
    transform: rotate(0deg) scale(1.03);
    box-shadow: 0 12px 24px rgba(0,0,0,0.28);
}

.sticky-note strong {
    display: block;
    font-size: 14px;
    line-height: 1.2;
}

.sticky-note small {
    display: block;
    margin-top: 6px;
    font-size: 11px;
    font-weight: 500;
    color: rgba(255,255,255,0.95);
    line-height: 1.3;
}

.note-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.note-status-passed {
    background: #ff0033;
    color: white;
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
    padding: 5px 7px;
    border-radius: 999px;
    text-transform: uppercase;
    box-shadow: 0 3px 8px rgba(255,0,51,0.35);
    white-space: nowrap;
}

.note-audit {
    background: #ffe66d;
}

.note-cac {
    background: #ffb3c1;
}

.note-conseil {
    background: #8be9fd;
}

.note-expertise {
    background: #b9fbc0;
}

.note-default {
    background: #ffd6a5;
}

.note-half {
    border-left: 5px solid #374151;
}

/* RESPONSIVE */
@media (max-width: 1200px) {
    .form-container {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .people-grid {
        grid-template-columns: 1fr;
    }

    .planning-board {
        overflow-x: auto;
    }

    .planning-matrix {
        min-width: 1180px;
        grid-template-columns: 230px repeat(8, minmax(115px, 1fr)) !important;
    }
}

@media (max-width: 768px) {
    #home {
        padding: 70px 16px 30px;
    }

    #mission,
    #calendar,
    #missionCatalog,
    #people {
        padding: 16px;
    }

    .form-container {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .mission-item > div:last-child {
        width: 100%;
        justify-content: flex-end;
    }

    .planning-matrix {
        min-width: 940px;
    }

    .matrix-person {
        min-width: 180px;
        font-size: 15px;
        padding: 12px;
    }

    .matrix-week,
    .matrix-cell {
        min-width: 130px;
    }

    .sticky-note {
        max-width: 130px;
        padding: 8px 10px;
    }

    .sticky-note strong {
        font-size: 13px;
    }

    .sticky-note small {
        font-size: 10px;
    }
}

@media (max-width: 480px) {
    #home {
        padding: 60px 14px 24px;
    }

    #mission,
    #calendar,
    #missionCatalog,
    #people {
        padding: 14px;
    }

    .form-container {
        grid-template-columns: 1fr;
    }

    .form-container button {
        width: 100%;
    }

    .mission-item > div:last-child {
        justify-content: flex-start;
    }

    .planning-matrix {
        min-width: 820px;
    }

    .matrix-person {
        min-width: 160px;
        font-size: 14px;
    }

    .matrix-week,
    .matrix-cell {
        min-width: 115px;
    }

    .sticky-note {
        max-width: 110px;
        padding: 7px 8px;
    }

    .sticky-note strong {
        font-size: 12px;
    }

    .sticky-note small {
        font-size: 9px;
    }
}
/* RÉFÉRENTIEL MISSIONS */
.page-intro {
    max-width: 900px;
    margin: 6px 0 18px;
    color: rgba(255,255,255,0.9);
}

.wide-card {
    max-width: 1100px;
    margin-bottom: 20px;
}

.catalog-form {
    display: grid;
    grid-template-columns: 1.8fr 0.9fr auto auto;
    gap: 12px;
    align-items: start;
}

.catalog-form > * {
    min-width: 0;
    width: 100%;
}

.catalog-list {
    display: grid;
    gap: 10px;
    max-width: 1100px;
}

.catalog-item {
    background: white;
    color: black;
    border-radius: 12px;
    padding: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}

.catalog-item strong,
.catalog-item small {
    display: block;
}

.catalog-item small {
    color: #4b5563;
    margin-top: 3px;
}

.catalog-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.code-badge,
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 6px 10px;
    background: #172554;
    color: white;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.inline-badge {
    margin-left: 8px;
    vertical-align: middle;
}

.locked-badge {
    background: rgba(255,255,255,0.16);
    color: white;
    border: 1px solid rgba(255,255,255,0.22);
}

.small-btn {
    padding: 7px 9px;
    font-size: 12px;
    border-radius: 8px;
}

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

.secondary-btn {
    background: rgba(255,255,255,0.85);
    color: #172554;
}

.person-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.person-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

#missionReferenceCode,
#dateFin {
    background: rgba(255,255,255,0.88);
    color: #111827;
    font-weight: 700;
}

@media (max-width: 1200px) {
    .catalog-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .catalog-form {
        grid-template-columns: 1fr;
    }

    .catalog-item {
        align-items: flex-start;
    }

    .catalog-actions,
    .person-actions {
        width: 100%;
        justify-content: flex-start;
    }
}


/* Message sous la liste des missions filtrées */
.mission-select-status {
    grid-column: 1 / -1;
    display: block;
    margin-top: -6px;
    color: rgba(255,255,255,0.84);
    font-size: 12px;
    font-weight: 600;
}

.mission-select-status.ok {
    color: #bbf7d0;
}

.mission-select-status.warn {
    color: #fde68a;
}

#planningMissionTitle {
    background: rgba(255,255,255,0.88);
    color: #111827;
    font-weight: 700;
}

/* MODE ADMIN PLANIFICATION */
.admin-override-box {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1.4fr 0.8fr;
    gap: 10px;
    align-items: center;
    background: rgba(255,255,255,0.14);
    border: 1px solid rgba(255,255,255,0.22);
    border-radius: 12px;
    padding: 12px;
}

.admin-check {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
}

.admin-check input {
    width: auto;
    min-width: 18px;
    height: 18px;
}

.admin-status {
    grid-column: 1 / -1;
    opacity: 0.86;
    font-size: 12px;
}

.admin-status.ok {
    color: #bbf7d0;
    font-weight: 800;
}

.admin-status.warn {
    color: #fde68a;
    font-weight: 800;
}

.admin-list-note,
.admin-note-tag {
    display: inline-block;
    margin-top: 6px;
    padding: 3px 7px;
    border-radius: 999px;
    background: rgba(17,24,39,0.28);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

@media (max-width: 768px) {
    .admin-override-box {
        grid-template-columns: 1fr;
    }
}
