:root {
  /* Mode Clair — même palette que le reste du site, moins blanche (façon Facebook) */
  --crust:#eeece7; --card:#ffffff; --card2:#f6f3ed;
  --border:rgba(168,70,15,.16); --border2:rgba(168,70,15,.24);
  --sand:#2a2015; --muted:#8a7358;
  --ember:#a8460f; --ember2:#8a3a0c;
  --red:#c93f3f; --green:#2f9e63;
  --ember-rgb:168,70,15; --fg-rgb:0,0,0; --header-bg:rgba(238,236,231,.95);
}
[data-theme="dark"] {
  /* Dark Marron — comportement historique */
  --crust:#0c0a08; --card:#141210; --card2:#1a1612;
  --border:#3d3028; --border2:#2a221c;
  --sand:#ede0cc; --muted:#9a8878;
  --ember:#e07b35; --ember2:#c96a20;
  --red:#ef4444; --green:#22c55e;
  --ember-rgb:224,123,53; --fg-rgb:255,255,255; --header-bg:rgba(12,10,8,.95);
}
[data-theme="pure"] {
  /* Dark Pur — fonds neutres, sans teinte brune, accent conservé */
  --crust:#18181a; --card:#222226; --card2:#26262a;
  --border:#38383d; --border2:#2c2c30;
  --sand:#ededee; --muted:#a3a3a8;
  --ember:#e07b35; --ember2:#c96820;
  --red:#ef4444; --green:#22c55e;
  --ember-rgb:224,123,53; --fg-rgb:255,255,255; --header-bg:rgba(24,24,26,.95);
}
        *, *::before, *::after { box-sizing: border-box; }
        body {
            background: var(--crust);
            color: var(--sand);
            font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
            margin: 0; min-height: 100vh;
        }

        /* ─── SCROLLBAR ─── */
        ::-webkit-scrollbar { width: 4px; }
        ::-webkit-scrollbar-track { background: transparent; }
        ::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
        ::-webkit-scrollbar-thumb:hover { background: var(--ember); }

        /* ─── LAYOUT ─── */
        .main-container { display: flex; min-height: 100vh; }

        /* ─── SIDEBAR ─── */
        .sidebar {
            width: 260px; min-width: 260px; background: var(--card);
            border-right: 1px solid var(--border2); height: 100vh;
            position: sticky; top: 0; display: flex; flex-direction: column;
            padding: 28px 16px; overflow-y: auto;
        }
        .sidebar-logo {
            font-family: 'Syne', sans-serif; font-weight: 800;
            font-size: 1.7rem; letter-spacing: -1px; color: var(--sand);
            padding: 0 8px; margin-bottom: 32px;
        }
        .sidebar-logo span { color: var(--ember); }
        .sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
        .sidebar-item {
            display: flex; align-items: center; gap: 12px;
            padding: 10px 12px; border-radius: 2px;
            color: var(--muted); font-size: .9rem; font-weight: 500;
            cursor: pointer; transition: all .2s; text-decoration: none;
            position: relative;
        }
        .sidebar-item svg { width: 18px; height: 18px; flex-shrink: 0; }
        .sidebar-item:hover { background: rgba(var(--ember-rgb),.08); color: var(--sand); }
        .sidebar-item.active { background: rgba(var(--ember-rgb),.14); color: var(--ember); }
        .sidebar-item.active::before {
            content: ''; position: absolute; left: 0; top: 50%;
            transform: translateY(-50%); width: 3px; height: 60%;
            background: var(--ember); border-radius: 0 3px 3px 0;
        }
        .notif-badge {
            margin-left: auto; background: var(--ember); color: var(--crust);
            font-size: 10px; font-weight: 700; min-width: 18px; height: 18px;
            border-radius: 2px; display: none; align-items: center;
            justify-content: center; padding: 0 4px;
        }
        .notif-badge.show { display: flex; }

        /* ─── CONTENT ─── */
        .content { flex: 1; height: 100vh; overflow-y: auto; }

        /* ─── PC HEADER ─── */
        .pc-header {
            position: sticky; top: 0; z-index: 50;
            background: var(--header-bg); backdrop-filter: blur(16px);
            border-bottom: 1px solid var(--border2);
            padding: 14px 28px; display: flex; align-items: center;
            justify-content: space-between;
        }
        .pc-header-title {
            font-family: 'Syne', sans-serif; font-weight: 700;
            font-size: 1.1rem; color: var(--sand);
        }
        .header-btn {
            width: 36px; height: 36px; border-radius: 2px;
            background: var(--card2); border: 1px solid var(--border2);
            display: flex; align-items: center; justify-content: center;
            cursor: pointer; color: var(--muted); transition: all .2s;
        }
        .header-btn:hover { background: var(--border2); color: var(--sand); }
        .header-btn.spin svg { animation: spin .8s linear infinite; }
        @keyframes spin { to { transform: rotate(360deg); } }

        /* ─── MAIN CONTENT ─── */
        .main-content {
            max-width: 640px; margin: 0 auto; padding: 20px 16px;
        }

        /* ─── MOBILE TOPBAR ─── */
        .mobile-topbar {
            display: flex; align-items: center; justify-content: space-between;
            padding: 14px 18px; border-bottom: 1px solid var(--border2);
            background: var(--header-bg); backdrop-filter: blur(16px);
            position: sticky; top: 0; z-index: 50;
        }
        .mobile-topbar-title {
            font-family: 'Syne', sans-serif; font-weight: 700;
            font-size: 1.1rem; color: var(--sand);
        }
        .back-btn {
            width: 36px; height: 36px; border-radius: 2px;
            background: var(--card2); border: 1px solid var(--border2);
            display: flex; align-items: center; justify-content: center;
            cursor: pointer; color: var(--muted); transition: all .2s;
        }
        .back-btn:hover { background: var(--border2); color: var(--sand); }

        /* ─── FILTER CHIPS ─── */
        .filter-row {
            display: flex; gap: 7px; overflow-x: auto;
            scrollbar-width: none; padding-bottom: 2px; margin-bottom: 24px;
        }
        .filter-row::-webkit-scrollbar { display: none; }
        .filter-chip {
            display: inline-flex; align-items: center; gap: 6px;
            padding: 7px 14px; border-radius: 2px;
            font-size: .8rem; font-weight: 600; white-space: nowrap;
            cursor: pointer; border: 1.5px solid var(--border2);
            background: var(--card); color: var(--muted);
            transition: all .2s; flex-shrink: 0;
        }
        .filter-chip:hover { border-color: rgba(var(--ember-rgb),.3); color: var(--sand); }
        .filter-chip.active {
            background: rgba(var(--ember-rgb),.12);
            border-color: rgba(var(--ember-rgb),.45); color: var(--ember);
        }
        .filter-chip svg { width: 14px; height: 14px; }

        /* ─── SECTION LABELS ─── */
        .section-label {
            font-size: .72rem; font-weight: 700; letter-spacing: 1.5px;
            text-transform: uppercase; color: var(--border);
            margin-bottom: 10px;
            display: flex; align-items: center; justify-content: space-between;
        }
        .section-count {
            background: var(--card2); border: 1px solid var(--border2);
            padding: 2px 8px; border-radius: 2px; font-size: .7rem;
            color: var(--muted); font-weight: 600; letter-spacing: 0;
        }

        /* ─── NOTIFICATION CARD ─── */
        .notification-card {
            background: var(--card); border: 1px solid var(--border2);
            border-radius: 2px; padding: 14px 16px;
            margin-bottom: 8px; cursor: pointer;
            transition: all .22s; position: relative; overflow: hidden;
        }
        .notification-card:hover {
            border-color: rgba(var(--ember-rgb),.28);
            box-shadow: 0 6px 24px rgba(0,0,0,.35);
            transform: translateY(-1px);
        }
        .notification-card.unread {
            border-left: 3px solid var(--ember);
            background: linear-gradient(90deg, rgba(var(--ember-rgb),.06) 0%, var(--card) 100%);
        }
        .notification-card.new {
            animation: newPop .5s ease;
        }
        @keyframes newPop {
            0% { transform: scale(1); }
            40% { transform: scale(1.015); border-color: rgba(var(--ember-rgb),.5); }
            100% { transform: scale(1); }
        }

        /* Unread dot */
        .unread-dot {
            position: absolute; top: 14px; right: 14px;
            width: 8px; height: 8px; border-radius: 50%;
            background: var(--ember);
            box-shadow: 0 0 6px rgba(var(--ember-rgb),.6);
        }

        /* Avatar */
        .notif-avatar {
            width: 44px; height: 44px; border-radius: 2px;
            object-fit: cover; flex-shrink: 0; background: var(--border2);
        }
        .notif-avatar-wrap { position: relative; flex-shrink: 0; }
        .notif-type-badge {
            position: absolute; bottom: -4px; right: -4px;
            width: 20px; height: 20px; border-radius: 50%;
            display: flex; align-items: center; justify-content: center;
            border: 2px solid var(--card); font-size: 10px;
        }

        /* Icon fallback */
        .notif-icon {
            width: 44px; height: 44px; border-radius: 2px;
            display: flex; align-items: center; justify-content: center;
            background: rgba(var(--ember-rgb),.12); color: var(--ember); flex-shrink: 0;
        }
        .notif-icon svg { width: 20px; height: 20px; }

        /* Content */
        .notif-name {
            font-weight: 700; font-size: .9rem; color: var(--sand);
            display: inline;
        }
        .notif-text {
            font-size: .88rem; color: var(--muted); display: inline;
        }
        .notif-time {
            font-size: .72rem; color: var(--border); margin-top: 4px;
            display: flex; align-items: center; gap: 4px;
        }
        .notif-context {
            margin-top: 8px; padding: 9px 12px;
            background: var(--crust); border-radius: 2px;
            border: 1px solid var(--border2);
            font-size: .82rem; color: var(--muted); font-style: italic;
            overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
        }

        /* Mark read btn */
        .mark-read-btn {
            position: absolute; top: 12px; right: 12px;
            width: 26px; height: 26px; border-radius: 2px;
            background: transparent; border: none;
            cursor: pointer; color: var(--border);
            display: flex; align-items: center; justify-content: center;
            transition: all .2s; opacity: 0;
        }
        .notification-card:hover .mark-read-btn { opacity: 1; }
        .mark-read-btn:hover { color: var(--ember); background: rgba(var(--ember-rgb),.1); }

        /* ─── SECTION GROUP ─── */
        .section-group { margin-bottom: 28px; }

        /* ─── EMPTY STATE ─── */
        .empty-state {
            text-align: center; padding: 64px 20px;
        }
        .empty-icon {
            width: 72px; height: 72px; border-radius: 2px;
            background: var(--card2); border: 1px solid var(--border2);
            display: flex; align-items: center; justify-content: center;
            margin: 0 auto 18px;
        }
        .empty-title {
            font-family: 'Syne', sans-serif; font-weight: 700;
            font-size: 1.1rem; color: var(--sand); margin-bottom: 8px;
        }
        .empty-sub { font-size: .88rem; color: var(--border); }

        /* ─── LOADING ─── */
        .loading-wrap { display: flex; justify-content: center; padding: 48px 0; }
        .loading-ring {
            width: 36px; height: 36px;
            border: 3px solid rgba(var(--fg-rgb),.06);
            border-top-color: var(--ember);
            border-radius: 50%; animation: spin .9s linear infinite;
        }

        /* ─── MARK ALL BTN ─── */
        .mark-all-btn {
            display: flex; align-items: center; gap: 7px;
            padding: 8px 16px; border-radius: 2px;
            background: var(--card2); border: 1px solid var(--border2);
            color: var(--muted); font-size: .82rem; font-weight: 600;
            cursor: pointer; transition: all .2s;
            font-family: 'DM Sans', sans-serif;
        }
        .mark-all-btn:hover { border-color: rgba(var(--ember-rgb),.35); color: var(--ember); }
        .mark-all-btn svg { width: 15px; height: 15px; }

        /* ─── MODAL ─── */
        .modal-overlay {
            position: fixed; inset: 0;
            background: rgba(0,0,0,.8); backdrop-filter: blur(8px);
            z-index: 200; display: flex; align-items: center;
            justify-content: center; padding: 16px;
            opacity: 0; visibility: hidden; transition: all .25s;
        }
        .modal-overlay.active { opacity: 1; visibility: visible; }
        .modal-card {
            background: var(--card); border: 1px solid var(--border2);
            border-radius: 2px; max-width: 480px; width: 100%;
            max-height: 85vh; overflow-y: auto;
            transform: scale(.94); transition: transform .25s;
        }
        .modal-overlay.active .modal-card { transform: scale(1); }
        .modal-header {
            padding: 18px 22px; border-bottom: 1px solid var(--border2);
            display: flex; align-items: center; justify-content: space-between;
            position: sticky; top: 0; background: var(--card); z-index: 5;
        }
        .modal-title {
            font-family: 'Syne', sans-serif; font-weight: 700;
            font-size: 1rem; color: var(--sand);
        }
        .modal-close {
            width: 30px; height: 30px; border-radius: 50%;
            background: rgba(var(--fg-rgb),.07); border: none;
            cursor: pointer; color: var(--sand);
            display: flex; align-items: center; justify-content: center;
            transition: background .2s;
        }
        .modal-close:hover { background: rgba(var(--fg-rgb),.14); }
        .modal-body { padding: 20px 22px; }
        .modal-action-btn {
            flex: 1; padding: 10px 14px; border-radius: 2px;
            font-size: .88rem; font-weight: 600; cursor: pointer;
            transition: all .2s; font-family: 'DM Sans', sans-serif;
            border: none;
        }
        .modal-action-btn.primary { background: var(--ember); color: var(--crust); }
        .modal-action-btn.primary:hover { background: var(--ember2); }
        .modal-action-btn.secondary { background: var(--card2); color: var(--muted); border: 1px solid var(--border2); }
        .modal-action-btn.secondary:hover { color: var(--sand); border-color: rgba(var(--ember-rgb),.3); }

        /* ─── TOAST ─── */
        .toast {
            position: fixed; top: 18px; right: 18px;
            background: var(--card); border: 1px solid var(--border2);
            border-radius: 2px; padding: 11px 18px;
            font-size: .85rem; font-weight: 600; color: var(--sand);
            z-index: 500; display: flex; align-items: center; gap: 8px;
            transform: translateX(120%); opacity: 0; transition: all .3s;
            max-width: 280px; box-shadow: 0 8px 24px rgba(0,0,0,.4);
        }
        .toast.show { transform: translateX(0); opacity: 1; }
        .toast.success { border-left: 3px solid var(--green); }
        .toast.error   { border-left: 3px solid var(--red); }
        .toast.info    { border-left: 3px solid var(--ember); }

        /* ─── BOTTOM NAV ─── */
        .mobile-bottom-nav {
            position: fixed; bottom: 0; left: 0; right: 0;
            background: var(--header-bg); backdrop-filter: blur(20px);
            border-top: 1px solid var(--border2);
            padding: 10px 0 max(env(safe-area-inset-bottom),12px);
            z-index: 50;
        }
        .bottom-nav-items {
            display: flex; justify-content: space-around; align-items: center;
        }
        .bottom-nav-item {
            display: flex; flex-direction: column; align-items: center;
            gap: 3px; color: rgba(var(--fg-rgb),.35); cursor: pointer;
            padding: 4px 12px; text-decoration: none; transition: color .2s;
        }
        .bottom-nav-item.active { color: var(--ember); }
        .bottom-nav-item span { font-size: 10px; font-weight: 600; }
        .bottom-post-btn {
            width: 48px; height: 48px; background: var(--ember);
            border-radius: 2px; display: flex; align-items: center;
            justify-content: center; box-shadow: 0 4px 16px rgba(var(--ember-rgb),.45);
        }

        /* ─── RESPONSIVE ─── */
        @media (max-width: 1023px) {
            .sidebar { display: none; }
            .content { padding-bottom: 80px; }
        }
        @media (min-width: 1024px) {
            .mobile-topbar { display: none; }
            .mobile-bottom-nav { display: none; }
        }

        /* ─── ANIMATIONS ─── */
        @keyframes fadeUp {
            from { opacity: 0; transform: translateY(10px); }
            to { opacity: 1; transform: translateY(0); }
        }
        .notification-card { animation: fadeUp .3s ease both; }
