/* ============================================================
   Dealia - feuille de style principale
   Charte, composants, mise en page publique et espace personnel
   ============================================================ */

:root {
    --ink: #0d1420;
    --ink-soft: #3d4757;
    --muted: #6b7688;

    --bg: #f4f6fa;
    --surface: #ffffff;
    --surface-2: #fafbfd;
    --line: #e3e7ee;
    --line-strong: #cfd6e2;

    --brand: #4338ca;
    --brand-600: #4f46e5;
    --brand-700: #3730a3;
    --brand-soft: #eef0fe;

    --mint: #0f9d6e;
    --mint-soft: #e6f7f0;
    --amber: #c2760a;
    --amber-soft: #fdf3e3;
    --rose: #c9372c;
    --rose-soft: #fdecea;
    --sky: #0b6bcb;
    --sky-soft: #e8f2fe;

    --radius-sm: 8px;
    --radius: 14px;
    --radius-lg: 20px;

    --shadow-sm: 0 1px 2px rgba(13, 20, 32, .06), 0 1px 3px rgba(13, 20, 32, .04);
    --shadow: 0 4px 12px rgba(13, 20, 32, .07), 0 1px 3px rgba(13, 20, 32, .04);
    --shadow-lg: 0 18px 40px rgba(13, 20, 32, .12);

    --font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;

    --nav-bottom-height: 68px;
}

[hidden] { display: none !important; }

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.55;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: var(--brand-600); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.22; letter-spacing: -.015em; font-weight: 700; }
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }

.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 18px; }
.container-narrow { max-width: 780px; }

.muted { color: var(--muted); }
.small { font-size: .86rem; }
.tiny { font-size: .78rem; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.75rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.75rem; }
.stack > * + * { margin-top: 1rem; }

/* ------------------------------------------------------------ entete public */

.public-header {
    position: sticky;
    top: 0;
    z-index: 40;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--line);
    padding-top: env(safe-area-inset-top, 0px);
}

.public-header .container {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-height: 64px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    font-weight: 800;
    font-size: 1.18rem;
    color: var(--ink);
    letter-spacing: -.02em;
}
.brand:hover { text-decoration: none; }

.brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--brand-600), var(--brand-700));
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 1rem;
    flex: none;
}

.public-nav {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: .35rem;
}

.public-nav a {
    padding: .5rem .8rem;
    border-radius: 10px;
    color: var(--ink-soft);
    font-weight: 500;
    font-size: .95rem;
}
.public-nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.public-nav a.is-active { background: var(--brand-soft); color: var(--brand-700); }

.nav-toggle {
    display: none;
    margin-left: auto;
    background: transparent;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    width: 42px;
    height: 42px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--ink);
}

/* --------------------------------------------------------------- basique UI */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .72rem 1.15rem;
    border-radius: 12px;
    border: 1px solid transparent;
    font: inherit;
    font-weight: 600;
    font-size: .95rem;
    cursor: pointer;
    transition: background .16s ease, border-color .16s ease, transform .06s ease, color .16s ease;
    background: var(--surface);
    color: var(--ink);
    line-height: 1.2;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary { background: var(--brand-600); color: #fff; }
.btn-primary:hover { background: var(--brand-700); }

.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: #1b2536; }

.btn-soft { background: var(--brand-soft); color: var(--brand-700); }
.btn-soft:hover { background: #e2e5fd; }

.btn-outline { border-color: var(--line-strong); background: var(--surface); color: var(--ink-soft); }
.btn-outline:hover { border-color: var(--ink-soft); color: var(--ink); }

.btn-danger { background: var(--rose-soft); color: var(--rose); }
.btn-danger:hover { background: #fbdedb; }

.btn-sm { padding: .45rem .8rem; font-size: .85rem; border-radius: 10px; }
.btn-block { width: 100%; }
.btn-lg { padding: .95rem 1.5rem; font-size: 1.02rem; }

.icon { width: 18px; height: 18px; flex: none; }
.icon-lg { width: 22px; height: 22px; flex: none; }

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.card-pad { padding: 1.25rem; }
.card-head {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
}
.card-head h3, .card-head h2 { margin: 0; font-size: 1.05rem; }
.card-head .spacer { margin-left: auto; }

.section { padding: 2.5rem 0; }
.section-title { display: flex; align-items: baseline; gap: .75rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.section-title h2 { margin: 0; }
.section-title .spacer { margin-left: auto; }

.badge {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .22rem .6rem;
    border-radius: 999px;
    font-size: .76rem;
    font-weight: 700;
    letter-spacing: .01em;
    background: var(--surface-2);
    color: var(--ink-soft);
    white-space: nowrap;
}
.badge-success { background: var(--mint-soft); color: var(--mint); }
.badge-warn { background: var(--amber-soft); color: var(--amber); }
.badge-danger { background: var(--rose-soft); color: var(--rose); }
.badge-info { background: var(--sky-soft); color: var(--sky); }
.badge-brand { background: var(--brand-soft); color: var(--brand-700); }

.chip {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .42rem .85rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface);
    font-size: .85rem;
    font-weight: 500;
    color: var(--ink-soft);
    cursor: pointer;
}
.chip:hover { border-color: var(--brand-600); color: var(--brand-700); text-decoration: none; }
.chip.is-active { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }

/* -------------------------------------------------------------------- hero  */

.hero {
    position: relative;
    padding: 3rem 0 2.5rem;
    background: linear-gradient(180deg, #eef0fe 0%, var(--bg) 100%);
    overflow: hidden;
}
.hero-grid {
    display: grid;
    gap: 2rem;
    align-items: center;
}
.hero h1 { font-size: 2.1rem; }
.hero-lead { font-size: 1.06rem; color: var(--ink-soft); max-width: 46ch; }
.hero-actions { display: flex; gap: .7rem; flex-wrap: wrap; margin-top: 1.25rem; }
.hero-media {
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--line);
    background: var(--surface);
}
.hero-media img { width: 100%; height: 320px; object-fit: cover; }

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--brand-700);
    background: var(--brand-soft);
    padding: .3rem .7rem;
    border-radius: 999px;
    margin-bottom: .9rem;
}

/* ------------------------------------------------------------------ grilles */

.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
/* Bandeaux de chiffres : deux colonnes sur telephone, quatre sur grand ecran. */
.grid-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 768px) { .grid-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 380px) { .grid-stats { grid-template-columns: 1fr; } }

/* --------------------------------------------------------- carte produit   */

.product {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
    transition: box-shadow .2s ease, transform .2s ease;
}
.product:hover { box-shadow: var(--shadow); transform: translateY(-2px); }

.product-media { position: relative; display: block; aspect-ratio: 4 / 3; overflow: hidden; background: var(--surface-2); }
.product-media img { width: 100%; height: 100%; object-fit: cover; }
.product-media .badge { position: absolute; top: .7rem; left: .7rem; }

.product-body { padding: 1rem; display: flex; flex-direction: column; gap: .45rem; flex: 1; }
.product-body h3 { font-size: 1rem; margin: 0; }
.product-meta { display: flex; align-items: center; gap: .5rem; font-size: .8rem; color: var(--muted); flex-wrap: wrap; }
.product-foot {
    margin-top: auto;
    padding-top: .8rem;
    display: flex;
    align-items: center;
    gap: .6rem;
    border-top: 1px solid var(--line);
    flex-wrap: wrap;
}
.price { font-weight: 800; font-size: 1.1rem; }
.price-note { font-size: .78rem; color: var(--muted); }

/* --------------------------------------------------------------- stats      */

.stat {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.15rem;
    box-shadow: var(--shadow-sm);
}
.stat-label { font-size: .82rem; font-weight: 600; color: var(--muted); display: flex; align-items: center; gap: .4rem; }
.stat-value { font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; margin: .35rem 0 .15rem; }
.stat-value.is-money { color: var(--mint); }
.stat-value.is-pending { color: var(--amber); }
.stat-delta { font-size: .82rem; font-weight: 600; display: inline-flex; align-items: center; gap: .25rem; }
.stat-delta.up { color: var(--mint); }
.stat-delta.down { color: var(--rose); }
.stat-delta.flat { color: var(--muted); }

.hero-figure {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}
.hero-figure .figure-line {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    padding: .55rem 0;
    border-bottom: 1px dashed var(--line);
    font-size: .95rem;
}
.hero-figure .figure-line:last-child { border-bottom: 0; }
.hero-figure .figure-line strong { font-size: 1.05rem; }

/* ------------------------------------------------------------- tableaux     */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
    min-width: 620px;
}
table.data th {
    text-align: left;
    font-size: .76rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--muted);
    font-weight: 700;
    padding: .75rem 1rem;
    border-bottom: 1px solid var(--line);
    background: var(--surface-2);
    white-space: nowrap;
}
table.data td {
    padding: .8rem 1rem;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}
table.data tbody tr:hover { background: var(--surface-2); }
table.data tbody tr:last-child td { border-bottom: 0; }
.cell-actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.cell-product { display: flex; align-items: center; gap: .7rem; min-width: 210px; }
.cell-product img { width: 42px; height: 42px; border-radius: 10px; object-fit: cover; flex: none; }

.table-scroll-hint { display: none; }

@media (max-width: 768px) {
    /* Les tableaux se transforment en fiches empilees : rien ne depasse de l ecran. */
    table.data { min-width: 0; }
    table.data thead { display: none; }
    table.data, table.data tbody, table.data tr, table.data td { display: block; width: 100%; }
    table.data tr {
        border: 1px solid var(--line);
        border-radius: var(--radius);
        padding: .7rem .85rem;
        margin-bottom: .8rem;
        background: var(--surface);
    }
    table.data tr:hover { background: var(--surface); }
    table.data td {
        border: 0;
        padding: .3rem 0;
        display: flex;
        gap: .7rem;
        align-items: center;
    }
    table.data td:empty { display: none; }
    table.data td::before {
        content: attr(data-label);
        font-size: .72rem;
        text-transform: uppercase;
        letter-spacing: .05em;
        color: var(--muted);
        font-weight: 700;
        min-width: 104px;
        flex: none;
    }
    .cell-product { min-width: 0; }
}

/* -------------------------------------------------------------- formulaires */

.form-grid { display: grid; gap: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field { display: flex; flex-direction: column; gap: .35rem; }
.field-full { grid-column: 1 / -1; }
.field label { font-size: .85rem; font-weight: 600; color: var(--ink-soft); }
.field .hint { font-size: .78rem; color: var(--muted); }

input, select, textarea {
    font: inherit;
    font-size: .95rem;
    padding: .68rem .8rem;
    border: 1px solid var(--line-strong);
    border-radius: 11px;
    background: var(--surface);
    color: var(--ink);
    width: 100%;
    transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus {
    outline: 0;
    border-color: var(--brand-600);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, .14);
}
textarea { min-height: 110px; resize: vertical; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7688' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .7rem center; padding-right: 2.2rem; }

.checkbox-row { display: flex; align-items: flex-start; gap: .65rem; }
.checkbox-row input[type="checkbox"] { width: 20px; height: 20px; flex: none; margin-top: .15rem; accent-color: var(--brand-600); }
.checkbox-row label { font-size: .9rem; font-weight: 500; color: var(--ink-soft); }

.toolbar {
    display: flex;
    gap: .6rem;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 1rem;
}
.toolbar input, .toolbar select { width: auto; min-width: 160px; }
.toolbar .spacer { margin-left: auto; }

/* ------------------------------------------------------------ choix banque  */

.choice-grid { display: grid; gap: .7rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.choice {
    border: 1.5px solid var(--line);
    border-radius: var(--radius);
    padding: 1rem;
    background: var(--surface);
    cursor: pointer;
    display: flex;
    gap: .7rem;
    align-items: flex-start;
    transition: border-color .15s ease, background .15s ease;
}
.choice:hover { border-color: var(--brand-600); }
.choice input { width: 18px; height: 18px; margin-top: .2rem; flex: none; accent-color: var(--brand-600); }
.choice.is-checked { border-color: var(--brand-600); background: var(--brand-soft); }
.choice strong { display: block; font-size: .95rem; }
.choice span { font-size: .82rem; color: var(--muted); }

/* ---------------------------------------------------------------- messages  */

.toast-zone {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(var(--nav-bottom-height) + 18px + env(safe-area-inset-bottom, 0px));
    z-index: 90;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    width: min(92vw, 420px);
    pointer-events: none;
}
.toast {
    background: var(--ink);
    color: #fff;
    border-radius: 12px;
    padding: .8rem 1rem;
    font-size: .9rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    gap: .6rem;
    align-items: flex-start;
}
.toast.is-success { background: #0b7a56; }
.toast.is-error { background: #a92c22; }

.alert {
    border-radius: var(--radius);
    padding: .95rem 1.1rem;
    border: 1px solid var(--line);
    background: var(--surface-2);
    font-size: .92rem;
    display: flex;
    gap: .7rem;
    align-items: flex-start;
}
.alert-info { background: var(--sky-soft); border-color: #cbe0fa; color: #0a4f96; }
.alert-warn { background: var(--amber-soft); border-color: #f4dfb8; color: #8a5607; }
.alert-success { background: var(--mint-soft); border-color: #c4ead9; color: #0a6a4a; }
.alert-danger { background: var(--rose-soft); border-color: #f6cdc9; color: #96251c; }
.alert strong { display: block; }

.empty {
    text-align: center;
    padding: 3rem 1.25rem;
    color: var(--muted);
}
.empty svg { width: 44px; height: 44px; color: var(--line-strong); margin: 0 auto .8rem; }

/* ------------------------------------------------------------------ modales */

.modal-back {
    position: fixed;
    inset: 0;
    background: rgba(13, 20, 32, .5);
    z-index: 100;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
}
.modal {
    background: var(--surface);
    width: 100%;
    max-width: 620px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    max-height: 92vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}
.modal-head {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    background: var(--surface);
    z-index: 2;
}
.modal-head h3 { margin: 0; font-size: 1.08rem; }
.modal-body { padding: 1.25rem; }
.modal-foot {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--line);
    display: flex;
    gap: .6rem;
    justify-content: flex-end;
    position: sticky;
    bottom: 0;
    background: var(--surface);
}

/* -------------------------------------------------- gabarit espace membre   */

.app-shell {
    display: grid;
    grid-template-columns: 250px 1fr;
    min-height: 100vh;
}

.app-sidebar {
    background: #101a2e;
    color: #c9d2e3;
    padding: 1.25rem 1rem;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.app-sidebar .brand { color: #fff; }
.app-sidebar .brand-mark { background: linear-gradient(135deg, #6366f1, #4338ca); }

.side-nav { display: flex; flex-direction: column; gap: .2rem; }
.side-nav a {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .62rem .8rem;
    border-radius: 11px;
    color: #c9d2e3;
    font-size: .93rem;
    font-weight: 500;
}
.side-nav a:hover { background: rgba(255, 255, 255, .07); text-decoration: none; color: #fff; }
.side-nav a.is-active { background: var(--brand-600); color: #fff; }
.side-nav .nav-sep {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: #6d7b96;
    padding: .9rem .8rem .3rem;
    font-weight: 700;
}

.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: .5rem; }
.side-user {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .7rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, .06);
}
.side-user .avatar {
    width: 34px; height: 34px; border-radius: 10px;
    background: linear-gradient(135deg, #6366f1, #4338ca);
    display: grid; place-items: center; font-weight: 700; color: #fff; font-size: .85rem; flex: none;
}
.side-user .who { overflow: hidden; }
.side-user .who strong { display: block; font-size: .85rem; color: #fff; }
.side-user .who span { font-size: .75rem; color: #93a1bb; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.app-main { min-width: 0; padding-bottom: 2rem; }

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    background: rgba(244, 246, 250, .94);
    backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--line);
    padding: .85rem 0;
    padding-top: calc(.85rem + env(safe-area-inset-top, 0px));
}
.app-topbar .container {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.app-topbar h1 { font-size: 1.25rem; margin: 0; }
.app-topbar .spacer { margin-left: auto; }
.app-content { padding-top: 1.5rem; }

.mobile-brand { display: none; }

/* ---------------------------------------------------------- barre du bas    */

.bottom-nav {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    background: rgba(255, 255, 255, .97);
    backdrop-filter: saturate(180%) blur(12px);
    border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}
.bottom-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
}
.bottom-nav li { flex: 1; }
.bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .18rem;
    padding: .55rem .2rem .5rem;
    font-size: .68rem;
    font-weight: 600;
    color: var(--muted);
    min-height: var(--nav-bottom-height);
}
.bottom-nav a:hover { text-decoration: none; }
.bottom-nav a.is-active { color: var(--brand-600); }
.bottom-nav .icon { width: 21px; height: 21px; }
.bottom-nav .dot {
    position: absolute;
    top: .35rem;
    margin-left: 1rem;
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--rose);
}

body.has-bottom-nav { padding-bottom: calc(var(--nav-bottom-height) + env(safe-area-inset-bottom, 0px) + 1.25rem); }

/* -------------------------------------------------------------- pied de page */

.site-footer {
    background: #101a2e;
    color: #96a3ba;
    padding: 2.5rem 0 calc(2rem + env(safe-area-inset-bottom, 0px));
    margin-top: 3rem;
    font-size: .9rem;
}
.site-footer a { color: #c9d2e3; }
.site-footer .cols { display: grid; gap: 1.75rem; grid-template-columns: 1.4fr 1fr 1fr; }
.site-footer h4 { color: #fff; font-size: .9rem; text-transform: uppercase; letter-spacing: .07em; margin-bottom: .8rem; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; }
.site-footer .legal {
    margin-top: 2rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, .1);
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: .82rem;
}
.site-footer .brand { color: #fff; }

/* ------------------------------------------------------------------ chart   */

.chart-box { position: relative; height: 280px; }
.chart-box.chart-sm { height: 220px; }

.legend-row { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .82rem; color: var(--muted); }
.legend-row span { display: inline-flex; align-items: center; gap: .4rem; }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* --------------------------------------------------------------- install PWA */

.install-bar {
    display: flex;
    align-items: center;
    gap: .9rem;
    padding: 1rem 1.1rem;
    border-radius: var(--radius);
    background: linear-gradient(135deg, #1a2340, #2c3580);
    color: #fff;
    flex-wrap: wrap;
}
.install-bar p { margin: 0; font-size: .88rem; color: #c3cbf0; }
.install-bar strong { display: block; font-size: .98rem; }

.store-badges { display: flex; gap: .7rem; flex-wrap: wrap; }
.store-badge {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    border: 1px solid rgba(255, 255, 255, .28);
    border-radius: 10px;
    padding: .45rem .75rem;
    font-size: .8rem;
    color: #e8ebff;
}

/* ------------------------------------------------------------ notification  */

.notif-item {
    display: flex;
    gap: .8rem;
    padding: .9rem 0;
    border-bottom: 1px solid var(--line);
}
.notif-item:last-child { border-bottom: 0; }
.notif-icon {
    width: 36px; height: 36px; border-radius: 11px; flex: none;
    display: grid; place-items: center;
    background: var(--brand-soft); color: var(--brand-700);
}
.notif-icon.is-succes { background: var(--mint-soft); color: var(--mint); }
.notif-icon.is-auto { background: var(--amber-soft); color: var(--amber); }
.notif-body { min-width: 0; }
.notif-body strong { display: block; font-size: .93rem; }
.notif-body p { margin: .15rem 0 0; font-size: .86rem; color: var(--muted); }

/* ------------------------------------------------------------------- utils  */

.split { display: grid; gap: 1.25rem; grid-template-columns: 1.6fr 1fr; align-items: start; }
/* Deux colonnes sur grand ecran, une seule sur telephone (la regle mobile est ecrite ici,
   pas en style en ligne, pour ne jamais etre ecrasee). */
.auth-split { display: grid; gap: 1.5rem; grid-template-columns: 1fr; align-items: center; }
@media (min-width: 900px) { .auth-split { grid-template-columns: 1fr 1fr; } }
.kv { display: grid; gap: .5rem; }
.kv-row { display: flex; justify-content: space-between; gap: 1rem; padding: .55rem 0; border-bottom: 1px dashed var(--line); font-size: .92rem; }
.kv-row:last-child { border-bottom: 0; }
.kv-row strong { font-weight: 700; }

.rank-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .8rem; }
.rank-item { display: flex; align-items: center; gap: .8rem; }
.rank-num {
    width: 26px; height: 26px; border-radius: 8px; flex: none;
    background: var(--surface-2); color: var(--muted);
    display: grid; place-items: center; font-size: .78rem; font-weight: 700;
}
.rank-item img { width: 42px; height: 42px; border-radius: 10px; object-fit: cover; flex: none; }
.rank-main { min-width: 0; flex: 1; }
.rank-main strong { display: block; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-main span { font-size: .78rem; color: var(--muted); }
.rank-value { font-weight: 800; font-size: .95rem; white-space: nowrap; }

.progress { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--brand-600); border-radius: 999px; }
.progress.is-money span { background: var(--mint); }

.spinner {
    width: 18px; height: 18px;
    border: 2px solid rgba(255, 255, 255, .35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
    background: linear-gradient(90deg, #eef1f6 25%, #e3e7ee 37%, #eef1f6 63%);
    background-size: 400% 100%;
    animation: shimmer 1.3s ease infinite;
    border-radius: 8px;
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

.reveal { opacity: 0; transform: translateY(12px); transition: opacity .5s ease, transform .5s ease; }
.reveal.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
    .reveal { opacity: 1; transform: none; transition: none; }
}

/* ------------------------------------------------------------- responsif   */

@media (max-width: 1024px) {
    .app-shell { grid-template-columns: 1fr; }
    .app-sidebar { display: none; }
    .mobile-brand { display: inline-flex; }
    .split { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .hero-grid { grid-template-columns: 1fr; }
    .site-footer .cols { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
    .bottom-nav { display: block; }

    .public-nav { display: none; }
    .public-nav.is-open {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        position: absolute;
        left: 12px;
        right: 12px;
        top: 100%;
        background: var(--surface);
        border: 1px solid var(--line);
        border-radius: var(--radius);
        box-shadow: var(--shadow-lg);
        padding: .5rem;
        gap: .15rem;
    }
    .nav-toggle { display: inline-flex; }
    .public-header { position: sticky; }

    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .site-footer .cols { grid-template-columns: 1fr; }

    h1 { font-size: 1.6rem; }
    .hero { padding: 1.75rem 0 1.5rem; }
    .hero h1 { font-size: 1.7rem; }
    .hero-media img { height: 230px; }
    .stat-value { font-size: 1.45rem; }
    .section { padding: 1.75rem 0; }

    .toolbar input, .toolbar select { width: 100%; min-width: 0; }
    .toolbar > .btn { width: 100%; }
    .modal-back { align-items: flex-end; }
    .app-topbar h1 { font-size: 1.1rem; }
}

@media (max-width: 420px) {
    .stat { padding: 1rem; }
    .card-pad { padding: 1rem; }
    .container { padding: 0 14px; }
}
