:root {
    --bg-main: #f1f4f7;
    --bg-header: #112019;
    --bg-nav: #163025;
    --ink: #1b2c24;
    --muted: #5e6f66;
    --line: #d3ddd7;
    --card: #ffffff;
    --primary: #2d9a51;
    --primary-dark: #237a40;
    --danger: #bf3939;
    --success: #0b774d;
    --accent: #d6efdf;
    --radius: 14px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background:
        linear-gradient(130deg, rgba(45, 154, 81, 0.1), transparent 38%),
        linear-gradient(0deg, rgba(17, 32, 25, 0.05), rgba(17, 32, 25, 0.05)),
        var(--bg-main);
    font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
}

body.page-app {
    background: #ffffff;
}

body.page-app .page-noise {
    display: none;
}

body.page-login {
    background:
    radial-gradient(circle at 15% 5%, rgba(46, 120, 81, 0.32), transparent 38%),
    radial-gradient(circle at 88% 85%, rgba(22, 68, 47, 0.44), transparent 40%),
    linear-gradient(145deg, #0f1e18 0%, #12271f 48%, #173327 100%);
}

.page-noise {
    position: fixed;
    inset: 0;
    z-index: -1;
    opacity: 0.25;
    pointer-events: none;
    background-image: radial-gradient(rgba(17, 41, 28, 0.2) 0.6px, transparent 0.6px);
    background-size: 9px 9px;
}

.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 18px clamp(16px, 4vw, 44px);
    background: linear-gradient(130deg, #122119 0%, #183126 70%, #1f4735 100%);
    border-bottom: 1px solid #35624c;
}

.brand-wrap {
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand-logo-wrap {
    width: clamp(64px, 9vw, 82px);
    height: clamp(64px, 9vw, 82px);
    border-radius: 16px;
    border: 1px solid rgba(214, 239, 223, 0.42);
    background: rgba(255, 255, 255, 0.08);
    display: grid;
    place-items: center;
    overflow: hidden;
}

.brand-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.brand-logo-fallback {
    font-family: "Space Grotesk", "Segoe UI", sans-serif;
    font-weight: 700;
    color: #dcf5e6;
    letter-spacing: 1px;
}

.brand-wrap h1 {
    margin: 0;
    color: #f0fff4;
    font-size: clamp(1.15rem, 2vw, 1.45rem);
    font-family: "Space Grotesk", "Segoe UI", sans-serif;
}

.brand-wrap p {
    margin: 4px 0 0;
    color: #abd1bc;
}

.user-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-name {
    color: #ebfff2;
    font-weight: 600;
}

.nav-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px clamp(16px, 4vw, 44px);
    background: var(--bg-nav);
    border-bottom: 1px solid #35624c;
}

.nav-link {
    text-decoration: none;
    color: #d7f0e1;
    border: 1px solid #3a6751;
    border-radius: 999px;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.05);
    transition: 140ms ease;
}

.nav-link:hover {
    border-color: #73cc97;
    color: #ffffff;
    transform: translateY(-1px);
}

.nav-link.active {
    color: #113022;
    background: #d8f4e4;
    border-color: #d8f4e4;
    font-weight: 700;
}

.container {
    padding: 20px clamp(16px, 4vw, 44px) 44px;
    display: grid;
    gap: 16px;
}

body.page-login .container {
    min-height: calc(100vh - 116px);
    place-content: center;
    padding-top: 32px;
}

.hero-strip {
    background: linear-gradient(120deg, #1a5a3d 0%, #20784f 55%, #2a9867 100%);
    border: 1px solid #43a97a;
    border-radius: var(--radius);
    padding: 20px;
    color: #f4fff8;
    display: grid;
    gap: 10px;
}

.hero-strip h2 {
    margin: 0;
    font-family: "Space Grotesk", "Segoe UI", sans-serif;
}

.hero-strip p {
    margin: 0;
    color: #d6efe1;
}

.hero-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* --- Launcher (index accueil) --- */
.launcher-section {
    padding: 1.25rem 0 0;
}

.launcher-section-title {
    margin: 0 0 .9rem;
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--muted);
}

.launcher-section-admin {
    margin-top: .35rem;
}

.launcher-separator {
    height: 1px;
    width: 100%;
    margin: 0 0 1rem;
    background: linear-gradient(90deg, transparent 0%, rgba(234, 148, 148, 0.45) 20%, rgba(234, 148, 148, 0.75) 50%, rgba(234, 148, 148, 0.45) 80%, transparent 100%);
}

.launcher {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    padding: 0 0 1rem;
}

.launcher-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .6rem;
    width: 160px;
    height: 160px;
    background: var(--bg-card, #1e2a24);
    border: 1px solid var(--line, #d3ddd7);
    border-radius: 14px;
    color: #fff;
    text-decoration: none;
    font-size: .9rem;
    font-weight: 600;
    letter-spacing: .02em;
    transition: background .18s, border-color .18s, transform .15s;
}

.launcher-btn:hover {
    background: #243d2f;
    border-color: var(--primary, #2d9a51);
    transform: translateY(-2px);
}

.launcher-icon {
    font-size: 2.2rem;
    line-height: 1;
}

.launcher-btn-wide {
    width: min(100%, 360px);
    height: auto;
    align-items: stretch;
    justify-content: flex-start;
    padding: 1rem;
}

.launcher-btn-admin {
    background: linear-gradient(180deg, #422928 0%, #5a3332 100%);
    border-color: #d68b86;
}

.launcher-btn-admin:hover {
    background: linear-gradient(180deg, #513130 0%, #68403f 100%);
    border-color: #efb0ab;
}

.launcher-admin-head {
    display: flex;
    align-items: flex-start;
    gap: .8rem;
    margin-bottom: .9rem;
}

.launcher-admin-head h2 {
    margin: 0 0 .25rem;
    font-size: 1rem;
}

.launcher-admin-head p {
    margin: 0;
    color: #f2d8d5;
    font-size: .85rem;
}

.launcher-admin-meta {
    display: grid;
    gap: .35rem;
    margin-bottom: .9rem;
    font-size: .82rem;
    color: #f7e6e4;
    text-align: left;
}

.launcher-admin-meta p {
    margin: 0;
}

.launcher-admin-actions {
    display: flex;
    gap: .7rem;
    align-items: center;
    margin-top: auto;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
}

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: 0 12px 30px rgba(17, 41, 28, 0.08);
    animation: reveal 240ms ease-out both;
}

@keyframes reveal {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stat-card h2 {
    margin: 0 0 6px;
    font-size: 0.94rem;
    color: var(--muted);
}

.stat-value {
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
    color: #1f5a41;
}

.row-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.inline-form,
.grid-form {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.grid-form {
    align-items: stretch;
}

label {
    font-weight: 600;
    color: #2d4337;
}

input,
select,
textarea,
button {
    font: inherit;
}

input,
select,
textarea {
    border: 1px solid #c4d5cb;
    border-radius: 10px;
    padding: 8px 10px;
    min-height: 38px;
    background: #fff;
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid #c9e9d6;
    border-color: #73bb91;
}

textarea {
    resize: vertical;
    min-width: 220px;
}

.btn {
    appearance: none;
    border: 0;
    border-radius: 10px;
    padding: 9px 14px;
    background: var(--primary);
    color: #ffffff;
    text-decoration: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.btn:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: #325b47;
}

.btn-danger {
    background: var(--danger);
}

.btn-light {
    background: #ecf8f0;
    color: #194634;
}

.btn-light:hover {
    background: #d9efdf;
}

.table-wrap {
    overflow-x: auto;
}

table {
    border-collapse: collapse;
    width: 100%;
    min-width: 680px;
}

thead {
    background: #f1f8f3;
}

th,
td {
    border-bottom: 1px solid #dde7e1;
    text-align: left;
    padding: 10px;
    vertical-align: middle;
}

.center {
    text-align: center;
}

.action-cell {
    display: flex;
    gap: 8px;
}

.checkline {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.error {
    padding: 10px;
    border-radius: 10px;
    background: #ffe8e8;
    border: 1px solid #efb7b7;
    color: #7f1f1f;
}

.success {
    padding: 10px;
    border-radius: 10px;
    background: #e8fff1;
    border: 1px solid #acdfc3;
    color: var(--success);
}

.auth-card {
    max-width: 540px;
}

.login-shell {
    width: min(100%, 640px);
    justify-self: center;
}

.login-modal {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(197, 224, 209, 0.9);
    box-shadow: 0 20px 60px rgba(12, 38, 25, 0.35);
    border-radius: 18px;
    padding: 28px;
    text-align: center;
}

.login-modal h2 {
    margin: 0;
    font-family: "Space Grotesk", "Segoe UI", sans-serif;
    font-size: clamp(1.35rem, 2.4vw, 1.8rem);
    color: #173628;
}

.login-modal p {
    margin: 10px auto 0;
    max-width: 470px;
    color: #4e685b;
}

.login-modal .btn {
    margin-top: 18px;
    min-width: 260px;
    min-height: 44px;
}

@media (max-width: 820px) {
    .site-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .brand-logo-wrap {
        width: 62px;
        height: 62px;
    }
}

@media (max-width: 760px) {
    table {
        min-width: 540px;
    }

    .hero-strip {
        padding: 16px;
    }
}

body.display-screen {
    margin: 0;
    background: #1d1f23;
    color: #efefef;
}

.display-shell {
    min-height: 100vh;
    display: grid;
    grid-template-rows: auto 1fr;
}

.display-topbar {
    background: #6a6a6a;
    border-bottom: 4px solid #2a2a2a;
    display: grid;
    grid-template-columns: 280px 1fr 260px;
    align-items: center;
    padding: 6px 12px;
    gap: 10px;
}

.display-brand {
    display: flex;
    align-items: center;
    min-height: 46px;
}

.display-logo {
    max-height: 42px;
    width: auto;
}

.display-logo-fallback {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    background: #cdd500;
    color: #2b2b2b;
    display: grid;
    place-items: center;
    font-weight: 800;
}

.display-topbar h1 {
    margin: 0;
    text-align: center;
    letter-spacing: 1px;
    font-weight: 800;
    font-size: clamp(1.3rem, 2.8vw, 3rem);
    color: #efefef;
}

.display-datetime {
    text-align: right;
    line-height: 1.2;
    color: #efefef;
    font-size: clamp(0.8rem, 1.2vw, 1.2rem);
}

.display-content {
    padding: 10px;
}

.display-empty {
    border: 2px solid #8e8e8e;
    border-radius: 6px;
    padding: 18px;
    text-align: center;
    font-size: 1.2rem;
    background: #22252a;
}

.display-grid {
    display: grid;
    gap: 0;
    border: 2px solid #b9b9b9;
}

.display-column {
    border-right: 2px solid #b9b9b9;
    background: #202228;
}

.display-column:last-child {
    border-right: 0;
}

.display-column-head {
    border-bottom: 2px solid #b9b9b9;
    min-height: 120px;
    display: grid;
    place-content: center;
    text-align: center;
    padding: 8px;
}

.display-column-head h2 {
    margin: 0;
    font-size: clamp(1.35rem, 2.2vw, 2.4rem);
    color: #f5f5f5;
}

.display-column-head p {
    margin: 6px 0 0;
    color: #d1d1d1;
    font-size: clamp(0.8rem, 1.1vw, 1.2rem);
    font-style: italic;
}

.display-card {
    border-bottom: 2px solid #b9b9b9;
    min-height: 150px;
    display: grid;
    place-content: center;
    text-align: center;
    gap: 7px;
    padding: 14px 10px;
}

.display-column .display-card:last-child {
    border-bottom: 0;
}

.display-code {
    font-size: clamp(1rem, 1.5vw, 1.65rem);
    font-weight: 800;
    color: #f0f0f0;
}

.display-label {
    font-size: clamp(0.84rem, 1.1vw, 1.24rem);
    color: #e4e4e4;
    font-style: italic;
}

.display-notes {
    font-size: clamp(0.74rem, 0.95vw, 1.02rem);
    color: #cccccc;
}

.display-status {
    justify-self: center;
    min-width: clamp(120px, 72%, 280px);
    border-radius: 999px;
    padding: 6px 12px;
    font-weight: 800;
    font-size: clamp(0.82rem, 1.05vw, 1.12rem);
    text-transform: none;
    color: #ffffff;
}

.status-done {
    background: #00bf63;
}

.status-progress {
    background: #ff8a1e;
}

.status-todo {
    background: #ff2f2f;
}

.display-placeholder {
    font-size: 1.3rem;
    color: #8f949c;
}

.terrain-wrap {
    width: min(100%, 460px);
    margin: 0 auto;
    background: #1f2126;
    border: 1px solid #4a4d56;
}

.terrain-head {
    background: #2a2d33;
    border-bottom: 1px solid #464b55;
}

.terrain-logo-strip {
    min-height: 34px;
    display: grid;
    place-items: center;
    background: #53555a;
}

.terrain-logo-strip img {
    max-height: 22px;
}

.terrain-head h2 {
    margin: 10px 0;
    text-align: center;
    color: #f2f2f2;
    font-size: 2rem;
    letter-spacing: 0.5px;
}

.terrain-actions {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 16px 14px;
}

.terrain-pill {
    background: #c9d900;
    color: #22252a;
    border-radius: 999px;
    text-decoration: none;
    padding: 9px 16px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 145px;
}

.terrain-day-title {
    background: #cad800;
    color: #f2f2f2;
    text-align: center;
    padding: 11px 12px 12px;
}

.terrain-day-title h3 {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 500;
}

.terrain-day-title p {
    margin: 3px 0 0;
    font-size: 1.25rem;
    font-style: italic;
    color: rgba(255, 255, 255, 0.95);
}

.terrain-list {
    padding: 14px;
    display: grid;
    gap: 10px;
}

.terrain-card {
    border: 2px solid #d0d0d0;
    background: #22252b;
    padding: 18px 14px;
    text-align: center;
    color: #f1f1f1;
}

.terrain-code {
    font-size: 2.25rem;
    font-weight: 800;
}

.terrain-label,
.terrain-commune {
    margin-top: 4px;
    font-size: 1.5rem;
}

.terrain-row-end {
    margin-top: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.terrain-status {
    border-radius: 999px;
    padding: 7px 14px;
    font-size: 1.05rem;
    font-weight: 700;
    color: #ffffff;
}

.terrain-status-done {
    background: #00bf63;
}

.terrain-status-progress {
    background: #ff8a1e;
}

.terrain-detail-btn {
    border: 0;
    background: #ffffff;
    color: #1f2126;
    font-weight: 700;
    border-radius: 2px;
    padding: 4px 10px;
    cursor: pointer;
}

.terrain-offline {
    margin: 0 14px 14px;
    background: #ffe8bd;
    color: #563500;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 0.95rem;
}

@media (max-width: 760px) {
    .terrain-wrap {
        width: 100%;
        border-left: 0;
        border-right: 0;
    }

    .terrain-head h2 {
        font-size: 1.6rem;
    }

    .terrain-day-title h3 {
        font-size: 1.3rem;
    }

    .terrain-day-title p {
        font-size: 1rem;
    }

    .terrain-code {
        font-size: 1.45rem;
    }

    .terrain-label,
    .terrain-commune {
        font-size: 1rem;
    }
}

@media (max-width: 1200px) {
    .display-topbar {
        grid-template-columns: 200px 1fr 160px;
    }

    .display-card {
        min-height: 130px;
    }
}
