/* =========================================================
   Muzinga — Styles des espaces rôle (admin, staff, customer…)
   ========================================================= */

* { box-sizing: border-box; margin: 0; padding: 0; }

body.app-body {
    font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
    background: #F5EFE0;
    color: #2E2E2E;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ——— Navbar ——— */
.app-nav {
    background: #0A1F44;
    color: #FAF6EC;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    border-bottom: 3px solid #C9A227;
}

.app-brand { display: flex; align-items: center; gap: 12px; }
.app-brand .logo {
    width: 40px; height: 40px;
    background: #C9A227;
    color: #0A1F44;
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 20px;
}
.app-brand h1 { font-size: 16px; font-weight: 700; }
.app-brand small {
    font-size: 11px;
    color: #C9A227;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.app-user { display: flex; align-items: center; gap: 16px; }
.app-user-info { text-align: right; font-size: 13px; }
.app-user-info strong { display: block; }
.app-user-info .acc {
    font-family: ui-monospace, monospace;
    font-size: 11px;
    color: #C9A227;
}

.btn-logout {
    background: transparent;
    color: #FAF6EC;
    border: 1.5px solid rgba(250, 246, 236, .35);
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
}
.btn-logout:hover { background: rgba(201, 162, 39, .2); color: #C9A227; }

/* ——— Main ——— */
.app-main {
    flex: 1;
    max-width: 1200px;
    margin: 28px auto;
    padding: 0 24px;
    width: 100%;
}

.app-hero {
    background: linear-gradient(135deg, #0A1F44, #132E5C);
    color: #FAF6EC;
    padding: 26px 28px;
    border-radius: 14px;
    margin-bottom: 26px;
    box-shadow: 0 8px 30px rgba(10, 31, 68, .15);
}
.app-hero h2 { color: #FAF6EC; font-size: 22px; margin-bottom: 6px; }
.app-hero p  { font-size: 14px; opacity: .8; }
.pill-role {
    display: inline-block;
    background: #C9A227;
    color: #0A1F44;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    margin-top: 10px;
    letter-spacing: .5px;
    text-transform: uppercase;
}

/* ——— Sections ——— */
.app-section {
    background: #FAF6EC;
    border: 1px solid #E0D5B7;
    border-radius: 14px;
    padding: 22px;
    margin-bottom: 22px;
}
.app-section h3 {
    color: #0A1F44;
    font-size: 16px;
    margin-bottom: 16px;
}

.muted { color: #888; font-size: 13px; }
.mono  { font-family: ui-monospace, monospace; font-size: 12px; }
.tag {
    display: inline-block;
    background: #0A1F44;
    color: #C9A227;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .5px;
}

/* ——— Cartes rôles ——— */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.role-card {
    display: block;
    padding: 16px;
    background: #fff;
    border: 1px solid #E0D5B7;
    border-radius: 10px;
    text-decoration: none;
    color: #2E2E2E;
    transition: transform .15s, box-shadow .15s;
}
.role-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(10, 31, 68, .1); }
.role-card.disabled { opacity: .65; cursor: not-allowed; }
.role-card.disabled:hover { transform: none; box-shadow: none; }
.role-card h4 { font-size: 14px; color: #0A1F44; margin-bottom: 6px; }
.role-card p  { font-size: 12.5px; color: #666; margin-bottom: 10px; line-height: 1.4; }

/* ——— Stats ——— */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px;
    margin-bottom: 12px;
}
.stat-card {
    background: #fff;
    border: 1px solid #E0D5B7;
    border-left: 4px solid #0A1F44;
    border-radius: 10px;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.stat-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: #666;
    font-weight: 600;
}
.stat-value {
    font-size: 24px;
    font-weight: 800;
    color: #0A1F44;
    font-family: ui-monospace, monospace;
}
.stat-green { border-left-color: #1E7A3E; }
.stat-green .stat-value { color: #1E7A3E; }

/* ——— Footer ——— */
.app-footer {
    text-align: center;
    padding: 18px;
    font-size: 11px;
    color: #666;
    border-top: 1px solid #E0D5B7;
    background: #FAF6EC;
    display: flex;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
}

/* ——— Responsive ——— */
@media (max-width: 720px) {
    .app-nav { padding: 12px 16px; }
    .app-user-info { display: none; }
    .app-main { padding: 0 14px; margin: 18px auto; }
    .app-hero { padding: 20px; }
    .app-hero h2 { font-size: 18px; }
    .app-section { padding: 16px; }
}

/* ——— Tables dans les sections ——— */
.table-wrap { overflow-x: auto; border-radius: 10px; }

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
}
.admin-table th {
    background: #0A1F44;
    color: #FAF6EC;
    text-align: left;
    padding: 10px 12px;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.admin-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #E0D5B7;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: #F5EFE0; }

.pill {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}
.pill-ok  { background: #e8f5ec; color: #1E7A3E; }
.pill-ko  { background: #fdeceb; color: #B3261E; }
.pill-src { background: #e7edf8; color: #0A1F44; text-transform: uppercase; letter-spacing: .5px; }

.stat-warn { border-left-color: #C9A227; }
.stat-warn .stat-value { color: #8a6e0f; }

.muted { color: #888; font-size: 12px; }
.mono  { font-family: ui-monospace, monospace; font-size: 12px; }

/* ——— Barre de filtres ——— */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}
.filter-search {
    flex: 1;
    min-width: 220px;
    padding: 10px 12px;
    border: 1.5px solid #E0D5B7;
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    background: #fff;
}
.filter-search:focus {
    outline: none;
    border-color: #0A1F44;
    box-shadow: 0 0 0 3px rgba(10, 31, 68, .1);
}
.filter-select {
    padding: 10px 12px;
    border: 1.5px solid #E0D5B7;
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    background: #fff;
    cursor: pointer;
}
.filter-select:focus { outline: none; border-color: #0A1F44; }

.btn-inline { padding: 10px 16px !important; font-size: 13px !important; }
.btn-right  { margin-left: auto; }

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.contact-line {
    font-size: 11.5px;
    color: #666;
    line-height: 1.5;
}

/* ——— Badges supplémentaires ——— */
.pill-warn { background: #fff6e5; color: #8a6e0f; }
.pill-root {
    background: #C9A227;
    color: #0A1F44;
    font-size: 10px;
    padding: 2px 8px;
    margin-left: 6px;
    font-weight: 800;
    letter-spacing: .5px;
}

/* ——— Actions inline ——— */
.action-group {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: 1px solid #E0D5B7;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
    text-decoration: none;
    transition: background .15s, border-color .15s;
}
.btn-icon:hover {
    background: #F5EFE0;
    border-color: #0A1F44;
}
.btn-danger:hover {
    background: #fdeceb;
    border-color: #B3261E;
}

/* ——— Pagination ——— */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid #E0D5B7;
}
.page-btn {
    padding: 8px 14px;
    background: #FAF6EC;
    border: 1.5px solid #E0D5B7;
    border-radius: 8px;
    color: #0A1F44;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
}
.page-btn:hover { background: #0A1F44; color: #C9A227; border-color: #0A1F44; }
.page-info { font-size: 13px; color: #666; font-family: ui-monospace, monospace; }

@media (max-width: 720px) {
    .filter-bar { flex-direction: column; align-items: stretch; }
    .filter-search, .filter-select { width: 100%; }
    .btn-inline { width: 100%; text-align: center; }
    .btn-right { margin-left: 0; }
    .action-group { justify-content: flex-end; }
}

/* ——— Info liste (user_edit) ——— */
.info-list {
    display: grid;
    gap: 8px;
    font-size: 13px;
}
.info-list > div {
    padding: 8px 12px;
    background: #fff;
    border-left: 3px solid #C9A227;
    border-radius: 6px;
}
.info-list strong { color: #0A1F44; margin-right: 6px; }

/* ——— Notice (rappel : déjà présent, on garde) ——— */
.notice {
    padding: 14px 16px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 16px;
}
.notice strong { display: block; margin-bottom: 6px; font-size: 14px; }
.notice p { margin: 0 0 4px; line-height: 1.5; }

.notice-warn {
    background: #FFF6E5;
    color: #8a6e0f;
    border-left: 4px solid #C9A227;
}

/* ——— Alert générique ——— */
.alert-success, .alert-error {
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 16px;
    border-left: 4px solid;
}
.alert-success {
    background: #e8f5ec;
    color: #1E7A3E;
    border-color: #1E7A3E;
}
.alert-error {
    background: #fdeceb;
    color: #B3261E;
    border-color: #B3261E;
}
.alert-success code,
.alert-error code {
    background: #0A1F44;
    color: #C9A227;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: ui-monospace, monospace;
    font-size: 13px;
}

/* ——— Sécurité / Modération ——— */
.security-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(10, 31, 68, .6);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 1000;
}
.modal-backdrop.open { display: flex; }

.modal {
    background: #FAF6EC;
    border-radius: 14px;
    padding: 24px;
    max-width: 480px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,.4);
}
.modal h3 { color: #0A1F44; margin-bottom: 8px; font-size: 17px; }
.modal p  { font-size: 13px; color: #555; margin-bottom: 16px; line-height: 1.5; }

.modal textarea,
.modal input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid #E0D5B7;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    background: #fff;
    margin-bottom: 14px;
}
.modal textarea:focus,
.modal input:focus { outline: none; border-color: #0A1F44; }

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.pill-watch {
    background: #fff6e5;
    color: #8a6e0f;
    border: 1px solid #C9A227;
}
.pill-block {
    background: #fdeceb;
    color: #B3261E;
}

.stats-mini {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.stat-mini {
    background: #fff;
    border: 1px solid #E0D5B7;
    border-left: 4px solid #0A1F44;
    border-radius: 8px;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 130px;
}
.stat-mini .label { font-size: 10.5px; text-transform: uppercase; color: #666; letter-spacing: .5px; font-weight: 600; }
.stat-mini .value { font-size: 20px; font-weight: 800; color: #0A1F44; font-family: ui-monospace, monospace; }

.tag-critical { background: #B3261E; color: #fff; }
.tag-warn     { background: #C9A227; color: #0A1F44; }

.btn-danger {
    background: #B3261E !important;
    color: #fff !important;
}
.btn-danger:hover { background: #8a1d17 !important; }

/* ——— Bouton surveillance actif ——— */
.btn-watched {
    background: #FFF6E5 !important;
    border-color: #C9A227 !important;
}
.btn-watched:hover {
    background: #ffe9b8 !important;
}

/* ——— Pill surveillance (badge 👁️ à côté du nom) ——— */
.pill-watch {
    background: #fff6e5;
    color: #8a6e0f;
    border: 1px solid #C9A227;
    padding: 2px 6px;
    font-size: 11px;
}

/* ——— Cartes portefeuille (dashboard client) ——— */
.wallet-scroll {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    padding: 6px 2px 14px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}
.wallet-scroll::-webkit-scrollbar { height: 8px; }
.wallet-scroll::-webkit-scrollbar-track { background: #F5EFE0; border-radius: 10px; }
.wallet-scroll::-webkit-scrollbar-thumb { background: #0A1F44; border-radius: 10px; }

.wallet-card {
    flex: 0 0 auto;
    width: 240px;
    background: linear-gradient(135deg, #0A1F44, #132E5C);
    color: #FAF6EC;
    border-radius: 14px;
    padding: 18px;
    scroll-snap-align: start;
    box-shadow: 0 6px 20px rgba(10, 31, 68, .18);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.wallet-card::after {
    content: '';
    position: absolute;
    top: -40px; right: -40px;
    width: 120px; height: 120px;
    background: radial-gradient(circle, rgba(201,162,39,.35), transparent 70%);
    border-radius: 50%;
}
.wallet-card.unlocked { border: 1.5px solid #C9A227; }
.wallet-card.locked {
    background: linear-gradient(135deg, #2b3a55, #1f2d45);
    opacity: .85;
}

.wallet-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.wallet-code { font-weight: 800; font-size: 16px; letter-spacing: .5px; color: #C9A227; }
.wallet-symbol { font-size: 20px; opacity: .8; }

.wallet-balance {
    font-family: ui-monospace, monospace;
    font-size: 26px;
    font-weight: 800;
    margin: 6px 0;
    letter-spacing: .5px;
}
.muted-balance { color: #8a9cb5; font-size: 22px; }

.wallet-name { font-size: 12.5px; opacity: .85; }
.wallet-account { font-size: 10.5px; opacity: .55; margin-top: 2px; }

.wallet-badge {
    display: inline-block;
    align-self: flex-start;
    margin-top: 8px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .5px;
    text-transform: uppercase;
}
.wallet-badge.ok   { background: #C9A227; color: #0A1F44; }
.wallet-badge.warn { background: rgba(201,162,39,.15); color: #C9A227; border: 1px solid #C9A227; }

@media (max-width: 640px) {
    .wallet-card { width: 200px; padding: 14px; }
    .wallet-balance { font-size: 22px; }
}