:root {
    --pg-bg: #f5f7fa;
    --pg-surface: #ffffff;
    --pg-border: #e5e7eb;
    --pg-border-strong: #d1d5db;
    --pg-text: #1f2937;
    --pg-muted: #6b7280;
    --pg-primary: #1e40af;
    --pg-primary-hover: #1d4ed8;
    --pg-primary-soft: #eff6ff;
}

body {
    background: var(--pg-bg);
    color: var(--pg-text);
    font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

.pg-header {
    position: sticky;
    top: 0;
    z-index: 1040;
    border-bottom: 1px solid var(--pg-border);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: saturate(160%) blur(12px);
}

.pg-brand {
    color: var(--pg-text);
    text-decoration: none;
}

.pg-brand:hover {
    color: var(--pg-text);
}

.pg-brand-logo {
    width: 42px;
    height: 42px;
    object-fit: contain;
    flex: 0 0 42px;
}

.pg-brand-title {
    display: block;
    font-size: 16px;
    line-height: 1.1;
    font-weight: 800;
    color: var(--pg-text);
}

.pg-brand-subtitle {
    display: block;
    margin-top: 3px;
    font-size: 12px;
    line-height: 1.2;
    color: var(--pg-muted);
    font-weight: 600;
}

.pg-nav .nav {
    gap: 4px;
}

.pg-nav .nav-link {
    min-height: 38px;
    padding: 8px 12px;
    border-radius: 7px;
    color: #374151 !important;
    font-size: 14px;
    font-weight: 700 !important;
}

.pg-nav .nav-link:hover,
.pg-nav .nav-link:focus {
    background: var(--pg-primary-soft);
    color: var(--pg-primary) !important;
}

.pg-user-button {
    border-color: var(--pg-border-strong) !important;
    color: var(--pg-text) !important;
    background: var(--pg-surface) !important;
    border-radius: 7px !important;
    font-weight: 700 !important;
    box-shadow: none !important;
}

.pg-user-button:hover,
.pg-user-button:focus {
    border-color: var(--pg-primary) !important;
    color: var(--pg-primary) !important;
}

.pg-footer {
    border-top: 1px solid var(--pg-border) !important;
    background: #ffffff !important;
    color: var(--pg-muted) !important;
}

.pg-footer-inner {
    width: min(100% - 32px, 960px);
    margin: 0 auto;
    padding: 10px 0;
    line-height: 1.35;
}

.pg-swal-popup {
    width: min(92vw, 420px) !important;
    border: 1px solid rgba(209, 213, 219, 0.78) !important;
    border-radius: 14px !important;
    padding: 28px !important;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(249, 250, 251, 0.98)) !important;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.18) !important;
}

.pg-swal-popup .swal2-icon {
    margin-top: 0 !important;
}

.pg-swal-title {
    padding-top: 8px !important;
    color: var(--pg-text) !important;
    font-size: 24px !important;
    font-weight: 850 !important;
    letter-spacing: 0 !important;
}

.pg-swal-text {
    color: var(--pg-muted) !important;
    font-size: 15px !important;
    line-height: 1.55 !important;
}

.pg-swal-confirm {
    min-width: 132px;
    min-height: 42px;
    border: 1px solid var(--pg-primary);
    border-radius: 9px;
    background: var(--pg-primary);
    color: #ffffff;
    font-weight: 800;
    box-shadow: 0 10px 22px rgba(30, 64, 175, 0.24);
}

.pg-swal-confirm:hover {
    border-color: var(--pg-primary-hover);
    background: var(--pg-primary-hover);
}

.pg-alert-backdrop {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.42);
    backdrop-filter: blur(4px);
}

.pg-alert-modal {
    width: min(92vw, 420px);
    padding: 28px;
    border: 1px solid rgba(209, 213, 219, 0.78);
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(249, 250, 251, 0.98));
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.18);
    text-align: center;
}

.pg-alert-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 54px;
    height: 54px;
    margin-bottom: 14px;
    border-radius: 50%;
    font-size: 28px;
    font-weight: 850;
}

.pg-alert-icon-success {
    background: #ecfdf5;
    color: #15803d;
}

.pg-alert-icon-error {
    background: #fef2f2;
    color: #b91c1c;
}

.pg-alert-icon-warning,
.pg-alert-icon-info {
    background: #eff6ff;
    color: var(--pg-primary);
}

.pg-alert-modal h2 {
    margin: 0 0 10px;
    color: var(--pg-text);
    font-size: 24px;
    font-weight: 850;
}

.pg-alert-modal p {
    margin: 0 0 22px;
    color: var(--pg-muted);
    font-size: 15px;
    line-height: 1.55;
}

.pg-alert-button {
    min-width: 132px;
    min-height: 42px;
    border: 1px solid var(--pg-primary);
    border-radius: 9px;
    background: var(--pg-primary);
    color: #ffffff;
    font-weight: 800;
    box-shadow: 0 10px 22px rgba(30, 64, 175, 0.24);
}

.pg-alert-button:hover {
    border-color: var(--pg-primary-hover);
    background: var(--pg-primary-hover);
}

#grilleTable {
    width: 100% !important;
    min-width: 0 !important;
    table-layout: fixed;
}

#grilleTable th,
#grilleTable td {
    word-break: normal;
}

#grilleTable td {
    overflow-wrap: anywhere;
}

#grilleTable th {
    overflow-wrap: normal;
}

#grilleTable th {
    padding-right: 0.85rem !important;
    padding-left: 0.85rem !important;
}

#grilleTable td {
    padding-right: 0.85rem !important;
    padding-left: 0.85rem !important;
}

#grilleTable td[data-label="Montant"] {
    white-space: normal !important;
}

@media (min-width: 769px) {
    .pg-table-situation th:nth-child(1) { width: 10%; }
    .pg-table-situation th:nth-child(2) { width: 13%; }
    .pg-table-situation th:nth-child(3) { width: 15%; }
    .pg-table-situation th:nth-child(4) { width: 10%; }
    .pg-table-situation th:nth-child(5) { width: 13%; }
    .pg-table-situation th:nth-child(6) { width: 10%; }
    .pg-table-situation th:nth-child(7) { width: 12%; }
    .pg-table-situation th:nth-child(8) { width: 8%; }
    .pg-table-situation th:nth-child(9) { width: 9%; }

    .pg-table-accountant th:nth-child(1) { width: 9%; }
    .pg-table-accountant th:nth-child(2) { width: 12%; }
    .pg-table-accountant th:nth-child(3) { width: 14%; }
    .pg-table-accountant th:nth-child(4) { width: 10%; }
    .pg-table-accountant th:nth-child(5) { width: 9%; }
    .pg-table-accountant th:nth-child(6) { width: 9%; }
    .pg-table-accountant th:nth-child(7) { width: 9%; }
    .pg-table-accountant th:nth-child(8) { width: 28%; }

    .pg-table-accountant td.actions {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        gap: 0.4rem !important;
        margin-top: 0 !important;
    }

    .pg-table-accountant td.actions a,
    .pg-table-accountant td.actions form,
    .pg-table-accountant td.actions button {
        flex: 0 0 auto;
        white-space: nowrap;
        overflow-wrap: normal;
    }
}

.pg-login-shell {
    min-height: calc(100vh - 57px);
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(420px, 34vw);
    align-items: stretch;
    background: #ffffff;
}

.pg-login-panel {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(32px, 6vw, 72px);
    color: #ffffff;
    background:
        linear-gradient(135deg, rgba(30, 64, 175, 0.96) 0%, rgba(31, 41, 55, 0.98) 100%),
        radial-gradient(circle at 24% 24%, rgba(255, 255, 255, 0.18), transparent 32%);
}

.pg-login-panel::after {
    content: "";
    position: absolute;
    inset: auto 7% 7% auto;
    width: min(46vw, 560px);
    aspect-ratio: 1;
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 50%;
    z-index: -2;
}

.pg-login-watermark {
    position: absolute;
    right: -90px;
    bottom: -80px;
    width: min(52vw, 620px);
    aspect-ratio: 1;
    background: url("/images/logo.png") center / contain no-repeat;
    opacity: 0.11;
    filter: grayscale(1) contrast(1.15);
    z-index: -1;
}

.pg-login-kicker {
    width: fit-content;
    margin-bottom: 20px;
    padding: 7px 11px;
    border: 1px solid rgba(255, 255, 255, 0.32);
    border-radius: 999px;
    color: rgba(255, 255, 255, 0.82);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.pg-login-title {
    max-width: 680px;
    margin: 0;
    color: #ffffff;
    font-size: clamp(36px, 5vw, 64px);
    line-height: 1;
    font-weight: 850;
}

.pg-login-copy {
    max-width: 580px;
    margin-top: 18px;
    color: rgba(255, 255, 255, 0.82);
    font-size: 17px;
    line-height: 1.6;
}

.pg-login-points {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 34px;
}

.pg-login-points span {
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.88);
    font-size: 13px;
    font-weight: 700;
}

.pg-login-card-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(24px, 4vw, 48px);
    background:
        linear-gradient(180deg, rgba(249, 250, 251, 0.96), rgba(255, 255, 255, 0.98));
}

.pg-login-card {
    width: 100%;
    max-width: 390px;
    padding: 28px;
    border: 1px solid rgba(209, 213, 219, 0.78);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.12);
}

.pg-login-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 28px;
}

.pg-login-logo {
    width: 50px;
    height: 50px;
    object-fit: contain;
    flex: 0 0 50px;
    border-radius: 50%;
    box-shadow: 0 0 0 5px #eff6ff;
}

.pg-login-card-brand,
.pg-login-card-caption {
    display: block;
}

.pg-login-card-brand {
    color: var(--pg-text);
    font-size: 17px;
    line-height: 1.1;
    font-weight: 800;
}

.pg-login-card-caption {
    margin-top: 3px;
    color: var(--pg-muted);
    font-size: 12px;
    font-weight: 700;
}

.pg-login-card h1 {
    margin-bottom: 8px;
    color: var(--pg-text);
    font-size: 28px;
    line-height: 1.2;
    font-weight: 800;
}

.pg-login-card .text-muted {
    color: var(--pg-muted) !important;
}

.pg-login-card .form-control {
    border: 1px solid var(--pg-border-strong);
    border-radius: 9px;
    background: #ffffff;
    color: var(--pg-text);
    box-shadow: none;
    min-height: 46px;
    padding: 10px 12px;
}

.pg-login-card .form-control:focus {
    border-color: var(--pg-primary);
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.12);
}

.pg-login-card .btn-primary {
    width: 100%;
    min-height: 48px;
    border-color: var(--pg-primary);
    border-radius: 9px;
    background: var(--pg-primary);
    font-weight: 700;
    box-shadow: 0 10px 22px rgba(30, 64, 175, 0.24);
}

.pg-login-card .btn-primary:hover {
    border-color: var(--pg-primary-hover);
    background: var(--pg-primary-hover);
}

@media (max-width: 980px) {
    .pg-login-shell {
        grid-template-columns: 1fr;
    }

    .pg-login-panel {
        min-height: 280px;
    }

    .pg-login-card-wrap {
        align-items: flex-start;
    }
}

@media (max-width: 768px) {
    .pg-header {
        position: static;
    }

    .pg-nav {
        width: 100%;
        overflow-x: auto;
    }
}
