/* ===== VARIABLES — Charte SOGEMEL (inspiré du logo) ===== */
:root {
    --p:    #3a3a3a;   /* Gris anthracite (tour + bâtiment du logo) */
    --a:    #a11c2b;   /* Rouge bordeaux (vague du logo) */
    --a2:   #c0283a;   /* Rouge plus vif (hover) */
    --sb:   #2b2b2b;   /* Sidebar très sombre */
    --sb2:  #222222;   /* Sidebar fond header */
    --ok:   #16a34a;
    --no:   #dc2626;
    --mu:   #6b7280;
    --tx:   #1e1e1e;
    --bg:   #f4f4f6;
    --br:   #d1d5db;
    --card: #ffffff;
}


/* ===== SIDEBAR PREMIUM ===== */
.sb {
    width: 240px; min-width: 240px;
    background: #1a1a2e;
    display: flex; flex-direction: column;
    position: relative;
    box-shadow: 4px 0 24px rgba(0,0,0,.4);
}

.sb::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, #a11c2b, #c0283a, #a11c2b);
}

.sb-hd {
    padding: 0;
    background: #111122;
    border-bottom: 1px solid rgba(255,255,255,.06);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80px;
    position: relative;
}

.sb-hd::after {
    content: '';
    position: absolute;
    bottom: 0; left: 20%; right: 20%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(161,28,43,.6), transparent);
}

.sb-hd img {
    height: 44px;
    object-fit: contain;
}

/* Zone scrollable de la navigation */
.sb-nav {
    flex: 1;
    overflow-y: scroll;
    overflow-x: hidden;
    /* scrollbar toujours visible */
    scrollbar-width: thin;
    scrollbar-color: #a11c2b rgba(255,255,255,.06);
}

/* Scrollbar Webkit (Chrome, Edge) — large et bien visible */
.sb-nav::-webkit-scrollbar {
    width: 6px;
}
.sb-nav::-webkit-scrollbar-track {
    background: rgba(255,255,255,.04);
    border-radius: 0;
}
.sb-nav::-webkit-scrollbar-thumb {
    background: #a11c2b;
    border-radius: 3px;
    min-height: 40px;
}
.sb-nav::-webkit-scrollbar-thumb:hover {
    background: #c0283a;
}

.sb-lbl {
    font-size: 9px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .14em; color: rgba(255,255,255,.2);
    padding: 20px 20px 6px;
}

.sb a {
    display: flex; align-items: center; gap: 11px;
    padding: 11px 20px;
    color: rgba(200,210,225,.65);
    text-decoration: none; font-size: 13px; font-weight: 500;
    border-left: 3px solid transparent;
    border-right: 3px solid transparent;
    transition: all .18s ease;
    position: relative;
}

.sb a i { font-size: 15px; opacity: .8; transition: .18s; }

.sb a:hover {
    background: rgba(255,255,255,.05);
    color: rgba(220,230,245,.9);
    border-left-color: rgba(161,28,43,.4);
}
.sb a:hover i { opacity: 1; }

.sb a.active {
    color: #fff;
    background: linear-gradient(90deg, rgba(161,28,43,.25) 0%, rgba(161,28,43,.05) 100%);
    border-left-color: #a11c2b;
    border-right-color: transparent;
    font-weight: 600;
}
.sb a.active i { opacity: 1; color: #e06070; }
.sb a.active::before {
    content: '';
    position: absolute;
    left: 0; top: 25%; bottom: 25%;
    width: 3px;
    background: #a11c2b;
    border-radius: 0 3px 3px 0;
    box-shadow: 0 0 8px rgba(161,28,43,.6);
}

/* Menu deroulant (groupe de sous-liens, ex: Statistique) */
.sb-grp-tg {
    display: flex; align-items: center; gap: 11px;
    width: 100%;
    padding: 11px 20px;
    background: none; border: none;
    border-left: 3px solid transparent;
    border-right: 3px solid transparent;
    color: rgba(200,210,225,.65);
    font-size: 13px; font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all .18s ease;
}
.sb-grp-tg i { font-size: 15px; opacity: .8; transition: .18s; }
.sb-grp-tg span { flex: 1; text-align: left; }
.sb-grp-tg:hover {
    background: rgba(255,255,255,.05);
    color: rgba(220,230,245,.9);
    border-left-color: rgba(161,28,43,.4);
}
.sb-grp-tg:hover i { opacity: 1; }
.sb-grp-car { font-size: 11px !important; transition: transform .18s ease !important; }
.sb-grp.open > .sb-grp-tg .sb-grp-car { transform: rotate(180deg); }

.sb-grp-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height .2s ease;
}
.sb-grp.open .sb-grp-body { max-height: 320px; }

.sb-grp .sb-grp-body a {
    padding-left: 48px;
    font-size: 12.5px;
}
.sb-grp .sb-grp-body a i { font-size: 13px; }

/* Pied sidebar */
.sb-ft {
    margin-top: auto;
    border-top: 1px solid rgba(255,255,255,.06);
    background: rgba(0,0,0,.15);
}
.sb-ft a, .sb-ft .ui-commandlink {
    color: rgba(200,200,200,.55) !important;
    font-size: 13px !important;
    transition: .18s !important;
}
.sb-ft a:hover, .sb-ft .ui-commandlink:hover {
    color: #fff !important;
    background: rgba(161,28,43,.2) !important;
}

/* ===== RESET & BASE ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', system-ui, sans-serif; background: var(--bg);
       color: var(--tx); font-size: 14px; }
a { color: inherit; }

/* ===== LAYOUT ===== */
.wrap { display: flex; min-height: 100vh; }
.mn   { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.ct   { flex: 1; padding: 24px 28px; overflow-y: auto; }

/* ===== TOPBAR ===== */
.tb {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 28px; height: 54px;
    background: #fff;
    border-bottom: 1px solid var(--br);
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.tb-t { font-size: 16px; font-weight: 700; color: var(--p); }
.tb-u { display: flex; align-items: center; gap: 8px;
         font-size: 13px; color: var(--mu); }
.tb-u .pi-user-circle { font-size: 20px; color: var(--a); }

/* ===== PAGE HEADER ===== */
.ph { margin-bottom: 20px; }
.ph h1 { font-size: 20px; font-weight: 800; color: var(--p);
          display: flex; align-items: center; gap: 8px; }
.ph h1 i { color: var(--a); }
.ph p { color: var(--mu); font-size: 13px; margin-top: 3px; }

/* ===== CARDS ===== */
.card {
    background: var(--card); border-radius: 10px;
    box-shadow: 0 1px 6px rgba(0,0,0,.07);
    overflow: hidden;
    border: 1px solid #eaecef;
}
.ch {
    display: flex; align-items: center; gap: 8px;
    padding: 13px 18px;
    background: #fafafa;
    border-bottom: 1px solid var(--br);
    font-weight: 700; font-size: 13px; color: var(--p);
}
.ch i { color: var(--a); font-size: 15px; }
.cb { padding: 18px; }

/* ===== GRILLE ===== */
.g2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.fg { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.ff { display: flex; flex-direction: column; gap: 5px; }
.ff label { font-size: 12px; font-weight: 600; color: #374151; }
.req { color: var(--a); margin-left: 2px; }

/* ===== INPUTS PRIMEFACES ===== */
.ui-inputtext, .ui-inputnumber-input,
.ui-selectonemenu .ui-selectonemenu-label {
    border: 1px solid #d1d5db !important;
    border-radius: 6px !important;
    padding: 7px 10px !important;
    font-size: 13px !important;
    color: var(--tx) !important;
    transition: border-color .15s !important;
}
.ui-inputtext:focus, .ui-inputnumber-input:focus {
    border-color: var(--a) !important;
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(161,28,43,.12) !important;
}
.ui-selectonemenu:not(.ui-state-disabled):hover .ui-selectonemenu-label {
    border-color: var(--a) !important;
}

/* ===== BOUTONS ===== */
.ui-button {
    border-radius: 6px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    padding: 7px 16px !important;
    transition: .15s !important;
}
.ui-button-success  { background: #16a34a !important; border-color: #16a34a !important; }
.ui-button-success:hover  { background: #15803d !important; }
.ui-button-danger   { background: var(--a) !important; border-color: var(--a) !important; }
.ui-button-danger:hover   { background: var(--a2) !important; }
.ui-button-warning  { background: #d97706 !important; border-color: #d97706 !important; color:#fff !important; }
.ui-button-warning:hover  { background: #b45309 !important; }
.ui-button-secondary { background: #64748b !important; border-color: #64748b !important; color:#fff !important; }
.ui-button-secondary:hover { background: #475569 !important; }
.ui-button-sm { padding: 5px 10px !important; font-size: 12px !important; }

/* ===== BADGES ===== */
.bk {
    display: inline-block; padding: 3px 10px;
    border-radius: 20px; font-size: 11px; font-weight: 700;
}
.bk-ok  { background: #dcfce7; color: #166534; }
.bk-no  { background: #fee2e2; color: #991b1b; }
.bk-in  { background: #e0e7ff; color: #3730a3; }

/* ===== TABLEAUX PREMIUM ===== */
.ui-datatable .ui-datatable-thead > tr > th {
    background: #f1f5f9 !important;
    color: #475569 !important;
    font-size: 11px !important; font-weight: 700 !important;
    text-transform: uppercase !important; letter-spacing: .06em !important;
    padding: 12px 14px !important;
    border-bottom: 2px solid #e2e8f0 !important;
    border-top: none !important;
}
.ui-datatable .ui-datatable-tbody > tr > td {
    padding: 13px 14px !important;
    border-bottom: 1px solid #f1f5f9 !important;
    vertical-align: middle !important; font-size: 13px !important;
    color: #334155 !important;
}
.ui-datatable .ui-datatable-tbody > tr:hover > td { background: #f8fafc !important; }
.ui-datatable.ui-datatable-striped .ui-datatable-tbody > tr.ui-datatable-odd > td {
    background: #fafbfc !important;
}
/* Paginator */
.ui-paginator { background: transparent !important; border: none !important; padding: 10px 0 4px !important; }
.ui-paginator .ui-paginator-page,
.ui-paginator .ui-paginator-first,
.ui-paginator .ui-paginator-prev,
.ui-paginator .ui-paginator-next,
.ui-paginator .ui-paginator-last {
    border-radius: 6px !important; min-width: 30px !important;
    height: 30px !important; font-size: 12px !important; margin: 0 2px !important;
}
.ui-paginator .ui-state-active {
    background: var(--a) !important;
    color: white !important; border-color: var(--a) !important;
}

/* ===== LOGIN ===== */
.login-wrap {
    min-height: 100vh; display: flex;
    background: linear-gradient(135deg, #1e1e1e 0%, #2b2b2b 50%, #3a1015 100%);
}
.login-left {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 40px;
}
.login-logo-box {
    display: flex; flex-direction: column; align-items: center; gap: 0;
}
.login-logo-box img {
    width: 180px;
    filter: brightness(0) invert(1) drop-shadow(0 4px 24px rgba(161,28,43,.6));
    margin-bottom: 24px;
}
.login-tagline {
    color: rgba(255,255,255,.45);
    font-size: 12px; letter-spacing: .18em;
    text-transform: uppercase; font-weight: 500;
}
.login-right {
    width: 420px; display: flex; align-items: center;
    justify-content: center; padding: 40px;
    background: rgba(255,255,255,.03);
    border-left: 1px solid rgba(255,255,255,.07);
}
.login-card {
    width: 100%;
    background: #fff;
    border-radius: 14px;
    padding: 36px 32px;
    box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.login-card h2 {
    font-size: 20px; font-weight: 800; color: var(--p);
    margin-bottom: 4px;
}
.login-card .sub {
    font-size: 12px; color: var(--mu); margin-bottom: 24px;
}
.login-card .ff label { font-size: 12px; font-weight: 600; color: #374151; }

/* ===== DIVERS ===== */
.row-inactif td { opacity: .55; }
small { font-size: 11px; color: var(--mu); }
.ui-datatable-scrollable-body::-webkit-scrollbar { height:5px; width:5px; }
.ui-datatable-scrollable-body::-webkit-scrollbar-track { background:#f1f5f9; }
.ui-datatable-scrollable-body::-webkit-scrollbar-thumb { background:#cbd5e1; border-radius:4px; }

/* ===== TABLEAUX STATISTIQUE (LUB / Carburant) — version premium ===== */
.stat-table-wrap { overflow-x: auto; }
.stat-table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 600px; font-size: 13.5px; }
.stat-table thead th {
    padding: 12px 16px;
    background: linear-gradient(180deg, #fbfafa 0%, #f5f3f3 100%);
    border-bottom: 1px solid #e6e1e1;
    font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
    color: #8a7d7d;
    text-align: right;
    white-space: nowrap;
}
.stat-table thead th:first-child { text-align: left; border-radius: 8px 0 0 0; }
.stat-table thead th:last-child  { border-radius: 0 8px 0 0; }
.stat-table tbody td {
    padding: 13px 16px;
    border-bottom: 1px solid #f3eeee;
    text-align: right;
    font-variant-numeric: tabular-nums;
    color: var(--tx);
}
.stat-table tbody td:first-child { text-align: left; }
.stat-table tbody tr { transition: background .12s ease; }
.stat-table tbody tr:nth-child(even) { background: #fcfafa; }
.stat-table tbody tr:hover { background: #fbf1f2; }
.stat-table tbody tr:last-child td { border-bottom: none; }

.stat-lib {
    display: flex; align-items: center; gap: 10px;
    font-weight: 700; font-size: 13.5px; color: var(--p);
}
.stat-lib::before {
    content: ""; width: 7px; height: 7px; border-radius: 50%;
    background: var(--a); flex-shrink: 0;
    box-shadow: 0 0 0 3px rgba(161,28,43,.12);
}

.stat-num { font-family: 'SF Mono', 'Cascadia Code', Consolas, monospace; font-size: 13px; }
.stat-num.strong { font-weight: 700; color: var(--p); }
.stat-num.muted { color: var(--mu); }

.stat-pill {
    display: inline-flex; align-items: center; justify-content: flex-end;
    min-width: 64px;
    padding: 4px 10px; border-radius: 999px;
    font-family: 'SF Mono', 'Cascadia Code', Consolas, monospace;
    font-size: 12.5px; font-weight: 700;
}
.stat-pill.pos { background: #e7f6ed; color: #0f7a3d; }
.stat-pill.neg { background: #fdecec; color: #c41e1e; }
.stat-pill.flat { background: #f1f0f0; color: var(--mu); }

.stat-input .ui-inputnumber input {
    width: 130px; text-align: right;
    border: 1.5px solid #e6e1e1 !important; border-radius: 8px !important;
    padding: 9px 12px !important; font-size: 13px !important;
    font-family: 'SF Mono', 'Cascadia Code', Consolas, monospace;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.stat-input .ui-inputnumber input:focus {
    border-color: var(--a) !important;
    box-shadow: 0 0 0 3px rgba(161,28,43,.10) !important;
}
.stat-input .ui-inputnumber input::placeholder { color: #c7c0c0; font-family: inherit; }

.stat-genbtn.ui-button {
    background: linear-gradient(180deg, #0e7e49 0%, #096138 100%) !important;
    border: none !important;
    box-shadow: 0 2px 8px rgba(9,97,56,.28) !important;
    padding: 11px 22px !important; border-radius: 9px !important;
    font-weight: 700 !important; letter-spacing: .01em;
    transition: transform .12s ease, box-shadow .12s ease;
}
.stat-genbtn.ui-button:enabled:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 14px rgba(9,97,56,.34) !important;
}

.stat-recap-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(190px,1fr)); gap: 16px; }
.stat-recap-card {
    padding: 18px 20px; border-radius: 12px;
    background: #fbfafa; border: 1px solid #efe9e9;
    transition: transform .15s ease, box-shadow .15s ease;
}
.stat-recap-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,.06); }
.stat-recap-card .lbl {
    font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
    color: #9a8d8d; margin-bottom: 8px;
}
.stat-recap-card .val {
    font-family: 'SF Mono', 'Cascadia Code', Consolas, monospace;
    font-size: 23px; font-weight: 800;
}
.stat-recap-card.accent {
    background: linear-gradient(135deg, var(--a) 0%, #7c1521 100%);
    border-color: var(--a);
}
.stat-recap-card.accent .lbl { color: #f3c9ce; }
.stat-recap-card.accent .val { color: #fff; }
