:root {
    --primary: #2b6cb0;
    --primary-dark: #1a4971;
    --bg: #f7f8fa;
    --card-bg: #ffffff;
    --border: #e2e8f0;
    --text: #1a202c;
    --muted: #718096;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
.container { max-width: 1100px; margin: 0 auto; padding: 2rem 1rem; }
.narrow { max-width: 480px; }

.navbar { display: flex; justify-content: space-between; align-items: center; background: var(--card-bg); padding: .8rem 1.5rem; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50; }
.navbar .brand { font-weight: 700; text-decoration: none; color: var(--primary-dark); font-size: 1.05rem; display: flex; align-items: center; gap: .4rem; white-space: nowrap; }
.nav-toggle { display: none; background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--text); }
.nav-links { display: flex; align-items: center; gap: .3rem; }
.nav-links a { padding: .5rem .7rem; border-radius: 8px; text-decoration: none; color: var(--text); font-size: .9rem; font-weight: 500; white-space: nowrap; }
.nav-links a:hover { background: #edf2f7; color: var(--primary); }
.nav-links a.active { background: #ebf4ff; color: var(--primary-dark); font-weight: 700; }
.btn-nav-primary { background: var(--primary); color: #fff !important; }
.btn-nav-primary:hover { background: var(--primary-dark) !important; color: #fff !important; }

.nav-dropdown { position: relative; }
.nav-dropdown-btn { background: none; border: none; padding: .5rem .7rem; border-radius: 8px; font-size: .9rem; font-weight: 500; color: var(--text); cursor: pointer; white-space: nowrap; }
.nav-dropdown-btn:hover { background: #edf2f7; }
.nav-dropdown-menu { display: none; position: absolute; right: 0; top: calc(100% + .4rem); background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.1); min-width: 200px; padding: .4rem; z-index: 60; }
.nav-dropdown-menu.open { display: block; }
.nav-dropdown-menu a { display: block; padding: .55rem .7rem; border-radius: 6px; text-decoration: none; color: var(--text); font-size: .88rem; }
.nav-dropdown-menu a:hover { background: #f7fafc; }
.nav-dropdown-menu a.active { font-weight: 700; color: var(--primary); }
.nav-dropdown-menu hr { border: none; border-top: 1px solid var(--border); margin: .4rem 0; }
.notif-badge { background: #e53e3e; color: #fff; font-size: .65rem; font-weight: 700; border-radius: 999px; padding: .05rem .4rem; vertical-align: top; margin-left: -.3rem; }
.notif-menu { min-width: 280px; max-width: 340px; max-height: 380px; overflow-y: auto; }
.notif-item { display: block; padding: .6rem .7rem; border-radius: 6px; text-decoration: none; color: var(--text); font-size: .85rem; border-bottom: 1px solid var(--border); white-space: normal; }
.notif-item:last-child { border-bottom: none; }
.notif-item.unread { background: #ebf8ff; font-weight: 600; }

@media (max-width: 720px) {
    .nav-toggle { display: block; }
    .nav-links { display: none; position: absolute; top: 100%; left: 0; right: 0; background: #fff; flex-direction: column; align-items: stretch; border-bottom: 1px solid var(--border); padding: .5rem; gap: .2rem; box-shadow: 0 8px 16px rgba(0,0,0,.08); }
    .nav-links.open { display: flex; }
    .nav-links a { padding: .8rem .9rem; }
    .nav-dropdown { width: 100%; }
    .nav-dropdown-btn { width: 100%; text-align: left; padding: .8rem .9rem; }
    .nav-dropdown-menu { position: static; box-shadow: none; border: none; width: 100%; margin-top: .2rem; padding-left: .5rem; }
}
[data-theme="dark"] .navbar { background: var(--card-bg); }
@media (max-width: 720px) {
    [data-theme="dark"] .nav-links { background: #1e2530; }
}

h1 { margin-top: 0; }

.card-form { background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px; padding: 1.5rem; display: flex; flex-direction: column; gap: 1rem; max-width: 500px; position: relative; }
.card-form label { display: flex; flex-direction: column; gap: .3rem; font-size: .9rem; color: var(--muted); position: relative; }
.oauth-buttons { display: flex; flex-direction: column; gap: .6rem; max-width: 500px; margin-bottom: 1rem; }
.oauth-btn { text-align: center; text-decoration: none; display: flex; align-items: center; justify-content: center; gap: .6rem; }
.oauth-btn svg { flex-shrink: 0; }
.oauth-divider { display: flex; align-items: center; text-align: center; color: var(--muted); font-size: .8rem; max-width: 500px; margin: 0 0 1rem; }
.oauth-divider::before, .oauth-divider::after { content: ''; flex: 1; border-bottom: 1px solid var(--border); }
.oauth-divider span { padding: 0 .8rem; }
.bulk-review-card { max-width: 720px; margin-bottom: 1.2rem; }
.bulk-review-card label { font-size: .78rem; }
input, select, textarea { padding: .6rem; border: 1px solid var(--border); border-radius: 6px; font-size: 1rem; font-family: inherit; }
button { cursor: pointer; }
button[type=submit], .btn-primary { background: var(--primary); color: #fff; border: none; padding: .7rem 1.2rem; border-radius: 6px; font-size: 1rem; text-decoration: none; display: inline-block; }
button[type=submit]:hover, .btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: #edf2f7; color: var(--text); border: none; padding: .7rem 1.2rem; border-radius: 6px; }

.alert-error { background: #fed7d7; color: #822727; padding: .8rem; border-radius: 6px; }
.checkbox-label { flex-direction: row !important; align-items: center; gap: .5rem !important; font-size: .9rem; color: var(--text) !important; }
.checkbox-label input { width: auto; }
.autofill-box { background: #ebf8ff; border: 1px solid #bee3f8; border-radius: 10px; padding: 1rem; margin-bottom: 1.2rem; max-width: 500px; }
.autofill-box label { display: flex; flex-direction: column; gap: .3rem; font-size: .85rem; color: var(--muted); margin-bottom: .6rem; }
.condition-checkboxes { display: flex; flex-wrap: wrap; gap: .3rem 1rem; margin-top: -.5rem; }
.condition-checkboxes .checkbox-label { margin-bottom: 0; }

.theme-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: -.5rem; }
.theme-chip { background: #edf2f7; border-radius: 999px; padding: .3rem .5rem .3rem .8rem; font-size: .82rem; display: inline-flex; align-items: center; gap: .4rem; }
.theme-chip button { background: none; border: none; cursor: pointer; font-size: 1rem; line-height: 1; color: var(--muted); padding: 0 .2rem; }
.theme-chip button:hover { color: #c53030; }

.duplicate-warning { background: #fffbea; border: 1px solid #f6e05e; border-radius: 10px; padding: 1rem; margin-bottom: 1.2rem; max-width: 560px; }
.duplicate-warning h3 { margin-top: 0; font-size: 1rem; }
.duplicate-gallery { display: flex; gap: .8rem; flex-wrap: wrap; padding-top: .3rem; }
.duplicate-gallery-item { position: relative; display: block; width: 110px; height: 110px; border-radius: 10px; overflow: hidden; background: #fff; border: 2px solid transparent; flex-shrink: 0; }
.duplicate-gallery-item img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.duplicate-gallery-item.new-image { border-color: var(--primary); }
.duplicate-gallery-label { position: absolute; bottom: 0; left: 0; right: 0; background: var(--primary); color: #fff; font-size: .65rem; font-weight: 700; text-align: center; padding: .15rem 0; }

.suggestions { position: absolute; top: 100%; left: 0; right: 0; background: #fff; border: 1px solid var(--border); border-radius: 6px; max-height: 220px; overflow-y: auto; z-index: 10; }
.suggestion-item { padding: .5rem .7rem; cursor: pointer; }
.suggestion-item:hover { background: #ebf4ff; }
.suggestion-create { color: var(--primary); font-weight: 600; }

.stamp-table { width: 100%; border-collapse: collapse; background: var(--card-bg); border-radius: 10px; overflow: hidden; margin-top: 1rem; }
.stamp-table th, .stamp-table td { text-align: left; padding: .7rem; border-bottom: 1px solid var(--border); }
.country-edit-row td { animation: collapse-down .18s ease-out; }
.country-edit-collapse { padding: 1rem 1.2rem; border-left: 3px solid var(--primary); }
@keyframes collapse-down { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 4px; }

.share-toggle { background: var(--card-bg); padding: 1rem; border-radius: 8px; border: 1px solid var(--border); margin-bottom: 1rem; }

.filters { display: flex; gap: 1rem; margin-bottom: 1.5rem; }

.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
.feed-list { display: flex; flex-direction: column; gap: .8rem; margin-top: 1.2rem; }
.feed-item { display: flex; gap: 1rem; align-items: center; padding: .8rem; border: 1px solid var(--border); border-radius: 10px; background: var(--card-bg); text-decoration: none; color: inherit; }
.feed-item-thumb { width: 64px; max-width: 64px; height: 64px; flex-shrink: 0; border-radius: 8px; overflow: hidden; background: #edf2f7; display: flex; align-items: center; justify-content: center; font-size: 1.6rem; }
.feed-item-thumb img { width: 64px; height: 64px; max-width: 64px; object-fit: cover; display: block; }
.feed-item-body { min-width: 0; }
.feed-item-body p { margin: 0; }
.gallery-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.gallery-card img { width: 100%; height: 140px; object-fit: contain; background: #edf2f7; }
.no-image { width: 100%; height: 140px; display: flex; align-items: center; justify-content: center; font-size: 2.5rem; background: #edf2f7; }
.gallery-info { padding: .7rem; }
.muted { color: var(--muted); font-size: .85rem; }

.ticket { background: var(--card-bg); border: 1px solid var(--border); border-radius: 8px; padding: 1rem; margin-bottom: 1rem; }
.status { font-size: .75rem; padding: .2rem .5rem; border-radius: 4px; margin-left: .5rem; }
.status-ouvert { background: #fefcbf; }
.status-en_cours { background: #bee3f8; }
.status-ferme { background: #c6f6d5; }
.msg-admin { background: #ebf8ff; padding: .5rem; border-radius: 6px; }
.msg-user { background: #f7fafc; padding: .5rem; border-radius: 6px; }

.admin-cards { display: flex; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.admin-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px; padding: 1.2rem; min-width: 140px; text-align: center; }
.admin-card strong { font-size: 1.8rem; color: var(--primary); display: block; }

.admin-section-title { font-size: 1rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 2rem 0 .8rem; }
.admin-section-title:first-of-type { margin-top: .5rem; }

/* ---- Tuiles carrées admin ---- */
.admin-tile-grid { display: grid; grid-template-columns: repeat(auto-fill, 130px); gap: 1rem; margin-top: .8rem; margin-bottom: .5rem; }
.admin-tile {
    position: relative; aspect-ratio: 1 / 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: .6rem; text-decoration: none; color: var(--text); border-radius: 18px; border: 1px solid var(--border);
    background: var(--card-bg); transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.admin-tile:hover { transform: translateY(-4px); box-shadow: 0 12px 26px rgba(0,0,0,.09); }
.admin-tile-icon { font-size: 2.3rem; width: 56px; height: 56px; display: flex; align-items: center; justify-content: center; border-radius: 14px; }
.admin-tile-title { font-size: .88rem; font-weight: 700; text-align: center; }
.admin-tile-badge { position: absolute; top: .6rem; right: .6rem; background: #e53e3e; color: #fff; font-size: .72rem; font-weight: 700; min-width: 20px; height: 20px; border-radius: 999px; display: flex; align-items: center; justify-content: center; padding: 0 .3rem; }

.admin-tile-blue .admin-tile-icon { background: #ebf4ff; }
.admin-tile-blue:hover { border-color: #2b6cb0; }
.admin-tile-green .admin-tile-icon { background: #e6fffa; }
.admin-tile-green:hover { border-color: #38a169; }
.admin-tile-purple .admin-tile-icon { background: #f3e8ff; }
.admin-tile-purple:hover { border-color: #805ad5; }
.admin-tile-orange .admin-tile-icon { background: #fffaf0; }
.admin-tile-orange:hover { border-color: #dd6b20; }

[data-theme="dark"] .admin-tile-blue .admin-tile-icon { background: rgba(66,153,225,.15); }
[data-theme="dark"] .admin-tile-green .admin-tile-icon { background: rgba(56,161,105,.15); }
[data-theme="dark"] .admin-tile-purple .admin-tile-icon { background: rgba(128,90,213,.18); }
[data-theme="dark"] .admin-tile-orange .admin-tile-icon { background: rgba(221,107,32,.18); }

@media (max-width: 780px) {
    .admin-tile-grid { grid-template-columns: repeat(auto-fill, 100px); gap: .7rem; }
    .admin-tile-icon { font-size: 1.8rem; width: 44px; height: 44px; }
    .admin-tile-title { font-size: .78rem; }
}

.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1.2rem; margin-top: 1.5rem; }
.chart-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; padding: 1.2rem; }
.chart-card h3 { margin: 0 0 1rem; font-size: .95rem; color: var(--muted); }
.chart-card canvas { max-height: 260px; }

/* ---- Drapeaux (image prioritaire, sinon emoji) ---- */
.flag-img { height: 1.2em; vertical-align: -0.15em; border-radius: 2px; }
.flag-emoji { font-size: 1.2em; }
.flag-generic { opacity: .6; }

/* ---- Ma collection : stats mini ---- */
.mini-stats { display: flex; gap: .8rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.mini-stat { background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; padding: .9rem 1.2rem; text-align: center; min-width: 110px; }
.mini-stat strong { display: block; font-size: 1.5rem; color: var(--primary); }
.mini-stat span { font-size: .78rem; color: var(--muted); }

/* ---- Onglets ---- */
.tabs { display: flex; gap: .3rem; margin-bottom: 1.3rem; border-bottom: 1px solid var(--border); }
.tab-btn { background: none; border: none; padding: .7rem 1.1rem; font-size: .95rem; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; font-weight: 600; }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.subtab-btn { background: none; border: none; padding: .7rem 1.1rem; font-size: .95rem; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; font-weight: 600; }
.subtab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---- Recherche live ---- */
.search-bar { position: relative; margin-bottom: 1.3rem; }
.search-bar input { width: 100%; padding: .85rem 1rem .85rem 2.6rem; border: 1px solid var(--border); border-radius: 10px; font-size: 1rem; background: #fff url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" fill="none" stroke="%23718096" stroke-width="2" viewBox="0 0 24 24"><circle cx="11" cy="11" r="7"/><line x1="21" y1="21" x2="16.65" y2="16.65"/></svg>') no-repeat 0.85rem center; background-size: 18px; }
.search-results { margin-top: .8rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .8rem; }

/* ---- Grille des pays ---- */
.country-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1rem; }
.country-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 14px; padding: 1.1rem .8rem; text-align: center; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease; position: relative; }
.country-card:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(43,108,176,.15); border-color: var(--primary); }
.country-card .flag { font-size: 2.4rem; display: block; margin-bottom: .4rem; }
.country-card .cname { font-weight: 600; font-size: .9rem; display: block; }
.country-card .ccount { font-size: .78rem; color: var(--muted); margin-top: .15rem; display: block; }
.country-card.former { border-style: dashed; }
.country-card.former .cname::after { content: " (ancien)"; font-weight: 400; color: #dd6b20; font-size: .72rem; }
.badge-count { position: absolute; top: -8px; right: -8px; background: var(--primary); color: #fff; font-size: .72rem; padding: .15rem .5rem; border-radius: 999px; font-weight: 700; }

/* ---- Grille de timbres dans un pays ---- */
.back-link { display: inline-flex; align-items: center; gap: .3rem; color: var(--primary); text-decoration: none; font-weight: 600; margin-bottom: 1rem; cursor: pointer; }
.stamp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem; }
.stamp-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; cursor: pointer; transition: box-shadow .15s ease; }
.stamp-card:hover { box-shadow: 0 8px 20px rgba(0,0,0,.08); }
.stamp-visual { height: 110px; display: flex; align-items: center; justify-content: center; font-size: 2rem; background: linear-gradient(135deg,#ebf4ff,#e2e8f0); }
.stamp-card .stamp-thumb { width: 100%; height: 110px; object-fit: contain; background: #edf2f7; display: block; }
.stamp-card .si { padding: .6rem .7rem; }
.stamp-card .si strong { display: block; font-size: .88rem; }
.stamp-card .si span { font-size: .76rem; color: var(--muted); }
.qty-pill { display: inline-block; background: #edf2f7; border-radius: 999px; padding: .05rem .5rem; font-size: .72rem; margin-top: .3rem; }

/* ---- Modale fiche timbre ---- */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(26,32,44,.55); z-index: 100; align-items: center; justify-content: center; padding: 1rem; }
.modal-overlay.open { display: flex; }
.modal-card { background: #fff; border-radius: 16px; max-width: 520px; width: 100%; max-height: 90vh; overflow-y: auto; position: relative; }
.modal-close { position: absolute; top: .8rem; right: .9rem; background: #edf2f7; border: none; border-radius: 50%; width: 32px; height: 32px; font-size: 1rem; cursor: pointer; }
.modal-visual { height: 220px; background: linear-gradient(135deg,#ebf4ff,#e2e8f0); display: flex; align-items: center; justify-content: center; font-size: 4rem; border-radius: 16px 16px 0 0; overflow: hidden; }
.modal-visual img { width: 100%; height: 100%; object-fit: contain; background: #edf2f7; }
.modal-body { padding: 1.4rem; }
.modal-body h2 { margin: 0 0 .2rem; font-size: 1.3rem; }
.modal-body .subtitle { color: var(--muted); margin: 0 0 1rem; }
.crop-area { max-height: 60vh; overflow: hidden; background: #1a202c; border-radius: 8px; }
.crop-area img { display: block; max-width: 100%; }
.fiche-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem 1.2rem; font-size: .9rem; margin: 0; }
.fiche-grid dt { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .03em; margin-bottom: .1rem; }
.fiche-grid dd { margin: 0; font-weight: 600; }
.fiche-desc { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); font-size: .92rem; color: #2d3748; }

/* ---- Statistiques personnelles ---- */
#personal-map, #personal-map-old { height: 380px; border-radius: 12px; margin-bottom: 1.5rem; }

/* ---- Page d'accueil ---- */
.hero { background: linear-gradient(135deg, #ebf4ff 0%, #f7f8fa 65%); border-bottom: 1px solid var(--border); padding: clamp(2.5rem, 6vw, 4.5rem) 0; overflow: hidden; }
.hero-inner { display: grid; grid-template-columns: 1.15fr 1fr; gap: clamp(1.5rem, 4vw, 3rem); align-items: center; }
.hero-badge { display: inline-block; background: #fff; border: 1px solid var(--border); border-radius: 999px; padding: .35rem .9rem; font-size: .8rem; color: var(--primary-dark); font-weight: 600; margin-bottom: 1.1rem; }
.hero-text h1 { font-size: clamp(1.6rem, 3.4vw, 2.3rem); line-height: 1.22; margin: 0 0 1rem; letter-spacing: -.01em; }
.hero-text p { color: var(--muted); font-size: clamp(.95rem, 1.4vw, 1.08rem); line-height: 1.6; margin-bottom: 1.6rem; max-width: 46ch; }
.hero-cta { display: flex; gap: .8rem; flex-wrap: wrap; }

.hero-visual { display: flex; align-items: center; justify-content: center; min-height: 220px; }

.hero-preview { display: grid; grid-template-columns: repeat(3, 1fr); gap: .7rem; width: 100%; }
.hero-thumb { background: #fff; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; box-shadow: 0 6px 16px rgba(0,0,0,.06); }
.hero-thumb img { width: 100%; height: 72px; object-fit: contain; background: #edf2f7; display: block; }
.hero-thumb span { display: block; font-size: .68rem; padding: .35rem .4rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.hero-illustration { position: relative; width: 100%; height: 240px; display: flex; align-items: center; justify-content: center; }
.hero-illustration-globe { font-size: 7rem; opacity: .9; filter: drop-shadow(0 12px 24px rgba(43,108,176,.25)); animation: float 5s ease-in-out infinite; }
.hero-illustration-stamp { position: absolute; font-size: 2.6rem; background: #fff; border-radius: 14px; padding: .6rem; box-shadow: 0 10px 24px rgba(0,0,0,.1); border: 1px solid var(--border); }
.hero-stamp-1 { top: 4%; right: 8%; animation: float 4s ease-in-out infinite; }
.hero-stamp-2 { bottom: 10%; left: 2%; animation: float 4.5s ease-in-out infinite .3s; }
.hero-stamp-3 { bottom: 2%; right: 22%; font-size: 1.8rem; animation: float 3.8s ease-in-out infinite .6s; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

.stats-centered { justify-content: center; margin: clamp(2rem, 5vw, 3rem) auto; max-width: 700px; }

.section-title { text-align: center; font-size: clamp(1.25rem, 2.4vw, 1.6rem); margin: clamp(2.5rem, 5vw, 3.5rem) 0 clamp(1.5rem, 3vw, 2.2rem); }

.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.2rem; margin-bottom: clamp(2.5rem, 5vw, 3.5rem); }
.feature-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 14px; padding: 1.6rem 1.5rem; transition: transform .15s ease, box-shadow .15s ease; }
.feature-card:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(0,0,0,.06); }
.feature-icon { font-size: 1.7rem; margin-bottom: .8rem; width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; background: #ebf4ff; border-radius: 12px; }
.feature-card h3 { margin: 0 0 .5rem; font-size: 1.05rem; }
.feature-card p { margin: 0; font-size: .88rem; color: var(--muted); line-height: 1.55; }

.cta-band { background: var(--primary-dark); color: #fff; padding: clamp(2.2rem, 5vw, 3.2rem) 0; margin-top: 1rem; }
.cta-band-inner { text-align: center; }
.cta-band h2 { margin: 0 0 .5rem; font-size: clamp(1.3rem, 2.6vw, 1.7rem); }
.cta-band p { color: #cbd9ea; margin-bottom: 1.5rem; }
.cta-band .btn-primary { background: #fff; color: var(--primary-dark); font-weight: 700; }
.cta-band .btn-primary:hover { background: #edf2f7; }

@media (max-width: 780px) {
    .hero-inner { grid-template-columns: 1fr; }
    .hero-visual { order: -1; min-height: 160px; }
    .hero-illustration { height: 160px; }
    .hero-illustration-globe { font-size: 4.5rem; }
    .hero-illustration-stamp { font-size: 1.8rem; padding: .45rem; }
    .hero-preview { grid-template-columns: repeat(3, 1fr); }
}
[data-theme="dark"] .feature-icon,
[data-theme="dark"] .hero-illustration-stamp { background: #2d3748; }

/* ---- Profil ---- */
.profile-header { display: flex; align-items: center; gap: 1.2rem; margin-bottom: 1rem; }
.profile-avatar { width: 64px; height: 64px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 1.6rem; font-weight: 700; flex-shrink: 0; }
.profile-header h1 { margin: 0; font-size: 1.4rem; }
.profile-bio { background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px; padding: 1rem; font-size: .92rem; line-height: 1.6; }

/* ---- Filtres avancés ---- */
.search-bar { display: flex; gap: .6rem; align-items: stretch; }
.search-bar input { flex: 1; }
.filter-toggle { background: #edf2f7; border: 1px solid var(--border); border-radius: 10px; padding: 0 1rem; font-size: .85rem; white-space: nowrap; cursor: pointer; }
.filters-panel { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .8rem; background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px; padding: 1rem; margin-top: .8rem; align-items: end; }
.filters-panel label { display: flex; flex-direction: column; gap: .25rem; font-size: .78rem; color: var(--muted); }

/* ---- Curseur de plage d'années ---- */
.year-slider-label { grid-column: span 2; min-width: 220px; }
.year-slider-values { font-weight: 600; color: var(--text); font-size: .85rem; }
.year-slider { margin: .6rem .3rem .3rem; }
.year-slider .noUi-connect { background: var(--primary); }
.year-slider .noUi-handle { border-radius: 50%; width: 18px; height: 18px; right: -9px; top: -6px; box-shadow: none; border-color: var(--primary); }
.year-slider .noUi-handle::before, .year-slider .noUi-handle::after { display: none; }
[data-theme="dark"] .year-slider.noUi-target { background: #2d3748; border-color: var(--border); box-shadow: none; }

/* ---- Pagination ---- */
.pagination { display: flex; gap: .3rem; justify-content: center; margin: 1.2rem 0; flex-wrap: wrap; }
.page-btn { background: var(--card-bg); border: 1px solid var(--border); border-radius: 6px; padding: .4rem .7rem; cursor: pointer; font-size: .85rem; text-decoration: none; color: var(--text); display: inline-block; }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ---- Badge échange ---- */
.exchange-badge { display: inline-block; background: #fefcbf; color: #744210; font-size: .68rem; font-weight: 700; padding: .15rem .5rem; border-radius: 999px; position: absolute; margin: .4rem; z-index: 2; }
.stamp-card { position: relative; }

/* ============================================================
   MODE SOMBRE
   ============================================================ */
[data-theme="dark"] {
    --primary: #4299e1;
    --primary-dark: #63b3ed;
    --bg: #14181f;
    --card-bg: #1e2530;
    --border: #2d3748;
    --text: #e2e8f0;
    --muted: #a0aec0;
}

[data-theme="dark"] body { background: var(--bg); }

/* Surfaces "douces" (gris clair / bleu clair en mode jour) */
[data-theme="dark"] .nav-links a:hover,
[data-theme="dark"] .nav-dropdown-btn:hover,
[data-theme="dark"] .btn-secondary,
[data-theme="dark"] .theme-chip,
[data-theme="dark"] .qty-pill,
[data-theme="dark"] .modal-close,
[data-theme="dark"] .filter-toggle,
[data-theme="dark"] .gallery-card img,
[data-theme="dark"] .no-image,
[data-theme="dark"] .feed-item-thumb,
[data-theme="dark"] .stamp-card .stamp-thumb,
[data-theme="dark"] .modal-visual img,
[data-theme="dark"] .cta-band .btn-primary:hover {
    background: #2d3748;
}
[data-theme="dark"] .nav-links a.active,
[data-theme="dark"] .suggestion-item:hover {
    background: rgba(66,153,225,.18);
}
[data-theme="dark"] .nav-dropdown-menu,
[data-theme="dark"] .suggestions,
[data-theme="dark"] .modal-card {
    background: #1e2530;
    border-color: var(--border);
}
[data-theme="dark"] .nav-dropdown-menu a:hover { background: #2d3748; }
[data-theme="dark"] .notif-item.unread { background: #1a2f42; }
[data-theme="dark"] .hero-thumb,
[data-theme="dark"] .duplicate-gallery-item img,
[data-theme="dark"] .hero-badge {
    background: #1e2530;
}
[data-theme="dark"] .cta-band .btn-primary { background: #fff; color: #14181f; }

/* Dégradés des vignettes de timbre */
[data-theme="dark"] .stamp-visual,
[data-theme="dark"] .modal-visual {
    background: linear-gradient(135deg, #1e2530, #2d3748);
}
[data-theme="dark"] .hero {
    background: linear-gradient(135deg, #1a2942 0%, #14181f 60%);
}

/* Bandeaux colorés (succès/erreur/info) — teintes assombries, texte éclairci */
[data-theme="dark"] .alert-error { background: #4a1f1f; color: #feb2b2; }
[data-theme="dark"] .admin-link-badge { background: #4a1f1f; color: #feb2b2; }
[data-theme="dark"] .status-ferme { background: #1f4a33; color: #9ae6b4; }
[data-theme="dark"] .status-ouvert,
[data-theme="dark"] .exchange-badge { background: #4a4020; color: #f6e05e; }
[data-theme="dark"] .status-en_cours { background: #234158; color: #90cdf4; }
[data-theme="dark"] .msg-admin,
[data-theme="dark"] .autofill-box { background: #1a2f42; border-color: #2c5282; }
[data-theme="dark"] .msg-user { background: #2d3748; }
[data-theme="dark"] .duplicate-warning { background: #3d3418; border-color: #6b5a1f; }
[data-theme="dark"] .duplicate-gallery-item { background: #1e2530; }
[data-theme="dark"] .fiche-desc { color: var(--text); }

/* Boutons de bascule thème */
.theme-toggle { background: none; border: 1px solid var(--border); border-radius: 8px; padding: .4rem .6rem; cursor: pointer; font-size: .95rem; line-height: 1; color: var(--text); }
.theme-toggle:hover { background: #edf2f7; }
[data-theme="dark"] .theme-toggle:hover { background: #2d3748; }
[data-theme="dark"] #map,
[data-theme="dark"] #map-old,
[data-theme="dark"] #personal-map,
[data-theme="dark"] #personal-map-old {
    filter: brightness(.82) contrast(1.05) saturate(.9);
}

/* ---- Bandeau d'installation iOS ---- */
.ios-install-banner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; background: #1a4971; color: #fff; padding: .6rem 1rem; font-size: .85rem; }
.ios-install-banner button { background: none; border: none; color: #fff; font-size: 1rem; cursor: pointer; flex-shrink: 0; opacity: .8; }
.ios-install-banner button:hover { opacity: 1; }

/* ---- Cartes d'abonnement ---- */
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.2rem; margin-top: 1.2rem; }
.plan-card { position: relative; background: var(--card-bg); border: 1px solid var(--border); border-radius: 14px; padding: 1.5rem; text-align: center; }
.plan-card-highlight { border-color: var(--primary); border-width: 2px; }
.plan-badge { position: absolute; top: -.7rem; left: 50%; transform: translateX(-50%); background: var(--primary); color: #fff; font-size: .7rem; font-weight: 700; padding: .25rem .8rem; border-radius: 999px; white-space: nowrap; }
.plan-card h3 { margin: .3rem 0 .5rem; font-size: 1.1rem; }
.plan-price { font-size: 1.8rem; font-weight: 800; color: var(--primary); margin: 0 0 1rem; }
.plan-price span { font-size: .9rem; font-weight: 400; color: var(--muted); }
.plan-features { list-style: none; padding: 0; margin: 0 0 1.3rem; text-align: left; font-size: .85rem; color: var(--muted); display: flex; flex-direction: column; gap: .4rem; }

/* ---- Barre de progression d'upload ---- */
#upload-progress-wrap { margin-top: -.5rem; display: flex; flex-direction: column; gap: .3rem; }
#upload-progress-track { background: #edf2f7; border-radius: 999px; height: 8px; overflow: hidden; }
#upload-progress-bar { background: var(--primary); height: 100%; width: 0%; transition: width .15s ease; }
[data-theme="dark"] #upload-progress-track { background: #2d3748; }
