/* Espace famille — layout rapide, menu gauche, polices système */
:root {
    --tf-ink: #1e2a32;
    --tf-muted: #5c6b75;
    --tf-paper: #f3f1ed;
    --tf-paper-2: #e8e4dc;
    --tf-surface: #fff;
    --tf-clay: #c45c38;
    --tf-clay-dark: #9e4324;
    --tf-moss: #2f6b4f;
    --tf-moss-soft: #e3f2ea;
    --tf-line: #ddd6cc;
    --tf-danger: #b4232c;
    --tf-ok: #2c7a4b;
    --tf-side: #243746;
    --tf-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --bs-primary: #c45c38;
    --bs-primary-rgb: 196, 92, 56;
    --bs-body-bg: #f3f1ed;
    --bs-body-color: #1e2a32;
    --bs-border-color: #ddd6cc;
    --bs-link-color: #9e4324;
}
[data-bs-theme="dark"] {
    --tf-ink: #f2eee8;
    --tf-muted: #c2b6a8;
    --tf-paper: #1b1916;
    --tf-paper-2: #2a2622;
    --tf-surface: #24211d;
    --tf-clay: #e37a52;
    --tf-clay-dark: #c45c38;
    --tf-moss: #8fcdb0;
    --tf-moss-soft: #24362c;
    --tf-line: #3d362f;
    --tf-side: #141210;
    --bs-primary: #e37a52;
    --bs-body-bg: #1b1916;
    --bs-body-color: #f2eee8;
}

body.tribu-famille {
    font-family: var(--tf-font);
    background: var(--tf-paper);
    color: var(--tf-ink);
    margin: 0;
    min-height: 100vh;
}
body.tribu-famille h1, body.tribu-famille h2 { font-weight: 650; letter-spacing: -.01em; }

.tf-shell { display: flex; min-height: 100vh; }
.tf-stage { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.tf-sidebar {
    flex: 0 0 240px;
    width: 240px;
    background: var(--tf-side);
    color: #f4efe8;
    display: flex;
    flex-direction: column;
    padding: 1rem .85rem;
    z-index: 1050;
}
.tf-brand {
    display: flex; align-items: center; gap: .65rem;
    color: #fff !important; text-decoration: none !important;
    margin-bottom: 1.1rem; padding: .2rem;
}
.tf-brand img { width: 36px; height: 36px; object-fit: contain; border-radius: 8px; background: #fff; padding: 2px; }
.tf-brand-mark {
    width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center;
    background: var(--tf-clay); color: #fff; font-weight: 700;
}
.tf-brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.tf-brand-kicker { font-size: .65rem; letter-spacing: .12em; text-transform: uppercase; color: #c9b8a8; font-weight: 600; }
.tf-brand-name { font-size: .95rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tf-side-nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.tf-side-nav a {
    display: flex; align-items: center; gap: .6rem;
    padding: .5rem .7rem; border-radius: 8px;
    color: #eadfd3 !important; text-decoration: none !important;
    font-weight: 600; font-size: .92rem;
}
.tf-side-nav a i { width: 1.15rem; text-align: center; }
.tf-side-nav a:hover { background: rgba(255,255,255,.08); color: #fff !important; }
.tf-side-nav a.active { background: var(--tf-clay); color: #fff !important; }
.tf-sidebar-foot { margin-top: auto; padding-top: 1rem; display: grid; gap: .4rem; }
.tf-side-account, .tf-side-logout {
    display: flex; align-items: center; gap: .5rem; width: 100%;
    border: 0; background: rgba(255,255,255,.08); color: #fff !important;
    text-decoration: none !important; border-radius: 8px; padding: .5rem .7rem;
    font-weight: 600; text-align: left; font-size: .9rem;
}
.tf-side-logout { background: transparent; color: #f3c7b4 !important; cursor: pointer; }

.tf-backdrop { display: none; }
.tf-menu-btn {
    display: none; width: 40px; height: 40px; border: 0; border-radius: 8px;
    background: transparent; font-size: 1.4rem; color: var(--tf-ink);
}
@media (max-width: 991px) {
    .tf-menu-btn { display: grid; place-items: center; }
    .tf-sidebar {
        position: fixed; inset: 0 auto 0 0; height: 100vh;
        transform: translateX(-105%);
        transition: transform .18s ease;
    }
    body.tf-nav-open .tf-sidebar { transform: none; }
    .tf-backdrop {
        display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 1040;
    }
    body.tf-nav-open .tf-backdrop { display: block; }
    body.tf-nav-open { overflow: hidden; }
}

.tf-topbar {
    display: flex; align-items: center; justify-content: space-between;
    gap: .5rem; padding: .55rem 1rem;
    background: var(--tf-surface); border-bottom: 1px solid var(--tf-line);
    position: sticky; top: 0; z-index: 20;
}
.tf-topbar-left { display: flex; align-items: center; gap: .5rem; min-width: 0; }
.tf-topbar-title { font-weight: 700; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tf-top-actions { display: flex; gap: .2rem; margin: 0; padding: 0; list-style: none; }
.tf-icon-btn {
    width: 38px; height: 38px; border: 0; border-radius: 8px; background: transparent;
    color: var(--tf-ink); display: grid; place-items: center;
}
.tf-icon-btn:hover { background: var(--tf-paper); }

.tf-main { width: min(960px, calc(100% - 2rem)); margin: 0 auto; padding: 1.1rem 0 2rem; flex: 1; }
.tf-page-title { font-size: 1.45rem; margin: 0 0 1rem; }
.tf-kicker { font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--tf-clay); font-weight: 700; margin: 0 0 .25rem; }
.tf-back { display: inline-block; color: var(--tf-muted); text-decoration: none; font-weight: 600; margin-bottom: .6rem; }
.tf-back:hover { color: var(--tf-clay); }

body.tribu-famille .card, .tf-panel {
    background: var(--tf-surface) !important;
    border: 1px solid var(--tf-line) !important;
    border-radius: 12px !important;
    box-shadow: none;
    overflow: hidden;
}
body.tribu-famille .card-header, body.tribu-famille .card-footer {
    background: transparent !important; border-color: var(--tf-line) !important; color: var(--tf-ink) !important;
}
body.tribu-famille .card-title { font-size: 1.1rem !important; font-weight: 650 !important; }
body.tribu-famille .card-body { padding: 1rem 1.1rem; }
.tf-note, body.tribu-famille .div-intro {
    background: var(--tf-surface); border: 1px solid var(--tf-line); border-radius: 10px;
    padding: .85rem 1rem; margin-bottom: 1rem; color: var(--tf-muted);
}

body.tribu-famille .btn-primary {
    --bs-btn-bg: var(--tf-clay); --bs-btn-border-color: var(--tf-clay);
    --bs-btn-hover-bg: var(--tf-clay-dark); --bs-btn-hover-border-color: var(--tf-clay-dark);
    --bs-btn-color: #fff; border-radius: 8px !important; font-weight: 650;
}
body.tribu-famille .btn-success { --bs-btn-bg: var(--tf-moss); --bs-btn-border-color: var(--tf-moss); border-radius: 8px !important; }
body.tribu-famille .btn-danger, body.tribu-famille .btn-outline-primary { border-radius: 8px !important; }
body.tribu-famille .btn-outline-primary { --bs-btn-color: var(--tf-clay); --bs-btn-border-color: var(--tf-clay); --bs-btn-hover-bg: var(--tf-clay); }
body.tribu-famille a:not(.btn):not(.tf-brand):not(.tf-side-nav a):not(.tf-icon-btn):not(.tf-side-account) { color: var(--tf-clay-dark); }

body.tribu-famille .table { margin: 0; }
body.tribu-famille .table thead th {
    background: var(--tf-paper) !important; color: var(--tf-muted) !important;
    font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; border: 0 !important;
}
body.tribu-famille .table td { border-color: var(--tf-line) !important; vertical-align: middle; }
body.tribu-famille .form-control, body.tribu-famille .form-select, body.tribu-famille .input-group-text {
    border-radius: 8px; border-color: var(--tf-line); background: var(--tf-surface);
}
body.tribu-famille .form-control:focus, body.tribu-famille .form-select:focus {
    border-color: var(--tf-clay); box-shadow: 0 0 0 .15rem rgba(196,92,56,.2);
}
body.tribu-famille .form-check-input:checked { background-color: var(--tf-clay); border-color: var(--tf-clay); }

.tf-home { display: grid; gap: 1rem; margin-bottom: 1.5rem; }
.tf-home-hero, .tf-home-todo {
    background: var(--tf-surface); border: 1px solid var(--tf-line); border-radius: 12px; padding: 1.1rem 1.15rem;
}
.tf-hello { font-size: 1.55rem; margin: 0 0 .4rem; color: var(--tf-ink); }
.tf-hello-sub { color: var(--tf-muted); margin: 0; }
.tf-todo-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.tf-todo-list a {
    display: flex; align-items: center; gap: .7rem; padding: .65rem .7rem;
    border-radius: 8px; background: var(--tf-paper); text-decoration: none !important; color: var(--tf-ink) !important;
}
.tf-todo-count {
    min-width: 1.8rem; height: 1.8rem; border-radius: 999px; display: grid; place-items: center;
    background: var(--tf-clay); color: #fff; font-weight: 700; font-size: .85rem;
}
.tf-todo-meta { margin-left: auto; color: var(--tf-muted); font-size: .8rem; font-weight: 600; }
.tf-section { margin-bottom: 1.6rem; }
.tf-section-title { font-size: 1.2rem; margin: 0 0 .7rem; }

.tuiles-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; }
@media (min-width: 700px) { .tuiles-grid { grid-template-columns: repeat(3, 1fr); } }
.tuile {
    background: var(--tf-surface) !important; color: var(--tf-ink) !important;
    border: 1px solid var(--tf-line); border-radius: 12px; min-height: 92px;
    padding: .9rem; display: flex; flex-direction: column; justify-content: space-between;
    text-decoration: none !important;
}
.tuile-icone { width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; background: var(--tf-paper); color: var(--tf-clay); }
.tuile-label { font-weight: 700; }
.tuile-c1, .tuile-c2, .tuile-c3, .tuile-c4, .tuile-c5, .tuile-c6, .tuile-c7, .tuile-c8 { background: var(--tf-surface) !important; }

.tf-news { display: grid; gap: .8rem; }
@media (min-width: 800px) { .tf-news { grid-template-columns: repeat(2, 1fr); } }
.tf-news-card { background: var(--tf-surface); border-radius: 12px; overflow: hidden; border: 1px solid var(--tf-line); position: relative; }
.tf-news-card img { width: 100%; height: 150px; object-fit: cover; }
.tf-news-card .body { padding: .9rem 1rem; }
.tf-news-card a, .tf-news-card .card-text a { background-color: transparent !important; }
.tf-news-card h3 { font-size: 1.05rem; margin: 0 0 .35rem; }
.tf-news-meta { font-size: .78rem; color: var(--tf-muted); }

.tf-person { display: flex; align-items: center; gap: .8rem; padding: .85rem 1rem; }
.tf-avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; background: var(--tf-paper-2); }
.tf-person-name { margin: 0; font-size: 1.05rem; }
.tf-person-meta { color: var(--tf-muted); font-size: .86rem; }
.tf-pill { display: inline-flex; align-items: center; gap: .3rem; border-radius: 999px; padding: .15rem .55rem; font-size: .75rem; font-weight: 700; }
.tf-pill.ok { background: var(--tf-moss-soft); color: var(--tf-moss); }
.tf-pill.ko { background: #fde4e4; color: var(--tf-danger); }
.tf-pill.soon { background: #fff1cc; color: #8a6a00; }

.tf-ledger { display: grid; gap: .55rem; }
.tf-row {
    display: grid; grid-template-columns: 1fr auto; gap: .35rem 1rem; align-items: center;
    background: var(--tf-surface); border: 1px solid var(--tf-line); border-radius: 10px; padding: .8rem .95rem;
}
.tf-amount { font-weight: 700; font-size: 1.1rem; }
.tf-balance { border-radius: 12px; padding: 1rem 1.1rem; margin-bottom: 1rem; background: var(--tf-side); color: #fff; }
.tf-balance.ok { background: var(--tf-moss); }
.tf-balance.warn { background: var(--tf-clay); }
.tf-balance .label { text-transform: uppercase; letter-spacing: .1em; font-size: .7rem; opacity: .8; }
.tf-balance .value { font-size: 1.8rem; line-height: 1.15; font-weight: 700; }

.tf-fiche { display: grid; gap: .85rem; }
.tf-fiche-head {
    display: flex; align-items: center; gap: .85rem;
    background: var(--tf-surface); border: 1px solid var(--tf-line); border-radius: 12px; padding: .85rem 1rem;
}
.tf-fiche-head img { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; }
.tf-fiche-head h2 { margin: 0; font-size: 1.2rem; }
.tf-tabs { display: flex; gap: .3rem; overflow-x: auto; }
.tf-tabs a {
    flex: 0 0 auto; display: inline-flex; align-items: center; gap: .35rem;
    padding: .4rem .75rem; border-radius: 999px; background: var(--tf-surface);
    border: 1px solid var(--tf-line); color: var(--tf-ink) !important; text-decoration: none !important; font-weight: 600; font-size: .88rem;
}
.tf-tabs a.active, .tf-tabs a[aria-current="page"] { background: var(--tf-side); color: #fff !important; border-color: var(--tf-side); }
.tf-fiche-main { min-width: 0; }

.tf-dir { display: grid; gap: .7rem; }
@media (min-width: 700px) { .tf-dir { grid-template-columns: repeat(2, 1fr); } }
.tf-dir article { background: var(--tf-surface); border: 1px solid var(--tf-line); border-radius: 12px; padding: 1rem; }
.tf-dir h3 { margin: 0 0 .5rem; font-size: 1.05rem; }

.bottom-nav { display: none !important; }
.tf-footer {
    width: min(960px, calc(100% - 2rem)); margin: 0 auto 1rem; padding: .3rem 0 1rem;
    color: var(--tf-muted); font-size: .8rem; display: flex; flex-wrap: wrap; gap: .4rem 1rem; justify-content: space-between;
}
.tf-footer a { color: var(--tf-muted); }

body.tribu-famille .modal-content { border-radius: 12px; overflow: hidden; border: 0; }
body.tribu-famille .modal-header { background: var(--tf-side) !important; color: #fff !important; border: 0; }
#table_grille .table-grille thead th, #table_grille .table-grille thead th:first-child { background-color: var(--tf-side) !important; }
body.tribu-famille .breadcrumb, body.tribu-famille .app-content-header, body.tribu-famille .app-footer { display: none; }
body.tribu-famille .app-content { padding: 0 !important; }
body.tribu-famille .badge.bg-primary, body.tribu-famille .bg-primary { background-color: var(--tf-clay) !important; }
body.tribu-famille .direct-chat { --lte-direct-chat-bg: var(--tf-clay); --lte-direct-chat-color: #fff; }
body.tribu-famille .alert { border-radius: 10px; }

.tf-chat-thread { max-height: 420px; overflow: auto; display: grid; gap: .65rem; }
.tf-bubble { max-width: 85%; border-radius: 12px; padding: .75rem .9rem; background: var(--tf-paper); }
.tf-bubble.me { margin-left: auto; background: var(--tf-side); color: #f6efe6; }
.tf-bubble header { display: flex; flex-wrap: wrap; gap: .35rem .8rem; font-size: .78rem; opacity: .75; margin-bottom: .3rem; }

body.tribu-famille .accordion-activites .accordion-button { background: var(--tf-surface); color: var(--tf-ink); }
body.tribu-famille .accordion-activites .accordion-button:not(.collapsed) { background: var(--tf-paper); box-shadow: none; }
body.tribu-famille .periode-card { background: var(--tf-paper); border-color: var(--tf-line); border-radius: 10px; }

/* Login */
body.tribu-login { font-family: var(--tf-font); min-height: 100vh; margin: 0; background: var(--tf-paper); color: var(--tf-ink); }
body.tribu-login .tf-login { min-height: 100vh; display: grid; }
@media (min-width: 900px) { body.tribu-login .tf-login { grid-template-columns: 280px 1fr; } }
.tf-login-aside {
    display: none; background: var(--tf-side); color: #f6efe6; padding: 1.8rem;
}
@media (min-width: 900px) { .tf-login-aside { display: flex; flex-direction: column; justify-content: space-between; } }
.tf-login-aside h1 { font-size: 1.7rem; line-height: 1.15; margin: .6rem 0 0; color: #fff; }
.tf-login-panel { display: flex; align-items: center; justify-content: center; padding: 4.5rem 1.2rem 2rem; }
.tf-login-card { width: min(400px, 100%); }
.tf-login-card h2 { font-size: 1.5rem; margin: .2rem 0 1rem; }
body.tribu-login .login-btn { border-radius: 8px; background: var(--tf-clay); border-color: var(--tf-clay); font-weight: 700; }
body.tribu-login .toolbar-login { position: fixed; top: .8rem; right: .8rem; z-index: 20; display: flex; gap: .35rem; }
body.tribu-login .btn-pill-toolbar {
    background: var(--tf-surface); border: 1px solid var(--tf-line); border-radius: 8px; padding: .35rem .65rem; color: var(--tf-ink);
}
body.tribu-login .bg-image, body.tribu-login .login-card, body.tribu-login .login-card-img { display: none !important; }
body.tribu-login .form-control, body.tribu-login .input-group-text {
    border-radius: 8px; border-color: var(--tf-line); background: var(--tf-surface); color: var(--tf-ink);
}
body.tribu-login .input-group .input-group-text { border-right: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }
body.tribu-login .input-group .form-control { border-left: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; }
body.tribu-login .input-group .form-control ~ .input-group-text { border-left: 1px solid var(--tf-line); border-radius: 0 8px 8px 0; }
body.tribu-login a { color: var(--tf-clay-dark); }
body.tribu-login .skip-link { position: absolute; top: -100px; left: 1rem; z-index: 9999; padding: .5rem 1rem; background: #fff; color: #000; font-weight: 700; }
body.tribu-login .skip-link:focus { top: 1rem; }

body.tribu-famille a:focus-visible, body.tribu-famille button:focus-visible,
body.tribu-login a:focus-visible, body.tribu-login button:focus-visible {
    outline: 3px solid var(--tf-clay); outline-offset: 2px;
}
.detail_infos_individu span { font-size: .82rem !important; color: var(--tf-muted) !important; }
.custom-skip-link { position: absolute; top: -100%; left: 0; z-index: 9999; padding: .5rem 1rem; background: #000; color: #fff; }
.custom-skip-link:focus { top: 0; }
@media print { .tf-sidebar, .tf-topbar, .tf-backdrop, .tf-footer { display: none !important; } }
