:root {
    /* Couleurs officielles de la marque Posidius Digital Services (extraites du logo). */
    --pd-primary: #1f85fc;
    --pd-primary-dark: #041c4e;
    --pd-primary-light: #eaf3ff;
    --pd-accent: #d4a017;
    --pd-danger: #c0392b;
    --pd-warning: #e67e22;
    --pd-success: #1e8449;
    --pd-bg: #f4f6f7;
    --pd-sidebar-w: 250px;
    --pd-text: #1f2d2b;
    --pd-muted: #6b7c78;
    --pd-border: #e3e8e7;
}

* { box-sizing: border-box; }

body {
    background: var(--pd-bg);
    color: var(--pd-text);
    font-family: 'Segoe UI', Roboto, Arial, sans-serif;
    font-size: 15px;
}

a { text-decoration: none; }

/* ---------- Layout ---------- */
.pd-app { display: flex; min-height: 100vh; }

.pd-sidebar {
    width: var(--pd-sidebar-w);
    background: linear-gradient(180deg, var(--pd-primary-dark), var(--pd-primary));
    color: #fff;
    flex-shrink: 0;
    position: fixed;
    top: 0; bottom: 0; left: 0;
    overflow-y: auto;
    z-index: 1030;
    transition: transform .2s ease;
}
.pd-sidebar-brand {
    display: flex; align-items: center; gap: 10px;
    padding: 18px 20px; font-weight: 700; font-size: 1.15rem;
    border-bottom: 1px solid rgba(255,255,255,.15);
}
.pd-nav-section { padding: 12px 18px 4px; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: rgba(255,255,255,.55); }
.pd-nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 20px; color: rgba(255,255,255,.88); font-size: .92rem;
    border-left: 3px solid transparent;
}
.pd-nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.pd-nav a.active { background: rgba(255,255,255,.14); border-left-color: var(--pd-accent); color: #fff; font-weight: 600; }
.pd-nav i { width: 18px; text-align: center; }

.pd-main { margin-left: var(--pd-sidebar-w); flex: 1; min-width: 0; display: flex; flex-direction: column; }

.pd-topbar {
    display: flex; align-items: center; justify-content: space-between;
    background: #fff; border-bottom: 1px solid var(--pd-border);
    padding: 12px 24px; position: sticky; top: 0; z-index: 1020;
}
.pd-topbar .pd-burger { display: none; background: none; border: none; font-size: 1.3rem; color: var(--pd-text); }
.pd-topbar h1 { font-size: 1.15rem; margin: 0; font-weight: 700; }
.pd-topbar .pd-user { display: flex; align-items: center; gap: 10px; }
.pd-avatar {
    width: 36px; height: 36px; border-radius: 50%; background: var(--pd-primary);
    color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.pd-content { padding: 24px; flex: 1; }

@media (max-width: 900px) {
    .pd-sidebar { transform: translateX(-100%); }
    .pd-sidebar.open { transform: translateX(0); }
    .pd-main { margin-left: 0; }
    .pd-topbar .pd-burger { display: block; }
}

/* ---------- Cards / KPI tiles ---------- */
.pd-card {
    background: #fff; border: 1px solid var(--pd-border); border-radius: 12px;
    padding: 18px 20px; box-shadow: 0 1px 2px rgba(0,0,0,.03);
}
.pd-kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 24px; }
.pd-kpi { display: flex; align-items: flex-start; gap: 14px; }
.pd-kpi-icon {
    width: 46px; height: 46px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
    font-size: 1.25rem; background: var(--pd-primary-light); color: var(--pd-primary); flex-shrink: 0;
}
.pd-kpi-icon.warn { background: #fdf2e3; color: var(--pd-warning); }
.pd-kpi-icon.danger { background: #fbeae8; color: var(--pd-danger); }
.pd-kpi-icon.gold { background: #fbf3dc; color: var(--pd-accent); }
.pd-kpi-label { font-size: .8rem; color: var(--pd-muted); margin-bottom: 2px; }
.pd-kpi-value { font-size: 1.35rem; font-weight: 700; line-height: 1.2; }

.pd-page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; flex-wrap: wrap; gap: 10px; }
.pd-page-header h2 { margin: 0; font-size: 1.3rem; font-weight: 700; }

.btn-pd-primary { background: var(--pd-primary); border-color: var(--pd-primary); color: #fff; }
.btn-pd-primary:hover { background: var(--pd-primary-dark); border-color: var(--pd-primary-dark); color: #fff; }
.text-pd-primary { color: var(--pd-primary); }
.badge-pd { background: var(--pd-primary-light); color: var(--pd-primary); font-weight: 600; }

table.pd-table { width: 100%; background: #fff; }
table.pd-table thead th { background: var(--pd-primary-light); color: var(--pd-primary-dark); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; border: none; }
table.pd-table td, table.pd-table th { vertical-align: middle; padding: 10px 12px; }

.pd-empty { text-align: center; padding: 40px 20px; color: var(--pd-muted); }
.pd-empty i { font-size: 2.2rem; margin-bottom: 10px; display: block; color: var(--pd-border); }

/* ---------- Posidius AI widget ---------- */
#pd-ai-fab {
    position: fixed; right: 22px; bottom: 22px; z-index: 1050;
    background: linear-gradient(135deg, var(--pd-primary), var(--pd-accent));
    color: #fff; border: none; border-radius: 30px; padding: 13px 20px;
    box-shadow: 0 6px 20px rgba(31,133,252,.35); font-weight: 600; display: flex; align-items: center; gap: 8px;
}
#pd-ai-panel {
    position: fixed; right: 22px; bottom: 88px; width: 360px; max-width: 92vw; height: 480px; max-height: 75vh;
    background: #fff; border-radius: 16px; box-shadow: 0 12px 40px rgba(0,0,0,.22);
    display: none; flex-direction: column; overflow: hidden; z-index: 1050; border: 1px solid var(--pd-border);
}
#pd-ai-panel.open { display: flex; }
#pd-ai-panel .pd-ai-head { background: var(--pd-primary-dark); color: #fff; padding: 14px 16px; display: flex; justify-content: space-between; align-items: center; }
#pd-ai-panel .pd-ai-body { flex: 1; overflow-y: auto; padding: 14px; background: #f9fbfa; }
#pd-ai-panel .pd-ai-foot { border-top: 1px solid var(--pd-border); padding: 10px; display: flex; gap: 8px; }
#pd-ai-panel .pd-ai-foot input { flex: 1; border: 1px solid var(--pd-border); border-radius: 20px; padding: 8px 14px; }
#pd-ai-panel .pd-ai-foot button { border: none; background: var(--pd-primary); color: #fff; border-radius: 50%; width: 38px; height: 38px; }
.pd-msg { margin-bottom: 12px; max-width: 85%; padding: 9px 13px; border-radius: 14px; font-size: .88rem; line-height: 1.4; white-space: pre-line; }
.pd-msg.user { background: var(--pd-primary); color: #fff; margin-left: auto; border-bottom-right-radius: 4px; }
.pd-msg.bot { background: #fff; border: 1px solid var(--pd-border); margin-right: auto; border-bottom-left-radius: 4px; }
.pd-ai-suggestions { padding: 8px 14px; display: flex; flex-wrap: wrap; gap: 6px; }
.pd-ai-suggestions button { font-size: .74rem; background: var(--pd-primary-light); color: var(--pd-primary-dark); border: none; border-radius: 12px; padding: 5px 10px; }

/* ---------- Bouton afficher/masquer mot de passe ---------- */
.pd-pw-field { position: relative; }
.pd-pw-field input[type="password"], .pd-pw-field input[type="text"] { padding-right: 42px; }
.pd-pw-toggle {
    position: absolute; top: 0; right: 0; height: 100%; width: 40px;
    display: flex; align-items: center; justify-content: center;
    background: none; border: none; color: var(--pd-muted); padding: 0;
}
.pd-pw-toggle:hover { color: var(--pd-primary); }

/* ---------- Modal de confirmation ---------- */
.pd-confirm-content { border: none; border-radius: 16px; overflow: hidden; }
.pd-confirm-icon {
    width: 56px; height: 56px; border-radius: 50%; background: #fbeae8; color: var(--pd-danger);
    display: flex; align-items: center; justify-content: center; font-size: 1.5rem; margin: 0 auto 14px;
}
.pd-confirm-message { color: var(--pd-text); font-size: 1rem; }

/* ---------- Badge logo uniforme (toutes les pages, même couleur de marque partout) ---------- */
.pd-logo-badge {
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
    background: #fff; border-radius: 10px; border: 1.5px solid var(--pd-primary);
    box-shadow: 0 2px 10px rgba(31,133,252,.35); overflow: hidden;
}
.pd-logo-badge img { display: block; width: 100%; height: 100%; object-fit: cover; }
.pd-logo-badge--sm { width: 34px; height: 34px; padding: 3px; border-radius: 8px; }
.pd-logo-badge--lg { width: 60px; height: 60px; padding: 6px; margin: 0 auto; }
.pd-logo-badge--md { width: 44px; height: 44px; padding: 4px; }

.pd-login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--pd-primary-dark), var(--pd-primary)); padding: 20px; }
.pd-login-card { background: #fff; border-radius: 16px; padding: 36px; width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.pd-plan-card { border: 2px solid var(--pd-border); border-radius: 14px; padding: 22px; text-align: center; height: 100%; }
.pd-plan-card.featured { border-color: var(--pd-accent); box-shadow: 0 8px 24px rgba(212,160,23,.2); }
.pd-plan-price { font-size: 1.6rem; font-weight: 800; color: var(--pd-primary); margin: 10px 0; }
