/* Reset */
*, *::before, *::after { box-sizing: border-box; }
input, textarea, select, button { font-family: inherit; }
.hidden { display: none !important; }
.js-hidden { display: none; }

/* Base */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background: #f5f5f5;
    color: #333;
}

.container { padding: 20px 40px; }

h1, h2, h3 { color: #2c3e50; margin-top: 0; }

/* Layout */
.layout {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    min-width: 0;
    min-height: 0;
}

/* Sidebar */
.sidebar {
    width: 220px;
    min-width: 220px;
    background: #2c3e50;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: sticky;
    top: 0;
    height: 100vh;
}
.sidebar a { color: #ecf0f1; text-decoration: none; }
.sidebar a:hover { color: #fff; background: #ffffff1a; }

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #ffffff1a;
}
.nav-brand { font-weight: bold; font-size: 1.3em; }
.nav-brand img { width: 90%; display: block; }

.sidebar-links {
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #ffffff22 transparent;
}
.sidebar-links::-webkit-scrollbar { width: 4px; }
.sidebar-links::-webkit-scrollbar-track { background: transparent; }
.sidebar-links::-webkit-scrollbar-thumb { background: #ffffff33; border-radius: 4px; }
.sidebar-links::-webkit-scrollbar-thumb:hover { background: #ffffff55; }
.sidebar-links a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    font-size: 14px;
    transition: background 0.2s;
}
.sidebar-links a i {
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-footer-top {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    margin-bottom: 8px;
}
.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid #ffffff1a;
    font-size: 13px;
    color: #bdc3c7;
}
.sidebar-footer a {
    display: block;
    padding: 6px 0;
    font-size: 13px;
}
.sidebar-footer a i {
    width: 20px;
    text-align: center;
    margin-right: 8px;
}
.sidebar-legal-links {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #ffffff1a;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.sidebar-legal-links a {
    display: inline;
    padding: 0;
    font-size: 11px;
    color: #7f8c8d;
    opacity: 0.8;
}
.sidebar-legal-links a:hover { opacity: 1; }
.sidebar-user {
    padding: 6px 0;
    font-weight: 500;
    color: #ecf0f1;
    text-decoration: none;
    display: block;
}
.sidebar-user:hover { text-decoration: underline; }

.locale-switcher {
    margin-bottom: 8px;
}
.locale-switcher a {
    display: inline-block;
    padding: 3px 8px;
    border: 1px solid #ffffff4c;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
}
.locale-switcher a:hover {
    background: #ffffff1a;
}

/* Sidebar nav submenu */
.nav-submenu-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 20px;
    font-size: 14px;
    background: none;
    border: none;
    color: #ecf0f1;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s;
}
.nav-submenu-toggle:hover { color: #fff; background: #ffffff1a; }
.nav-submenu-toggle i:first-child { width: 20px; text-align: center; flex-shrink: 0; }
.nav-submenu-chevron { margin-left: auto; font-size: 11px; transition: transform 0.2s; }
.nav-submenu.open .nav-submenu-chevron { transform: rotate(180deg); }
.nav-submenu-items { display: none; }
.nav-submenu.open .nav-submenu-items { display: block; }
.nav-submenu-items a { padding-left: 46px; }

/* Sidebar overlay (mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: #00000080;
    z-index: 999;
}
.sidebar-overlay.active { display: block; }

/* Sidebar toggle (mobile) */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 1001;
    flex-direction: column;
    cursor: pointer;
    padding: 8px;
    gap: 4px;
    background: #2c3e50;
    border-radius: 6px;
}
.sidebar-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: #ecf0f1;
    border-radius: 2px;
    transition: all 0.3s;
}
.sidebar-toggle.active span:nth-child(1) { transform: rotate(45deg) translate(4px, 4px); }
.sidebar-toggle.active span:nth-child(2) { opacity: 0; }
.sidebar-toggle.active span:nth-child(3) { transform: rotate(-45deg) translate(4px, -4px); }

/* Bouton replier sidebar — même style que theme-toggle-btn */
.sidebar-collapse-btn {
    display: none;
    align-items: center;
    background: none;
    border: 1px solid #ffffff4c;
    border-radius: 4px;
    color: #ecf0f1;
    cursor: pointer;
    padding: 3px 8px;
    font-size: 14px;
    line-height: 1.5;
    transition: background 0.2s;
}
.sidebar-collapse-btn:hover { background: #ffffff1a; }

/* Bouton repli sidebar visible sur tablette et grands iPad (pas sur mobile où la sidebar est déjà en overlay) */
@media (min-width: 769px) and (max-width: 1280px) {
    .sidebar-collapse-btn { display: flex; align-items: center; }
}

/* Onglet "rouvrir" — caché par défaut, visible dans la sidebar repliée */
.sidebar-reopen-tab {
    display: none;
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    background: #2c3e50;
    color: #ecf0f1;
    border: none;
    border-radius: 0 6px 6px 0;
    padding: 14px 8px;
    cursor: pointer;
    z-index: 999;
    font-size: 14px;
    transition: background 0.15s, padding-left 0.15s;
    box-shadow: 2px 0 8px #0000002e;
}
.sidebar-reopen-tab:hover { background: #34495e; padding-left: 12px; }

/* Sidebar repliée sur tablette et grands iPad — width:0 plutôt que position:fixed pour compatibilité Safari iOS */
@media (min-width: 769px) and (max-width: 1280px) {
    .sidebar {
        overflow: hidden;
        transition: width 0.25s ease, min-width 0.25s ease;
    }
    .layout.sidebar-tablet-collapsed .sidebar {
        width: 0;
        min-width: 0;
    }
    .layout.sidebar-tablet-collapsed .main-content .sidebar-reopen-tab { display: flex; }
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 8px 16px;
    background: #3498db;
    color: white;
    text-decoration: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.4;
    box-sizing: border-box;
    vertical-align: middle;
    -webkit-appearance: none;
    appearance: none;
}
.btn:hover { background: #2980b9; }
.btn-success { background: #27ae60; }
.btn-success:hover { background: #219a52; }
.btn-danger { background: #e74c3c; }
.btn-danger:hover { background: #c0392b; }
.btn-purple { background: #8e44ad; color: #fff; }
.btn-purple:hover { background: #7d3c98; color: #fff; }
.propose-copy-wrap { position: relative; display: inline-flex; }
.propose-copy-wrap--sent::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: -5px;
    right: -5px;
    width: 14px;
    height: 14px;
    background: #8e44ad;
    color: #fff;
    border-radius: 50%;
    font-size: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--card-bg, #fff);
}
.btn-sm { padding: 8px 10px; font-size: 12px; }

/* Icon-only actions */
.action-icon {
    color: #666;
    font-size: 16px;
    padding: 5px;
    cursor: pointer;
    background: none;
    border: none;
    transition: color 0.2s;
}
.action-icon:hover { color: #3498db; }
.action-icon-danger:hover,
.action-icon.action-icon-danger:hover { color: #e74c3c; }
.action-icon-filled-success,
.action-icon-filled-danger {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    align-self: center;
    color: white !important;
    transition: opacity 0.15s;
}
.action-icon-filled-success { background: #27ae60; }
.action-icon-filled-success:hover { background: #219a52; }
.action-icon-filled-danger { background: #e74c3c; }
.action-icon-filled-danger:hover { background: #c0392b; }
.action-icon.favorite-btn { color: #ccc; }
.action-icon.favorite-btn:hover { color: #f1c40f; }
.action-icon.favorite-btn.is-favorite { color: #f1c40f; }

/* Sort buttons */
.sort-btn {
    background: none;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    color: #666;
    font-size: 14px;
    transition: all 0.2s;
}
.sort-btn:hover { border-color: #3498db; color: #3498db; }
.sort-btn.active { background: #3498db; border-color: #3498db; color: white; }
.sort-btn.desc i { transform: scaleY(-1); }

/* Cards */
.card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px #0000001a;
}
.card-narrow { max-width: 500px; }
.card-wide   { max-width: 700px; }
.card-form  { max-width: none; }
.card-title  { flex: 1; min-width: 0; margin: 0; }
.card-danger { border-color: #e74c3c; }
.card-auth   { max-width: 400px; margin: 40px auto; }
.text-center { text-align: center; }
.form-actions-center { justify-content: center; }
.text-danger { color: #e74c3c; }
.img-preview { max-width: 200px; max-height: 150px; object-fit: cover; border-radius: 6px; margin-bottom: 0.5rem; display: block; }
.pro-photo-preview-row { display: flex; align-items: center; gap: 0.75rem; }
.pro-photo-preview-img { max-width: 160px; border-radius: 8px; }
.pro-icon-preview-default { background-color: #3498db; }
.icon-preview-row { display: flex; align-items: center; gap: 1rem; margin-bottom: 0.5rem; }
.icon-preview-circle { width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; color: #fff; }
.icon-preview-circle--default { background-color: #3498db; }
.form-body-grid { display: grid; grid-template-columns: 1fr; gap: 0; align-items: start; }

/* Forms */
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; font-weight: 500; }

/* Séparation visuelle des champs dans toutes les cards contenant un formulaire */
.card:has(form) .form-group,
.card-narrow .form-group,
.card-form .form-group {
    margin-bottom: 0;
    padding: 14px 0;
    border-bottom: 1px solid var(--border-color, #f0f0f0);
}
.card:has(form) .form-group:first-of-type,
.card-narrow .form-group:first-of-type,
.card-form .form-group:first-of-type { padding-top: 0; }
.card:has(form) .form-group:last-of-type,
.card-narrow .form-group:last-of-type,
.card-form .form-group:last-of-type { border-bottom: none; padding-bottom: 0; }
.card:has(form) .form-group label:not(.toggle-label):not(.checkbox-item label):not(.travel-tag-tile),
.card-narrow .form-group label:not(.toggle-label):not(.checkbox-item label):not(.travel-tag-tile),
.card-form .form-group label:not(.toggle-label):not(.checkbox-item label):not(.travel-tag-tile) {
    font-weight: 600;
    font-size: 13px;
    color: #555;
    margin-bottom: 8px;
}
.dark-mode .card:has(form) .form-group,
.dark-mode .card-narrow .form-group,
.dark-mode .card-form .form-group { border-bottom-color: #ffffff1a; }
.dark-mode .card:has(form) .form-group label:not(.toggle-label):not(.checkbox-item label):not(.travel-tag-tile),
.dark-mode .card-narrow .form-group label:not(.toggle-label):not(.checkbox-item label):not(.travel-tag-tile),
.dark-mode .card-form .form-group label:not(.toggle-label):not(.checkbox-item label):not(.travel-tag-tile) { color: #bdc3c7; }
.form-group label.required::after { content: ' *'; color: #e74c3c; }
.form-check { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.form-check input[type="checkbox"] { margin: 0; flex-shrink: 0; width: 16px; height: 16px; cursor: pointer; }
.form-check label { display: inline; margin-bottom: 0; font-weight: normal; cursor: pointer; }
.form-actions { display: flex; align-items: center; gap: 8px; margin-top: 20px; }
.form-inline { display: inline; }

/* Form sections */
.form-section { padding-top: 24px; margin-top: 24px; border-top: 1px solid var(--border-color, #e0e0e0); }
.form-section:first-of-type { padding-top: 0; margin-top: 0; border-top: none; }
.form-section-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; color: #999; margin: 0 0 20px; }

/* Séparation visuelle des champs dans une section structurée */
.form-section .form-group { margin-bottom: 0; padding: 16px 0; border-bottom: 1px solid var(--border-color, #f0f0f0); }
.form-section .form-group:first-of-type { padding-top: 0; }
.form-section .form-group:last-of-type { border-bottom: none; padding-bottom: 0; }
.form-section .form-group label { font-weight: 600; font-size: 13px; color: #555; margin-bottom: 8px; }
.dark-mode .form-section .form-group { border-bottom-color: #ffffff1a; }
.dark-mode .form-section .form-group label { color: #bdc3c7; }
.form-icon-muted { color: #aaa; width: 16px; flex-shrink: 0; }
.form-label-icon { display: flex; align-items: center; gap: 8px; font-weight: 500; margin-bottom: 6px; }
.form-row--hidden { display: none !important; }

/* Fictional profile sub-fields */
.fictional-options { display: flex; flex-direction: column; gap: 14px; }
.fictional-color-row { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.fictional-desc-row { display: flex; flex-direction: column; }
.fictional-desc-textarea { font-family: inherit; resize: vertical; }

/* Tag cards (profile-tag index) */
.tag-card { position: relative; }
.tag-card-actions { position: absolute; top: 10px; right: 10px; }
.tag-card-body { display: flex; align-items: flex-start; gap: 15px; }
.tag-card-body > .avatar { flex-shrink: 0; }
.tag-card-info { flex: 1; }
.tag-card-name { margin: 0 0 8px 0; font-size: 14px; }
.tag-card-meta { margin: 0 0 8px 0; }
.tag-card-date { color: #666; font-size: 14px; margin: 0; }
.tag-profiles-badge { cursor: pointer; border: none; font-family: inherit; }
.tag-profiles-badge:hover { opacity: 0.8; }

/* Tag chips + autocomplete (index modal + edit form) */
.tag-profiles-modal-inner { width: min(480px, 96vw); display: flex; flex-direction: column; }
.tag-modal-body { padding: 16px 20px; flex: 1; overflow-y: auto; display: flex; flex-direction: column; }
.tag-modal-footer { display: flex; gap: 8px; padding: 12px 20px 16px; border-top: 1px solid var(--border-color, #e0e0e0); }
.tag-chips-area { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 10px; max-height: 130px; overflow-y: auto; }
.tag-chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 6px 3px 4px; background: #3498db; color: #fff; border-radius: 20px; font-size: 12px; font-weight: 500; }
.tag-chip-avatar { width: 18px; height: 18px; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: #ffffff40; display: inline-flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 700; overflow: hidden; }
.tag-chip img { width: 100%; height: 100%; object-fit: cover; }
.tag-chip-remove { background: none; border: none; color: #fff; cursor: pointer; padding: 0 2px; font-size: 15px; line-height: 1; opacity: 0.75; }
.tag-chip-remove:hover { opacity: 1; }
.tag-modal-search { padding: 4px 0 0; position: relative; }
.tag-modal-search .search-wrapper { width: 100%; }
.tag-modal-search .search-input { width: 100%; }
.tag-search-results { display: flex; flex-direction: column; gap: 4px; padding-top: 8px; }
.tag-search-results:empty { padding-top: 0; }
.tag-search-result { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid #e0e0e0; border-radius: 8px; cursor: pointer; transition: border-color .15s, background .15s; }
.tag-search-result:hover { border-color: #3498db; background: #f0f7ff; }

/* Profile select cards (reused across group, tag, share pages) */
.profile-select-card { display: flex; align-items: center; gap: 10px; padding: 10px; border: 2px solid #e0e0e0; border-radius: 8px; cursor: pointer; transition: border-color 0.2s, background 0.2s; }
.profile-select-card:hover { border-color: #3498db; }
.profile-select-card.selected { border-color: #27ae60; background: #f0fff4; }
.profile-select-card .avatar { flex-shrink: 0; }
.profile-select-info { flex: 1; }
.profile-select-info h4 { margin: 0 0 4px 0; font-size: 14px; }
.profile-select-info p { margin: 0; }
.profile-select-check { width: 24px; height: 24px; border: 2px solid #ccc; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: white; flex-shrink: 0; }
.profile-select-card.selected .profile-select-check { background: #27ae60; border-color: #27ae60; }
.dark-mode .profile-select-card { border-color: #ffffff33; }
.dark-mode .profile-select-card.selected { background: #1b4332; }

/* Score icons (FA faces -2→+2) */
.score-icon[data-score="-2"] { color: #e74c3c; }
.score-icon[data-score="-1"] { color: #e67e22; }
.score-icon[data-score="0"]  { color: #95a5a6; }
.score-icon[data-score="1"]  { color: #2ecc71; }
.score-icon[data-score="2"]  { color: #27ae60; }

/* Travel score picker */
.travel-score-picker {
    display: flex;
    gap: 6px;
}
.score-pick {
    background: none;
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.6rem;
    padding: 4px 8px;
    opacity: 0.4;
    transition: opacity 0.15s, border-color 0.15s, transform 0.1s;
    line-height: 1;
}
.score-pick:hover { opacity: 0.8; transform: scale(1.15); }
.score-pick.active { opacity: 1; border-color: #3498db; transform: scale(1.1); }

/* Travel tag picker */
.travel-tag-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}
.travel-tag-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    border: 2px solid var(--border-color, #e0e0e0);
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.78rem;
    color: #555;
    background: var(--card-bg, #fff);
    transition: border-color 0.15s, background 0.15s, color 0.15s;
    min-width: 64px;
    text-align: center;
    user-select: none;
}
.travel-tag-tile i { font-size: 1.25rem; }
.travel-tag-tile:hover { border-color: #3498db; color: #3498db; }
.travel-tag-tile:has(input:checked) {
    border-color: #2980b9;
    background: #2980b9;
    color: #fff;
}
.dark-mode .travel-tag-tile { color: #bbb; }
.dark-mode .travel-tag-tile:has(input:checked) { background: #2980b9; border-color: #2980b9; color: #fff; }

/* Geocode autocomplete */
.geocode-wrapper { position: relative; }
.geocode-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--card-bg, #fff);
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
    z-index: 200;
    max-height: 260px;
    overflow-y: auto;
    box-shadow: 0 4px 12px #0000001a;
}
.geocode-item {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
    line-height: 1.4;
}
.geocode-item:last-child { border-bottom: none; }
.geocode-item:hover, .geocode-item.active { background: #f0f7ff; }
.geocode-item-main { font-weight: 500; }
.geocode-item-sub { color: #888; font-size: 12px; }
.dark-mode .geocode-dropdown { border-color: #ffffff26; background: #1e2736; }
.dark-mode .geocode-item { border-color: #ffffff0f; }
.dark-mode .geocode-item:hover, .dark-mode .geocode-item.active { background: #3498db26; }
.btn-secondary { background: #6c757d; }
.btn-secondary:hover { background: #5a6268; }
.pagination { display: flex; gap: 4px; align-items: center; justify-content: center; margin-top: 16px; }
.pagination-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    background: #eee;
    color: #333;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    box-sizing: border-box;
}
.pagination-btn:hover { background: #ddd; color: #111; }
.pagination-btn.active { background: #3498db; color: #fff; font-weight: 700; cursor: default; pointer-events: none; }
.pagination-sep { color: #aaa; padding: 0 2px; line-height: 34px; }
.dark-mode .pagination-btn { background: #2a3f55; color: #ccc; }
.dark-mode .pagination-btn:hover { background: #34516b; color: #fff; }
.dark-mode .pagination-btn.active { background: #3498db; color: #fff; }
.form-group label.toggle-label { display: inline-flex; margin-bottom: 0; }
.form-group input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not(.cpick-hex):not(.cpick-native):not(.search-input),
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}
.form-group input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not(.cpick-hex):not(.cpick-native):not(.search-input):focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3498db;
}

/* Color picker — cercle */
input[type="color"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 44px;
    height: 44px;
    border: 2px solid #ddd;
    border-radius: 50%;
    cursor: pointer;
    padding: 0;
    background: none;
    overflow: hidden;
    display: block;
    transition: border-color 0.2s;
}
input[type="color"]:hover { border-color: #3498db; }
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; border-radius: 50%; }
input[type="color"]::-webkit-color-swatch { border: none; border-radius: 50%; }
input[type="color"]::-moz-color-swatch { border: none; border-radius: 50%; width: 100%; height: 100%; }
.form-control { padding: 10px; border: 1px solid #ddd; border-radius: 4px; font-size: 14px; }
.sort-select { width: auto; display: inline-block; }

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 20px;
}
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px; text-align: left; border-bottom: 1px solid #ddd; }
th { background: #f8f9fa; font-weight: 600; }
tr:hover { background: #f8f9fa; }

/* Badges */
.badge {
    display: inline-block;
    padding: 3px 8px;
    background: #6c757d;
    color: white;
    border-radius: 12px;
    font-size: 12px;
}
.badge-primary { background: #3498db; }
.badge-success { background: #27ae60; }
.badge-warning { background: #e67e22; }
.badge-danger  { background: #e74c3c; }
.badge-info    { background: #2980b9; }
.badge-nav     { font-size: 11px; padding: 2px 6px; border-radius: 10px; }
.badge-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: #6c757d;
    color: white;
    border-radius: 12px;
    font-size: 11px;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.badge-tag i { font-size: 10px; }
.member-palsync { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 500; color: #2980b9; background: #e8f4fd; border-radius: 10px; padding: 2px 7px; text-decoration: none; }
.member-palsync:hover { background: #d0eaf9; color: #1a6a9a; }

/* Color dot */
.color-dot {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    vertical-align: middle;
    margin-right: 8px;
}
.color-dot-sm { width: 10px; height: 10px; }
.color-dot-md { width: 12px; height: 12px; }

/* Avatar */
.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #3498db;
    color: white;
    font-weight: 600;
    text-decoration: none;
    overflow: hidden;
    flex-shrink: 0;
}
.avatar-xs { width: 28px; height: 28px; font-size: 13px; }
.avatar-sm { width: 32px; height: 32px; font-size: 14px; }
.avatar-md { width: 48px; height: 48px; font-size: 20px; }
.avatar-lg { width: 80px; height: 80px; font-size: 32px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-self { background: #3498db; }
.avatar-friend { background: #9b59b6; }
.avatar-group { background: #27ae60; }

/* Lists */
.list-unstyled { list-style: none; padding: 0; margin: 0; }
.list-item-simple { padding: 8px 0; }
.list-item {
    display: flex;
    align-items: center;
    padding: 12px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    margin-bottom: 8px;
}
.list-item-content { flex: 1; }
.list-item-note { font-size: 12px; color: #666; margin-top: 4px; }

/* Drag and drop */
.sortable-ghost { opacity: 0.4; background: #e3f2fd; }
.sortable-drag { background: white; box-shadow: 0 4px 12px #00000026; }
.drag-handle { cursor: grab; padding: 0 10px; color: #aaa; }
.drag-handle:active { cursor: grabbing; }

/* Menu settings list */
.menu-item-row { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--border-color, #e0e0e0); user-select: none; }
.menu-item-row:last-child { border-bottom: none; }
.menu-item-row.dragging { opacity: 0.4; }
.menu-item-row.drag-target-above { border-top: 2px solid #3498db; }
.menu-item-icon { width: 20px; text-align: center; color: #666; flex-shrink: 0; font-size: 14px; }
.menu-item-label { flex: 1; font-size: 14px; font-weight: 500; }
.menu-sublist { margin: 4px 0 4px 24px; padding-left: 12px; border-left: 2px solid var(--border-color, #e0e0e0); }

/* Grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.grid-wide { grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); }
.friend-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 16px; }
.friend-card {
    position: relative;
    background: var(--card-bg, #fff);
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 12px;
    padding: 48px 12px 36px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
}
.friend-card-actions {
    position: absolute;
    top: 8px;
    left: 8px;
    right: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.friend-card-actions > div { position: relative; }
.friend-card-name {
    font-weight: 600;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
}
.friend-card-mood {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: #666;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.friend-card-bottom-left {
    position: absolute;
    bottom: 8px;
    left: 8px;
    display: flex;
    gap: 2px;
    align-items: center;
}
.action-icon-mood-off { color: #ccc; }
.action-icon-muted { color: #bbb; }
.mood-notify-toggle:not(.action-icon-mood-off) { color: #2c3e50; }
.friend-card-nickname {
    font-size: 12px;
    color: #888;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
    min-height: 16px;
}
.friend-nickname-btn {
    background: none;
    border: none;
    padding: 2px 4px;
    color: #bbb;
    cursor: pointer;
    font-size: 10px;
    line-height: 1;
    flex-shrink: 0;
}
.friend-nickname-btn:hover { color: #888; }
.friend-nickname-wrap { display: flex; align-items: center; gap: 2px; max-width: 100%; }
.friend-nickname-input {
    font-size: 12px;
    border: 1px solid var(--border-color, #ddd);
    border-radius: 4px;
    padding: 2px 6px;
    width: 100%;
    min-width: 0;
    text-align: center;
}
.friend-search-wrap { margin-bottom: 12px; }
.share-section-avatar--repertoire { background: #2c3e50; flex-shrink: 0; }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 40px;
    color: #6c757d;
}

.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; align-items: start; }
.friend-code-display { display: flex; align-items: center; gap: 10px; }
.friend-code-value { font-family: monospace; font-size: 18px; font-weight: 700; letter-spacing: 2px; color: var(--text-primary, #1a1a1a); background: var(--bg-secondary, #f0f4f8); padding: 8px 14px; border-radius: 8px; }

/* Settings dropdown */
.settings-btn { background: none; border: none; cursor: pointer; font-size: 18px; padding: 5px; }
.settings-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 2px 10px #0000001a;
    min-width: 200px;
    z-index: 100;
}
.settings-dropdown.active { display: block; }
.settings-dropdown form { margin: 0; }
.profile-card { position: relative; }
.profile-card-actions { position: absolute; top: 10px; right: 10px; display: flex; align-items: center; gap: 5px; }
.profile-card-gear { display: flex; align-items: center; }
.profile-card-body { display: flex; align-items: flex-start; gap: 15px; }
.profile-card-info { flex: 1; }
.profile-card-body h3 { margin: 0 0 8px; }
.profile-card-body p { margin: 0 0 8px; }
.copy-profile-dropdown { display: block; position: static; box-shadow: none; border-radius: 6px; max-height: 200px; overflow-y: auto; flex-basis: 100%; }
.copy-profile-dropdown .copy-profile-option { display: flex; align-items: center; gap: 10px; }
.dropdown-item { padding: 10px; }
.dropdown-item--separator { border-bottom: 1px solid var(--border-color, #e0e0e0); }
.dropdown-label { font-size: 12px; color: #666; display: block; margin-bottom: 5px; }
.dropdown-link {
    display: flex;
    align-items: flex-start;
    padding: 10px 15px;
    color: #333;
    text-decoration: none;
    font-size: 14px;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
}
.dropdown-link:hover { background: #f5f5f5; }
.dropdown-link i { flex-shrink: 0; width: 20px; margin-right: 8px; color: #666; }
.dropdown-link-danger:hover { background: #fee; color: #e74c3c; }
.dropdown-link-danger:hover i { color: #e74c3c; }

/* Utility classes - Flexbox */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }

/* Utility classes - Spacing */
.gap-sm { gap: 5px; }
.gap-md { gap: 10px; }
.gap-lg { gap: 15px; }
.gap-xl { gap: 20px; }
.mb-0 { margin-bottom: 0; }
.mb-sm { margin-bottom: 5px; }
.mb-md { margin-bottom: 10px; }
.mb-lg { margin-bottom: 15px; }
.mb-xl { margin-bottom: 20px; }
.mt-sm { margin-top: 5px; }
.mt-md { margin-top: 10px; }
.mt-lg { margin-top: 15px; }
.mt-xl { margin-top: 50px; }
.ml-sm { margin-left: 5px; }
.ml-md { margin-left: 10px; }
.ml-auto { margin-left: auto; }
.justify-center { justify-content: center; }

/* Utility classes - Text */
.text-muted { color: #666; }
.text-sm { font-size: 12px; }
.text-md { font-size: 14px; }
.link { color: #3498db; text-decoration: none; }
.link:hover { text-decoration: underline; }

/* Search and filters */
.search-filters {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}
.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}
.search-icon {
    position: absolute;
    left: 12px;
    color: #999;
    font-size: 14px;
    pointer-events: none;
}
.search-wrapper .search-input {
    padding-left: 38px;
}
.search-input {
    flex: 1;
    min-width: 200px;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}
.search-input:focus {
    outline: none;
    border-color: #3498db;
}
.search-input:focus + .search-icon,
.search-wrapper:focus-within .search-icon {
    color: #3498db;
}
.filter-group {
    display: flex;
    gap: 10px;
    align-items: center;
}
.filter-group label {
    font-size: 14px;
    color: #666;
}

/* Icons */
.icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    font-size: 14px;
}
.icon-global {
    color: #3498db;
    font-weight: bold;
}
.icon-personal {
    color: #95a5a6;
}

/* Actions */
.actions { display: flex; gap: 5px; }
.actions form { display: flex; }

/* Visited toggle overlay on card photo */
.visited-toggle-overlay {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 0.75rem;
    padding: 3px 8px;
    opacity: 0.85;
    z-index: 2;
}

/* Page header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}
.page-header-3col {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 20px;
}
.page-header-3col .search-wrapper {
    max-width: 300px;
    width: 100%;
    justify-self: center;
}
.page-header-3col .search-input {
    width: 100%;
}

/* Responsive table */
.table-details {
    display: none;
    padding: 10px 12px;
    background: #f8f9fa;
    font-size: 13px;
    color: #666;
}
.table-details.active { display: table-row; }
.table-details td { padding: 10px 12px; border-bottom: 1px solid #ddd; }
.table-details-content { display: flex; gap: 20px; flex-wrap: wrap; }
.table-details-item { display: flex; align-items: center; gap: 5px; }
.btn-details { display: none; }
.action-icon.btn-details { display: none; }

/* Profile share tabs */
.profile-search-container { position: relative; display: flex; }
.profile-search-container .form-control { min-width: 200px; }
.profile-search-container .other-profile-option { align-items: center; gap: 8px; }
.profile-tabs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}
.profile-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border: 2px solid var(--border-color, #e0e0e0);
    border-radius: 10px;
    background: var(--card-bg, #fff);
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    color: var(--text-color, #333);
    transition: border-color 0.15s, background 0.15s;
}
.profile-tab:hover { border-color: var(--primary, #3498db); }
.profile-tab.active {
    border-color: var(--primary, #3498db);
    background: color-mix(in srgb, var(--primary, #3498db) 10%, transparent);
}
.dark-mode .profile-tab { background: #1e2d3d; border-color: #ffffff1a; }
.dark-mode .profile-tab.active { border-color: var(--primary, #3498db); background: color-mix(in srgb, var(--primary, #3498db) 20%, #1e2d3d); }

/* Responsive */
@media (max-width: 768px) {
    .container { padding: 15px; }

    .page-header { flex-direction: column; align-items: stretch; }
    .page-header > div { display: flex; flex-wrap: wrap; gap: 5px; }
    .page-header-3col {
        grid-template-columns: 1fr;
        text-align: center;
    }
    .page-header-3col .search-wrapper {
        max-width: 100%;
        order: 2;
    }
    .page-header-3col h1 { order: 1; }
    .page-header-3col .btn { order: 3; justify-self: center; }

    .grid { grid-template-columns: 1fr; }

    /* Responsive table */
    .hide-mobile { display: none; }
    .btn-details, .action-icon.btn-details { display: inline-block; }
    .actions { flex-wrap: wrap; }

    /* Mobile sidebar */
    .sidebar-toggle { display: flex; }
    .sidebar {
        position: fixed;
        left: -220px;
        top: 0;
        z-index: 1000;
        transition: left 0.3s ease;
    }
    .sidebar.active { left: 0; }
    .main-content { padding-top: 50px; }
}

/* Cropper dialog */
.cropper-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000000e6;
    z-index: 1000;
    justify-content: center;
    align-items: center;
}
.cropper-overlay.active { display: flex; }
.cropper-dialog {
    background: white;
    padding: 20px;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
}
.cropper-dialog h3 { margin-top: 0; }
.cropper-container-wrapper {
    max-height: 400px;
    margin-bottom: 15px;
    background: #333;
    overflow: hidden;
}
.cropper-container-wrapper img { max-width: 100%; display: block; }
.cropper-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* Checkbox list */
.checkbox-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px;
}
.checkbox-list .checkbox-item,
label.checkbox-item {
    display: flex;
    align-items: center;
    padding: 8px;
    border-radius: 4px;
    cursor: pointer;
    gap: 10px;
    margin-bottom: 0;
    font-weight: normal;
}
.checkbox-item:hover { background: #f5f5f5; }
.checkbox-list .checkbox-item input[type="checkbox"],
.checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    min-width: 18px;
    cursor: pointer;
    flex-shrink: 0;
}
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
}
.form-check-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

/* Score badges */
.badge-score {
    min-width: 32px;
    text-align: center;
    font-weight: 600;
}
.score-positive { background: #27ae60; }
.score-negative { background: #e74c3c; }
.score-neutral { background: #95a5a6; }

/* Score icon in list items */
.score-emoji {
    font-size: 18px;
    margin-left: 8px;
    cursor: default;
}
.badge-comment {
    background: #3498db;
    padding: 3px 6px;
    cursor: help;
}
.list-item-comment {
    font-style: italic;
    padding: 4px 8px;
    background: #f8f9fa;
    border-radius: 4px;
    margin-top: 6px;
}

/* Profile meta info (birthday, nicknames) */
.profile-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 10px;
}
.profile-meta-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 28px;
}
.profile-meta-icon {
    width: 16px;
    text-align: center;
    color: #aaa;
    flex-shrink: 0;
    font-size: 13px;
}
.profile-meta-placeholder {
    color: #bbb;
    font-size: 13px;
    font-style: italic;
    cursor: pointer;
    border-bottom: 1px dashed #ddd;
    padding-bottom: 1px;
    transition: color 0.15s;
}
.profile-meta-placeholder:hover { color: #3498db; border-bottom-color: #3498db; }
.profile-meta-value {
    font-size: 13px;
    color: #555;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.profile-meta-edit-btn {
    background: none;
    border: none;
    color: #ccc;
    cursor: pointer;
    padding: 0 2px;
    font-size: 11px;
    line-height: 1;
    transition: color 0.15s;
}
.profile-meta-edit-btn:hover { color: #3498db; }
.profile-meta-input {
    padding: 3px 7px;
    border: 1px solid #dde1e7;
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
}
.profile-meta-actions {
    display: flex;
    gap: 4px;
}

/* Icon picker */
.icon-picker-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: #00000080;
    z-index: 1200;
    justify-content: center;
    align-items: center;
}
.icon-picker-overlay.active { display: flex; }
.icon-picker-dialog {
    background: white;
    border-radius: 8px;
    width: min(560px, 95vw);
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 8px 32px #00000033;
}
.icon-picker-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid #e0e0e0;
}
.icon-picker-header .search-input { flex: 1; }
.icon-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
    gap: 4px;
    padding: 12px;
    overflow-y: auto;
}
.icon-picker-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 52px;
    border-radius: 6px;
    cursor: pointer;
    border: 2px solid transparent;
    font-size: 20px;
    color: #555;
    transition: background 0.15s, border-color 0.15s;
    background: none;
}
.icon-picker-item:hover { background: #e8f4fd; border-color: #3498db; color: #3498db; }
.icon-picker-item.selected { background: #d4efdf; border-color: #27ae60; color: #27ae60; }
.icon-picker-item-none {
    font-size: 12px;
    color: #aaa;
    gap: 4px;
}

/* Section title link (tag headers in profile list) */
.section-label {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #888;
    margin: 0 0 12px 0;
}
.form-static-value {
    padding: 8px 0;
    font-weight: 500;
    color: #444;
    margin: 0;
}
.section-title-link {
    color: inherit;
    text-decoration: none;
}
.section-title-link:hover { opacity: 0.75; }

/* Toggle switch */
.toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-weight: 500;
    user-select: none;
}
.toggle-label-sm .toggle-switch {
    width: 34px;
    height: 20px;
}
.toggle-label-sm .toggle-slider {
    border-radius: 20px;
}
.toggle-label-sm .toggle-slider::before {
    width: 14px;
    height: 14px;
    left: 3px;
    bottom: 3px;
}
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 26px;
    flex-shrink: 0;
}
.toggle-switch input[type="checkbox"] {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}
.toggle-slider {
    position: absolute;
    inset: 0;
    background: #ccc;
    border-radius: 26px;
    cursor: pointer;
    transition: background 0.25s;
}
.toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: transform 0.25s;
}
.toggle-switch input[type="checkbox"]:checked + .toggle-slider { background: #27ae60; }
.toggle-switch input[type="checkbox"]:checked + .toggle-slider::before { transform: translateX(20px); }
.toggle-switch input[type="checkbox"]:focus-visible + .toggle-slider { outline: 2px solid #3498db; outline-offset: 2px; }

/* Color picker button (round swatch that opens native color input) */
.color-picker-btn {
    position: relative;
    display: inline-flex;
    width: 28px; height: 28px; flex-shrink: 0;
    border-radius: 50%;
    border: 2.5px solid #ffffffcc;
    box-shadow: 0 0 0 1.5px #00000033;
    cursor: pointer;
    overflow: hidden;
}
.color-picker-btn input[type="color"] {
    position: absolute;
    width: 200%; height: 200%;
    top: -50%; left: -50%;
    opacity: 0; cursor: pointer;
    border: none; padding: 0;
}
.dark-mode .color-picker-btn {
    border-color: #ffffff40;
    box-shadow: 0 0 0 1.5px #ffffff2e;
}

/* Hex color text input with swatch */
.hex-color-input-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1.5px solid #00000033;
    border-radius: 6px;
    padding: 3px 8px 3px 4px;
    background: #fff;
}
.hex-color-swatch {
    width: 22px; height: 22px; flex-shrink: 0;
    border-radius: 4px;
    border: 1.5px solid #ffffffcc;
    box-shadow: 0 0 0 1px #00000033;
}
.hex-color-input {
    border: none; outline: none; background: transparent;
    font-family: monospace; font-size: 13px;
    width: 68px; color: inherit;
}
.dark-mode .hex-color-input-wrap {
    border-color: #ffffff40;
    background: #2a2a2a;
}
.dark-mode .hex-color-swatch {
    border-color: #ffffff40;
    box-shadow: 0 0 0 1px #ffffff2e;
}

/* Generic color picker popover (.cpick) */
.cpick { position: relative; display: inline-flex; }
.cpick-trigger {
    width: 28px; height: 28px; padding: 0; border: none;
    border-radius: 50%; cursor: pointer; background: none;
}
.cpick-swatch {
    display: block; width: 100%; height: 100%;
    border-radius: 50%;
    border: 2.5px solid #ffffff;
    box-shadow: 0 0 0 1.5px #00000033;
}
.cpick-popover {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 200;
    background: #fff;
    border: 1px solid #d0d0d0;
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 4px 16px #c0c0c0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-width: 130px;
}
.cpick-popover input.cpick-native {
    width: 40px; height: 40px;
    border-radius: 50%;
    border: 2px solid #d0d0d0;
    padding: 2px; cursor: pointer; background: none;
}
.cpick-popover input.cpick-native::-webkit-color-swatch-wrapper { padding: 0; border-radius: 50%; }
.cpick-popover input.cpick-native::-webkit-color-swatch { border: none; border-radius: 50%; }
.cpick-hex {
    width: 110px;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 13px;
    font-family: monospace;
    text-align: center;
    outline: none;
    color: #333;
}
.cpick-hex:focus { border-color: #4a90e2; }
.dark-mode .cpick-popover { background: #1e1e2e; border-color: #3a3a4a; box-shadow: 0 4px 16px #111111; }
.dark-mode .cpick-hex { background: #181828; border-color: #3a3a4a; color: #d0d0e0; }

/* Nickname collection */
.nickname-list { margin-bottom: 8px; }
.nickname-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.nickname-row input { flex: 1; }

/* Nickname badges (profile show) */
.nickname-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    background: #ecf0f1;
    color: #555;
    border-radius: 12px;
    font-size: 13px;
    font-style: italic;
}

/* Score buttons in forms */
.score-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.score-buttons label {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}
.score-buttons label:hover {
    border-color: #3498db;
}
.score-buttons input[type="radio"] {
    margin-right: 6px;
}
.score-buttons input[type="radio"]:checked + span,
.score-buttons label:has(input:checked) {
    border-color: #27ae60;
    background: #d4edda;
}

/* Agenda — profile filter toggles */
.agenda-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
    align-items: center;
}
.agenda-profile-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px 5px 8px;
    border: 2px solid #ddd;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: border-color 0.2s, background 0.2s;
    user-select: none;
    background: white;
    color: #444;
}
.agenda-profile-toggle input[type="checkbox"] { display: none; }
.agenda-profile-toggle:has(input:checked) {
    border-color: #3498db;
    background: #e8f4fd;
    color: #2980b9;
}
.agenda-profile-toggle:hover { border-color: #3498db; }

/* Theme toggle button (in sidebar) */
.theme-toggle-btn {
    display: flex;
    align-items: center;
    background: none;
    border: 1px solid #ffffff4c;
    border-radius: 4px;
    color: #ecf0f1;
    cursor: pointer;
    padding: 3px 8px;
    font-size: 14px;
    line-height: 1.5;
    transition: background 0.2s;
}
.theme-toggle-btn:hover { background: #ffffff1a; }

/* Agenda — event modal */
.agenda-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: #00000080;
    z-index: 1050;
    justify-content: center;
    align-items: center;
}
.agenda-modal-overlay.active { display: flex; }
.agenda-modal-dialog {
    background: white;
    border-radius: 8px;
    width: min(520px, 96vw);
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px #00000033;
    overflow: hidden;
}
.agenda-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
}
.agenda-modal-header h3 { margin: 0; font-size: 18px; }
.agenda-modal-close {
    background: none; border: none; font-size: 18px; cursor: pointer;
    color: #666; padding: 4px 8px; border-radius: 4px;
    transition: color 0.2s, background 0.2s; line-height: 1;
}
.agenda-modal-close:hover { color: #333; background: #f5f5f5; }
.agenda-modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.agenda-modal-footer {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 20px; border-top: 1px solid #e0e0e0; flex-shrink: 0; gap: 10px;
}
.agenda-modal-footer .footer-actions { display: flex; gap: 8px; }

/* ── Profile list-type blocks ── */
.type-blocks-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 16px;
    margin: 24px 0;
}
.type-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
}
.type-block-icon {
    position: relative;
    width: 90px;
    height: 90px;
    border-radius: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    color: white;
    box-shadow: 0 4px 12px #0000002e;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.type-block:hover .type-block-icon {
    transform: translateY(-4px);
    box-shadow: 0 10px 24px #00000038;
}
.type-block.active .type-block-icon {
    box-shadow: 0 4px 12px #0000002e, 0 0 0 3px white, 0 0 0 5px var(--block-color);
}
.type-block-count {
    position: absolute;
    top: -7px;
    right: -7px;
    min-width: 22px;
    height: 22px;
    border-radius: 11px;
    background: white;
    color: #333;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    box-shadow: 0 1px 4px #00000040;
    border: 1.5px solid #00000014;
}
.type-block-count.empty {
    background: #dde2e7;
    color: #8a9baa;
}
.type-block-label {
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    color: #444;
}
@media (max-width: 1024px) {
    .type-blocks-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 700px) {
    .type-blocks-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 400px) {
    .type-blocks-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ===================================================================
   DARK MODE  —  classe .dark-mode sur <html>
   Palette calée sur le bleu-gris du menu (#2c3e50)
   - Fond de page  : #1a2634  (plus sombre que la sidebar)
   - Surface carte : #243447  (entre le fond et la sidebar)
   - Surface input : #2c3e50  (même couleur que la sidebar)
   - Bordures      : #ffffff1a
   - Texte         : #ecf0f1  (même que la sidebar)
   - Texte muet    : #bdc3c7
   =================================================================== */

/* Variable CSS utilisée dans le dashboard (birthday names) */
.dark-mode { --text-primary: #ecf0f1; }

/* Base */
.dark-mode body { background: #1a2634; color: #ecf0f1; }
.dark-mode h1, .dark-mode h2, .dark-mode h3 { color: #ecf0f1; }
.dark-mode .link { color: #85c1e9; }
.dark-mode .link:hover { color: #aed6f1; }

/* Cards */
.dark-mode .card { background: #243447; box-shadow: 0 2px 8px #00000059; }

/* Forms */
.dark-mode .form-group input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not(.cpick-hex):not(.cpick-native),
.dark-mode .form-group select,
.dark-mode .form-group textarea,
.dark-mode .form-control,
.dark-mode .search-input { background-color: #2c3e50; border-color: #ffffff26; color: #ecf0f1; }
.info-search-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 16px #0000001a;
    z-index: 200;
    overflow: hidden;
    max-height: 320px;
    overflow-y: auto;
}
.info-search-result {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 14px;
    text-decoration: none;
    color: inherit;
    border: none;
    border-bottom: 1px solid #f0f0f0;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s;
}
.info-search-result:last-child { border-bottom: none; }
.info-search-result:hover { background: #f5f8ff; }
.info-search-result-name { font-weight: 600; font-size: 14px; }
.info-search-result-sub  { font-size: 12px; color: #888; }
.info-search-result-list { font-size: 12px; color: #3498db; }
.info-search-empty { padding: 12px 14px; color: #999; font-size: 13px; margin: 0; }
.dark-mode .info-search-results { background: #243447; border-color: #ffffff1a; }
.dark-mode .info-search-result  { border-color: #ffffff0d; color: #ecf0f1; }
.dark-mode .info-search-result:hover { background: #2c3e50; }
.dark-mode .info-search-result-sub  { color: #8899aa; }
.dark-mode .info-search-result-list { color: #5dade2; }

/* ── Popup fiche répertoire (iep = info-entry-popup) ── */
.iep-dialog { border: none; border-radius: 12px; padding: 0; max-width: 560px; width: calc(100% - 2rem); max-height: 85vh; overflow-y: auto; box-shadow: 0 8px 32px #00000033; background: var(--card-bg, #fff); color: var(--text-color, #333); }
.iep-dialog::backdrop { background: #00000066; }
.iep-dialog-header { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border-color, #e0e0e0); position: sticky; top: 0; background: var(--card-bg, #fff); z-index: 1; }
.iep-dialog-header span { font-weight: 600; font-size: 1rem; }
.iep-dialog-body { padding: 16px; overflow: visible; }
.iep-top { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 14px; }
.iep-avatar-img { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.iep-avatar-icon { width: 72px; height: 72px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 2rem; color: #fff; flex-shrink: 0; }
.iep-meta { flex: 1; }
.iep-name { font-size: 1.1rem; font-weight: 700; display: block; margin-bottom: 4px; }
.iep-profession { background: #ecf0f1; color: #2c3e50; font-size: 0.78rem; }
.iep-row { display: flex; align-items: baseline; gap: 8px; font-size: 0.9rem; margin-bottom: 6px; }
.iep-row i { color: #888; width: 16px; text-align: center; flex-shrink: 0; }
.iep-row a { color: var(--primary-color, #3498db); }
.iep-hours-badge { font-size: 12px; padding: 2px 8px; border-radius: 10px; cursor: pointer; user-select: none; }
.iep-hours-open { background: #27ae60; color: #fff; }
.iep-hours-closed-badge { background: #e74c3c; color: #fff; }
.iep-hours-chevron { font-size: 0.6rem; margin-left: 3px; }
.iep-hours-expand { display: none; margin-top: 6px; }
.iep-hours-expand.open { display: block; }
.iep-hours-table { width: 100%; font-size: 12px; border-collapse: collapse; }
.iep-hours-table td { padding: 2px 8px 2px 0; vertical-align: top; }
.iep-hours-days { color: #555; font-weight: 600; white-space: nowrap; }
.iep-hours-today .iep-hours-days { color: #3498db; }
.iep-hours-slots { color: #333; }
.iep-payment-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.iep-payment-badge { background: #f0f0f0; color: #555; font-size: 0.72rem; }
.iep-comment { color: #888; font-size: 0.85rem; font-style: italic; margin-top: 10px; border-top: 1px solid var(--border-color, #f0f0f0); padding-top: 10px; }

.dark-mode input[type="color"] { border-color: #ffffff33; }

.dark-mode .form-static-value { color: #bdc3c7; }

/* Tables */
.dark-mode th { background: #2c3e50; color: #ecf0f1; }
.dark-mode th, .dark-mode td { border-color: #ffffff1a; }
.dark-mode tr:hover { background: #ffffff0a; }
.dark-mode .table-details { background: #2c3e50; color: #bdc3c7; }
.dark-mode .table-details td { border-color: #ffffff1a; }

/* List items */
.dark-mode .list-item { background: #243447; border-color: #ffffff1a; }
.dark-mode .list-item-note { color: #bdc3c7; }
.dark-mode .list-item-comment { background: #2c3e50; }

/* Alerts */
.dark-mode .alert-success { background: #1e3d2a; color: #a8e6bf; border-color: #2e6b42; }
.dark-mode .alert-error { background: #3d1e1e; color: #f0a0a0; border-color: #6b2e2e; }

/* Text & misc */
.dark-mode .text-muted { color: #bdc3c7; }
.dark-mode .section-label { color: #8eaabf; }
.dark-mode .nickname-badge { background: #2c3e50; color: #bdc3c7; }
.dark-mode .profile-meta-value { color: #bdc3c7; }
.dark-mode .profile-meta-placeholder { color: #5d7a8e; border-bottom-color: #ffffff1a; }
.dark-mode .empty-state { color: #8eaabf; }
.dark-mode .friend-card { background: #1e2d3d; border-color: #ffffff1a; }
.dark-mode .friend-card-mood { color: #8eaabf; }
.dark-mode .type-block-label { color: #bdc3c7; }
.dark-mode .type-block-count { background: #2c3e50; color: #ecf0f1; border-color: #ffffff1f; }
.dark-mode .type-block-count.empty { background: #243447; color: #5d7a8e; }
.dark-mode .type-block.active .type-block-icon { box-shadow: 0 4px 12px #00000059, 0 0 0 3px #1a2634, 0 0 0 5px var(--block-color); }

/* Sidebar nav submenu */
.dark-mode .nav-submenu-toggle { color: #ecf0f1; }
.dark-mode .nav-submenu-toggle:hover { color: #fff; background: #ffffff1a; }

/* Settings dropdown */
.dark-mode .settings-dropdown { background: #243447; border-color: #ffffff1a; }
.dark-mode .dropdown-link { color: #ecf0f1; }
.dark-mode .dropdown-link:hover { background: #ffffff12; }
.dark-mode .dropdown-label { color: #bdc3c7; }

/* Sort / filter buttons */
.dark-mode .sort-btn { border-color: #ffffff33; color: #bdc3c7; background: transparent; }
.dark-mode .sort-btn:hover { border-color: #3498db; color: #3498db; }
.dark-mode .action-icon { color: #bdc3c7; }
.dark-mode .checkbox-list { border-color: #ffffff1a; }
.dark-mode .checkbox-item:hover { background: #ffffff0f; }

/* Score buttons */
.dark-mode .score-buttons label { border-color: #ffffff33; color: #ecf0f1; }

/* Icon picker */
.dark-mode .icon-picker-dialog { background: #243447; }
.dark-mode .icon-picker-header { border-bottom-color: #ffffff1a; }
.dark-mode .icon-picker-item { color: #bdc3c7; }
.dark-mode .icon-picker-item:hover { background: #3498db33; border-color: #3498db; }

/* Cropper */
.dark-mode .cropper-dialog { background: #243447; }

/* Board (agenda compact week) */
.dark-mode .board-day { background: #243447; border-color: #ffffff1a; }
.dark-mode .board-day-today { border-color: #3788d8; }
.dark-mode .board-day-header { background: #2c3e50; border-bottom-color: #ffffff1a; }
.dark-mode .board-day-today .board-day-header { background: #1e3d5e; }
.dark-mode .board-day-header:hover { background: #34495e; }
.dark-mode .board-day-short-name { color: #8eaabf; }
.dark-mode .board-day-date { color: #ecf0f1; }
.dark-mode .board-day-today .board-day-date { color: #5dade2; }
.dark-mode .board-day-name { color: #bdc3c7; }
.dark-mode .board-day-month { color: #8eaabf; }
.dark-mode .board-day-empty { color: #5d7a8e; }
.dark-mode .board-card { background: #2c3e50; }
.dark-mode .board-card-title { color: #ecf0f1; }
.dark-mode .board-card-time { color: #bdc3c7; }

/* Agenda modal */
.dark-mode .agenda-modal-dialog { background: #243447; }
.dark-mode .agenda-modal-header { border-bottom-color: #ffffff1a; }
.dark-mode .agenda-modal-header h3 { color: #ecf0f1; }
.dark-mode .agenda-modal-close { color: #bdc3c7; }
.dark-mode .agenda-modal-close:hover { background: #ffffff14; color: #ecf0f1; }
.dark-mode .agenda-modal-footer { border-top-color: #ffffff1a; }

/* Agenda detail popup */
.dark-mode .agenda-detail-popup { background: #243447; border-color: #ffffff1a; box-shadow: 0 6px 32px #00000066; }
.dark-mode .agenda-detail-header { border-bottom-color: #ffffff1a; }
.dark-mode .agenda-detail-title { color: #ecf0f1; }
.dark-mode .agenda-detail-row { color: #bdc3c7; }
.dark-mode .agenda-detail-icon { color: #5d7a8e; }
.dark-mode .agenda-detail-footer { border-top-color: #ffffff1a; }
.dark-mode .agenda-detail-participant-name { color: #ecf0f1; }

/* Agenda profile filter toggles */
.dark-mode .agenda-profile-toggle { background: #243447; border-color: #ffffff26; color: #ecf0f1; }
.dark-mode .agenda-profile-toggle:has(input:checked) { background: #1e3d5e; border-color: #3498db; color: #5dade2; }

/* FullCalendar */
.dark-mode .fc {
    --fc-border-color: #ffffff1a;
    --fc-button-bg-color: #2c3e50;
    --fc-button-border-color: #ffffff33;
    --fc-button-hover-bg-color: #34495e;
    --fc-button-hover-border-color: #ffffff4c;
    --fc-button-active-bg-color: #2980b9;
    --fc-button-active-border-color: #2980b9;
    --fc-today-bg-color: #3498db1f;
    --fc-page-bg-color: #243447;
    --fc-neutral-bg-color: #2c3e50;
    --fc-list-event-hover-bg-color: #2c3e50;
}
.dark-mode .fc .fc-button { color: #ecf0f1; }
.dark-mode .fc .fc-toolbar-title { color: #ecf0f1; }
.dark-mode .fc .fc-col-header-cell-cushion { color: #bdc3c7; }
.dark-mode .fc .fc-daygrid-day-number { color: #bdc3c7; }
.dark-mode .fc-theme-standard td,
.dark-mode .fc-theme-standard th { border-color: #ffffff1a; }
.dark-mode .fc-list-day td { background: transparent !important; }
.dark-mode .fc-list-day-cushion { background: transparent !important; }
.dark-mode .fc-list-day-text { color: #bdc3c7; }
.dark-mode .fc-list-day-side-text { color: #8eaabf; }
.dark-mode .fc-list-event td { background: #243447; }
.dark-mode .fc-list-event:hover td { background: #2c3e50 !important; }
.dark-mode .fc-list-empty-cushion { color: #5d7a8e; }
.dark-mode .fc-timegrid-slot-label { color: #8eaabf; }

/* Tom Select */
.dark-mode .ts-control { background: #2c3e50 !important; border-color: #ffffff26 !important; color: #ecf0f1 !important; }
.dark-mode .ts-dropdown { background: #243447; border-color: #ffffff26; color: #ecf0f1; }
.dark-mode .ts-dropdown .option { color: #ecf0f1; }
.dark-mode .ts-dropdown .option:hover { background: #2c3e50; }
.dark-mode .ts-dropdown .option.active { background: #1e3d5e; color: #5dade2; }
.dark-mode .ts-item { background: #1e3d5e !important; color: #5dade2 !important; border-color: #2d5a80 !important; }
.dark-mode .ts-item .remove { color: #5dade2 !important; border-left-color: #2d5a80 !important; }

/* ===== Flatpickr — icône calendrier ===== */
.flatpickr-input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='%23666666' d='M3.5 0a.5.5 0 0 1 .5.5V1h8V.5a.5.5 0 0 1 1 0V1h1a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h1V.5a.5.5 0 0 1 .5-.5zM1 4v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V4H1z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 10px center !important;
    background-size: 14px 14px !important;
    padding-right: 34px !important;
    cursor: pointer;
}
.dark-mode .flatpickr-input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='%23bdc3c7' d='M3.5 0a.5.5 0 0 1 .5.5V1h8V.5a.5.5 0 0 1 1 0V1h1a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h1V.5a.5.5 0 0 1 .5-.5zM1 4v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V4H1z'/%3E%3C/svg%3E") !important;
}

/* ===== Flatpickr — mode clair ===== */
.flatpickr-calendar { border-color: #ddd; box-shadow: 0 4px 14px #0000001f; border-radius: 6px; }
.flatpickr-day.selected, .flatpickr-day.selected:hover { background: #3498db; border-color: #3498db; }
.flatpickr-day.today { border-color: #3498db; }
.flatpickr-day:hover { background: #e8f4fd; border-color: #e8f4fd; }

/* ===== Flatpickr — mode sombre ===== */
.dark-mode .flatpickr-calendar { background: #243447; border-color: #ffffff1a; box-shadow: 0 4px 20px #00000080; color: #ecf0f1; }
.dark-mode .flatpickr-months { background: #2c3e50; border-radius: 6px 6px 0 0; }
.dark-mode .flatpickr-month { background: #2c3e50; color: #ecf0f1; fill: #ecf0f1; }
.dark-mode .flatpickr-current-month { color: #ecf0f1; }
.dark-mode .flatpickr-current-month input.cur-year { color: #ecf0f1; }
.dark-mode .flatpickr-current-month .numInputWrapper span { border-color: #ffffff33; }
.dark-mode .flatpickr-current-month .numInputWrapper span:hover { background: #ffffff1a; }
.dark-mode .flatpickr-prev-month svg, .dark-mode .flatpickr-next-month svg { fill: #ecf0f1; }
.dark-mode .flatpickr-prev-month:hover svg, .dark-mode .flatpickr-next-month:hover svg { fill: #5dade2; }
.dark-mode .flatpickr-weekdays { background: #2c3e50; }
.dark-mode span.flatpickr-weekday { background: #2c3e50; color: #bdc3c7; }
.dark-mode .flatpickr-day { color: #ecf0f1; border-color: transparent; }
.dark-mode .flatpickr-day:hover { background: #34495e; border-color: #34495e; }
.dark-mode .flatpickr-day.selected, .dark-mode .flatpickr-day.selected:hover { background: #3498db; border-color: #3498db; color: white; }
.dark-mode .flatpickr-day.today { border-color: #5dade2; }
.dark-mode .flatpickr-day.today:hover { background: #34495e; }
.dark-mode .flatpickr-day.disabled, .dark-mode .flatpickr-day.disabled:hover { color: #5d7a8e; }
.dark-mode .flatpickr-day.prevMonthDay, .dark-mode .flatpickr-day.nextMonthDay { color: #5d7a8e; }
.dark-mode .flatpickr-time { background: #243447; border-top-color: #ffffff1a; }
.dark-mode .flatpickr-time input { color: #ecf0f1; background: transparent; }
.dark-mode .flatpickr-time .flatpickr-time-separator { color: #ecf0f1; }
.dark-mode .flatpickr-time .numInputWrapper span { border-color: #ffffff26; }
.dark-mode .flatpickr-time .numInputWrapper span:hover { background: #ffffff1a; }
.dark-mode .flatpickr-calendar.arrowTop::before { border-bottom-color: #ffffff1a; }
.dark-mode .flatpickr-calendar.arrowTop::after { border-bottom-color: #243447; }
.dark-mode .flatpickr-calendar.arrowBottom::before { border-top-color: #ffffff1a; }
.dark-mode .flatpickr-calendar.arrowBottom::after { border-top-color: #243447; }

/* Category chips */
.category-chip-list { display: flex; flex-wrap: wrap; gap: 10px; }
.category-chip { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border: 1px solid #e0e0e0; border-radius: 8px; background: #fafafa; }
.category-chip--global { background: #f5f5f5; opacity: 0.8; }
.dark-mode .category-chip { background: #243447; border-color: #ffffff1a; }
.dark-mode .category-chip--global { background: #1e2736; }

/* List type selector */
.list-type-selector { display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 10px; }

/* Category picker (list new/edit) */
.cat-picker { display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow-y: auto; border: 1px solid #ddd; border-radius: 6px; padding: 4px; }
.cat-picker-item { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 5px; cursor: pointer; font-size: 14px; transition: background 0.12s; }
.cat-picker-item:hover { background: #f5f5f5; }
.cat-picker-item.selected { background: #e8f4fd; font-weight: 600; }
.cat-picker-item.selected .cat-picker-check { display: inline-flex; }
.cat-picker-check { display: none; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%; background: #3498db; color: white; font-size: 10px; margin-left: auto; flex-shrink: 0; }
.cat-picker-none { color: #aaa; font-style: italic; }

/* Rating radio row (list new/edit) */
.rating-radio-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.rating-radio-opt { padding: 5px 14px; border: 2px solid #ddd; border-radius: 20px; cursor: pointer; font-size: 14px; font-weight: 600; background: white; color: #555; transition: border-color 0.15s, background 0.15s, color 0.15s; }
.rating-radio-opt:hover { border-color: #3498db; color: #3498db; }
.rating-radio-opt.active { border-color: #3498db; background: #e8f4fd; color: #2980b9; }
.dark-mode .cat-picker { border-color: #ffffff26; background: #1e2e3d; }
.dark-mode .cat-picker-item:hover { background: #243447; }
.dark-mode .cat-picker-item.selected { background: #1a3a56; }
.dark-mode .rating-radio-opt { background: #1e2e3d; border-color: #ffffff26; color: #bdc3c7; }
.list-type-card { display: flex; align-items: center; gap: 10px; padding: 10px; border: 2px solid #e0e0e0; border-radius: 8px; cursor: pointer; transition: border-color 0.2s, opacity 0.2s, background 0.2s; background: #fafafa; opacity: 0.55; }
.list-type-card input[type="checkbox"] { display: none; }
.list-type-card.active { border-color: var(--card-active-color, #3498db); background: white; opacity: 1; }
.dark-mode .list-type-card { border-color: #ffffff26; background: #1e2e3d; }
.dark-mode .list-type-card.active { background: #243447; }

/* ═══════════════════════════════════════════════
   Stories (Ecritures)
   ═══════════════════════════════════════════════ */

/* Story cards on profile/show */
.story-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 15px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.story-card:hover { border-color: #d68910; box-shadow: 0 2px 8px #d6891026; color: inherit; background: none; }
.story-card-icon { font-size: 26px; color: #d68910; flex-shrink: 0; padding-top: 2px; }
.story-card-body { flex: 1; }
.story-card-title { margin: 0; font-size: 15px; }

/* Full-page story editor/reader layout */
.story-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

.story-sidebar {
    width: 260px;
    max-width: 260px;
    background: #f5f7fa;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: row;
    overflow: hidden;
    transition: max-width 0.2s ease;
    flex-shrink: 0;
}
.story-sidebar.collapsed { max-width: 22px; }
.story-sidebar-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Onglets latéraux (tabs) — juste une flèche, pas de bande visible */
.story-panel-tab {
    width: 22px;
    min-width: 22px;
    background: none;
    border: none;
    cursor: pointer;
    color: #3498db;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: 0.45;
    transition: opacity 0.15s;
}
.story-panel-tab:hover { opacity: 1; }
.story-sidebar-tab { order: 2; }
.story-notes-tab { }
.story-sidebar-header {
    padding: 14px 16px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 14px;
    min-height: 52px;
}
.story-spotify-hint-wrap {
    position: relative;
    margin-left: auto;
    flex-shrink: 0;
}
.story-spotify-sidebar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #1db954;
    font-size: 18px;
    opacity: 0.7;
}
.story-spotify-sidebar-btn:hover { opacity: 1; }
.story-spotify-sidebar-tooltip {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: #1a1a1a;
    color: #fff;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.5;
    white-space: nowrap;
    padding: 8px 12px;
    border-radius: 8px;
    box-shadow: 0 4px 16px #00000040;
    z-index: 200;
    animation: tooltip-in 0.12s ease;
}
.story-spotify-hint-wrap:hover .story-spotify-sidebar-tooltip { display: block; }

.story-back-link {
    color: #666;
    text-decoration: none;
    font-size: 14px;
    flex-shrink: 0;
    padding: 4px 6px;
    border-radius: 4px;
    transition: background 0.15s, color 0.15s;
}
.story-back-link:hover { background: #00000012; color: #333; }
.story-title-display {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.story-title-input {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid #d68910;
    border-radius: 4px;
    padding: 3px 6px;
    outline: none;
    background: white;
}

.story-chapter-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px 0;
    list-style: none;
    margin: 0;
}
.story-chapter-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px 8px 10px;
    font-size: 13px;
    border-left: 3px solid transparent;
    transition: background 0.15s, border-color 0.15s;
}
.story-chapter-item:hover { background: #0000000a; }
.story-chapter-item.active { border-left-color: #d68910; background: #d6891014; font-weight: 500; }
.chapter-link { flex: 1; text-decoration: none; color: inherit; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chapter-link:hover { color: inherit; background: none; }
.chapter-drag-handle { color: #ccc; cursor: grab; font-size: 12px; flex-shrink: 0; padding: 2px; }
.chapter-delete-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #ccc;
    font-size: 11px;
    padding: 2px 4px;
    border-radius: 3px;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s;
}
.story-chapter-item:hover .chapter-delete-btn { opacity: 1; }
.chapter-delete-btn:hover { color: #e74c3c; }
.checkbox-item.story-item-separator { color: var(--text-muted, #888); font-style: italic; }
.checkbox-item.story-item-separator i { font-size: 10px; opacity: 0.6; }
.chapter-pin-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #ccc;
    font-size: 11px;
    padding: 2px 4px;
    border-radius: 3px;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s;
    transform: rotate(45deg);
}
.story-chapter-item:hover .chapter-pin-btn,
.chapter-pin-btn.pinned { opacity: 1; }
.chapter-pin-btn.pinned { color: #e67e22; }
.chapter-pin-btn:hover { color: #e67e22; }

/* Séparateur dans la sidebar */
.story-separator-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px 7px 10px;
    font-size: 12px;
    font-style: italic;
    border-left: 3px solid #bdc3c7;
    color: #888;
    transition: background 0.15s, border-color 0.15s;
}
.story-separator-item:hover { background: #00000008; border-left-color: #95a5a6; }
.separator-item-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: none; color: inherit; }
a.separator-item-name:hover { color: #555; }
.separator-edit-btn,
.separator-delete-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #ccc;
    font-size: 11px;
    padding: 2px 4px;
    border-radius: 3px;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s;
}
.story-separator-item:hover .separator-edit-btn,
.story-separator-item:hover .separator-delete-btn { opacity: 1; }
.separator-edit-btn:hover { color: #d68910; }
.separator-delete-btn:hover { color: #e74c3c; }

.story-sidebar-footer {
    padding: 12px;
    border-top: 1px solid #e0e0e0;
}

/* Modale générique histoire (ajout / séparateur) */
.story-modal-overlay {
    position: fixed;
    inset: 0;
    background: #00000073;
    z-index: 1060;
    display: flex;
    justify-content: center;
    align-items: center;
}
.story-modal-overlay.hidden { display: none; }
.story-modal {
    background: #fff;
    border-radius: 10px;
    width: min(400px, 96vw);
    max-height: calc(100vh - 40px);
    box-shadow: 0 8px 32px #00000033;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.story-modal--wide { width: min(480px, 96vw); }
.story-modal--form { width: min(720px, 96vw); }
.story-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e0e6ed;
    font-weight: 600;
    font-size: 15px;
    flex-shrink: 0;
}
.story-modal-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: #888;
    padding: 4px 8px;
    border-radius: 4px;
}
.story-modal-close:hover { background: #f0f0f0; color: #333; }
.story-modal-body { padding: 20px; overflow-y: auto; flex: 1; min-height: 0; }
.story-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 14px 20px;
    border-top: 1px solid #e0e6ed;
    flex-shrink: 0;
}

/* Sélecteur chapitre / séparateur */
.story-add-type-selector {
    display: flex;
    gap: 8px;
}
.story-add-type-btn {
    flex: 1;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #555;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.story-add-type-btn:hover { border-color: #d68910; color: #d68910; }
.story-add-type-btn.active { border-color: #d68910; background: #d689100f; color: #d68910; font-weight: 600; }

/* Labels et radios dans la modale */
.story-modal-option-label { font-size: 12px; font-weight: 600; color: #888; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.story-modal-radio-group { display: flex; flex-direction: column; gap: 8px; }
.story-modal-radio-group--inline { flex-direction: row; }
.story-modal-radio {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: #333;
}
.story-modal-radio input[type="radio"] { accent-color: #d68910; margin: 0; }

/* Image séparateur */
.story-sep-image-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}
.story-sep-image-thumb {
    max-height: 80px;
    max-width: 180px;
    border-radius: 6px;
    object-fit: cover;
    border: 1px solid #e0e0e0;
}
.story-sep-image-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: #e74c3c;
    font-size: 14px;
    padding: 4px;
    border-radius: 4px;
}
.story-sep-image-remove:hover { background: #e74c3c1a; }
.story-sep-image-options { padding-top: 4px; }

/* Page séparateur (mode lecture, page entière) */
.story-separator-page {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 0;
    padding: 80px 40px 60px;
    gap: 24px;
    text-align: center;
}
.story-separator-page-title {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: #2c3e50;
    margin: 0;
}
.story-separator-page-image {
    max-width: 100%;
    object-fit: contain;
    border-radius: 6px;
}

/* Séparateur inline affiché en tête de chapitre */
.story-inline-separator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-align: center;
    padding: 24px 0 32px;
    border-bottom: 1px solid #e8e8e8;
    margin-bottom: 32px;
}
.story-inline-separator-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #555;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* Wrapper image séparateur avec popover contextuel */
.story-sep-img-wrap {
    position: relative;
    display: block;
}
.story-sep-img-edit-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #00000073;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 2;
    font-size: 12px;
}
.story-sep-img-wrap:hover .story-sep-img-edit-btn { opacity: 1; }
.story-sep-img-popover {
    position: absolute;
    top: 8px;
    right: 48px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 16px #00000024;
    padding: 4px;
    min-width: 190px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.story-sep-img-popover-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    background: none;
    border: none;
    color: #333;
    width: 100%;
    text-align: left;
    text-decoration: none;
}
.story-sep-img-popover-item:hover { background: #f3f4f6; }
.story-sep-img-height-row { cursor: default; }
.story-sep-img-height-row:hover { background: none; }
.story-sep-img-height-input { flex: 1; cursor: pointer; accent-color: #d68910; }
.story-sep-img-height-val { font-size: 13px; font-weight: 600; min-width: 24px; text-align: right; }
.story-sep-img-delete-btn { color: #e74c3c !important; }
.story-sep-img-delete-btn:hover { background: #e74c3c14 !important; }

/* Images insérées dans le contenu d'un chapitre */
.story-content-image-wrap {
    display: block;
    position: relative;
    text-align: center;
    margin: 20px 0;
}
.story-content-image {
    max-width: 100%;
    object-fit: contain;
    border-radius: 6px;
    display: block;
    margin: 0 auto;
}

/* Navigation précédent / suivant en mode lecture */
.story-read-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid #e8e8e8;
}
.story-read-nav-prev,
.story-read-nav-next {
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Bouton info chapitre */
.story-info-btn-wrap {
    position: relative;
    display: flex;
    align-items: stretch;
}
.story-info-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid #d0d7de;
    background: #fff;
    color: #888;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    flex-shrink: 0;
    transition: color 0.15s, border-color 0.15s;
}
.story-info-btn:hover { color: #d68910; border-color: #d68910; }
.story-info-tooltip {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    box-shadow: 0 4px 16px #00000020;
    padding: 10px 14px;
    min-width: 200px;
    z-index: 200;
    white-space: nowrap;
}
.story-info-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    padding: 4px 0;
    color: #555;
}
.story-info-row + .story-info-row { border-top: 1px solid #f0f0f0; }
.story-info-row i { width: 16px; text-align: center; color: #d68910; flex-shrink: 0; }
.story-info-row span { flex: 1; }
.story-info-row strong { color: #333; }
.dark-mode .story-info-btn { background: #243447; border-color: #ffffff1a; color: #aaa; }
.dark-mode .story-info-btn:hover { color: #d68910; border-color: #d68910; }
.dark-mode .story-info-tooltip { background: #1e2d3d; border-color: #ffffff1a; box-shadow: 0 4px 16px #00000066; }
.dark-mode .story-info-row { color: #bbb; }
.dark-mode .story-info-row + .story-info-row { border-top-color: #ffffff0f; }
.dark-mode .story-info-row strong { color: #ecf0f1; }

/* Bouton de navigation remplacé par une image */
.story-read-nav-img-btn {
    display: block;
    line-height: 0;
    flex-shrink: 0;
}
.story-read-nav-img-btn img {
    height: 48px;
    max-width: 120px;
    object-fit: contain;
    opacity: 0.8;
    transition: opacity 0.15s;
    display: block;
}
.story-read-nav-img-btn:hover img { opacity: 1; }

/* Miniature de prévisualisation dans les settings */
.story-nav-btn-img-preview {
    height: 32px;
    max-width: 80px;
    object-fit: contain;
    border-radius: 4px;
}

/* Active state séparateur dans la sidebar */
.story-separator-item.active {
    background: #d6891012;
    border-left-color: #d68910;
    color: #b7770d;
}
.story-separator-item.active .separator-item-name { color: #b7770d; }

/* Story settings button */
.story-settings-btn { color: #555; background: #fff; border: 1px solid #d0d7de; }
.story-settings-btn:hover { background: #f3f4f6; color: #333; }

/* Story settings modal */
.story-settings-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: #00000073;
    z-index: 1050;
    justify-content: center;
    align-items: center;
}
.story-settings-overlay.active { display: flex; }
.story-settings-dialog {
    background: #fff;
    border-radius: 10px;
    width: min(420px, 96vw);
    box-shadow: 0 8px 32px #00000033;
    overflow: hidden;
}
.story-settings-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e0e6ed;
    font-weight: 600;
    font-size: 15px;
}
.story-settings-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: #888;
    padding: 4px 8px;
    border-radius: 4px;
}
.story-settings-close:hover { background: #f0f0f0; color: #333; }
.story-settings-modal-body { padding: 20px; }
.story-settings-modal-section { margin-bottom: 20px; }
.story-settings-modal-section:last-child { margin-bottom: 0; }
.story-settings-hint { font-size: 12px; color: #888; margin: 6px 0 0; line-height: 1.4; }
.story-settings-danger-zone { padding-top: 16px; border-top: 1px solid #fce4e4; }

/* Segmented control (triple switch) */
.segmented-control {
    display: inline-flex;
    border: 1px solid #d0d7de;
    border-radius: 8px;
    overflow: hidden;
    margin-top: 6px;
    width: 100%;
}
.segmented-option {
    flex: 1;
    display: flex;
    cursor: pointer;
}
.segmented-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.segmented-option span {
    flex: 1;
    text-align: center;
    padding: 7px 10px;
    font-size: 13px;
    font-weight: 500;
    background: #fff;
    color: #555;
    border-right: 1px solid #d0d7de;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}
.segmented-option:last-child span { border-right: none; }
.segmented-option:hover span { background: #f6f8fa; }
.segmented-option input:checked + span {
    background: #3b82f6;
    color: #fff;
}
.story-delete-confirm-input {
    width: 100%;
    padding: 7px 10px;
    font-size: 13px;
    border: 1px solid #d0d7de;
    border-radius: 5px;
    box-sizing: border-box;
}
.story-delete-confirm-input:focus { outline: none; border-color: #e74c3c; }

/* Blockquote in read mode */
.story-quote {
    border-left: 3px solid #d68910;
    margin: 8px 0 8px 0;
    padding: 4px 0 4px 14px;
    color: #555;
    font-style: italic;
}

/* Main content area */
.story-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: white;
}
.story-toolbar {
    padding: 10px 24px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: stretch;
    gap: 12px;
    background: white;
    flex-shrink: 0;
    min-height: 52px;
}
.story-chapter-title-input {
    flex: 1;
    font-size: 16px;
    font-weight: 600;
    border: none;
    outline: none;
    background: transparent;
    padding: 4px 0;
    border-bottom: 2px solid transparent;
    transition: border-color 0.2s;
    min-width: 0;
}
.story-chapter-title-input:focus { border-bottom-color: #d68910; }
.story-chapter-title-display { flex: 1; font-size: 16px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.story-save-status { font-size: 11px; color: #aaa; white-space: nowrap; }

.story-editor-area {
    flex: 1;
    overflow-y: auto;
    padding: 32px 48px;
    position: relative;
}
.story-read-pin {
    position: absolute;
    left: 0;
    right: 0;
    pointer-events: none;
    z-index: 5;
    display: none;
}
.story-read-pin-line {
    border-top: 2px dashed #e67e22;
    position: relative;
}
.story-read-pin-icon {
    position: absolute;
    right: 2px;
    top: -9px;
    color: #e67e22;
    font-size: 13px;
    transform: rotate(45deg);
}
.story-scroll-pin-btn {
    position: fixed;
    right: 20px;
    bottom: 24px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #ccc;
    background: #fff;
    color: #bbb;
    cursor: pointer;
    font-size: 15px;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0,0,0,.15);
    z-index: 600;
    transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.15s;
}
.story-scroll-pin-btn.has-pin { background: #e67e22; color: #fff; border-color: #e67e22; }
.story-scroll-pin-btn.at-pin  { background: #f0a060; border-color: #f0a060; }
.story-scroll-pin-btn:hover   { transform: scale(1.1); }
.story-scroll-pin-btn:active  { cursor: grabbing; }
.story-scroll-pin-btn         { cursor: grab; }
.dark-mode .story-read-pin-line { border-top-color: #e67e22; }
.dark-mode .story-read-pin-icon { color: #e67e22; }
.story-content-textarea {
    width: 100%;
    height: 100%;
    min-height: 500px;
    border: none;
    outline: none;
    resize: none;
    font-family: 'Georgia', serif;
    font-size: 16px;
    line-height: 1.8;
    background: transparent;
    color: inherit;
}
.story-content-display {
    font-family: 'Georgia', serif;
    font-size: 17px;
    line-height: 1.9;
    word-break: break-word;
}
.story-content-empty { color: #aaa; font-style: italic; }

/* Read mode: narrow centered column */
.story-read-mode .story-editor-area { padding: 48px; }
.story-read-mode .story-content-display { max-width: 680px; margin: 0 auto; }

/* Titre de chapitre en mode lecture */
.story-read-chapter-header {
    max-width: 680px;
    margin: 0 auto 56px;
    text-align: center;
    padding-top: 48px;
}
.story-read-chapter-label {
    font-family: Georgia, serif;
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: #999;
    margin-bottom: 20px;
}
.story-read-chapter-title {
    font-family: Georgia, serif;
    font-size: 2rem;
    font-weight: 400;
    font-style: italic;
    color: #2c3e50;
    margin: 0 0 28px;
    line-height: 1.3;
    letter-spacing: 0.01em;
}
.story-read-chapter-ornament {
    font-size: 22px;
    color: #c9a84c;
    line-height: 1;
    display: flex;
    justify-content: center;
    user-select: none;
}

.dark-mode .story-read-chapter-label { color: #6b7a8d; }
.dark-mode .story-read-chapter-title { color: #d6e4f0; }
.story-read-chapter-ornament-img { max-height: 48px; max-width: 180px; object-fit: contain; }
.dark-mode .story-read-chapter-ornament { color: #a08030; }

/* Panneau settings — ornement */
.story-settings-label { font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.story-settings-ornament-row { display: flex; align-items: center; gap: 12px; margin: 10px 0; }
.story-settings-ornament-preview {
    width: 60px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    border: 1px solid #e0d0b8; border-radius: 6px;
    font-size: 20px; color: #c9a84c;
    background: #faf7f0; flex-shrink: 0;
}
.story-settings-ornament-preview img { max-width: 52px; max-height: 32px; object-fit: contain; }
.dark-mode .story-settings-ornament-preview { background: #1e2d3d; border-color: #2c3e50; }

/* Bouton ornement par chapitre (sidebar) */
.chapter-ornament-btn {
    display: none; align-items: center; justify-content: center;
    width: 22px; height: 22px; flex-shrink: 0;
    background: none; border: none; cursor: pointer;
    color: #aaa; border-radius: 4px; padding: 0;
    font-size: 11px;
}
.chapter-ornament-btn:hover { color: #d68910; background: #d689101a; }
.chapter-ornament-btn.has-ornament { color: #d68910; }

/* Popover ornement par chapitre */
.chapter-ornament-popover {
    position: absolute;
    z-index: 300;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 16px #0000001f;
    padding: 4px;
    min-width: 160px;
}
.chapter-ornament-popover.hidden { display: none; }
.chapter-ornament-popover-btn {
    display: flex; align-items: center; gap: 8px;
    width: 100%; padding: 6px 10px;
    background: none; border: none; border-radius: 6px;
    cursor: pointer; font-size: 13px; color: inherit; text-align: left;
}
.chapter-ornament-popover-btn:hover { background: #f5f0e8; }
.chapter-ornament-popover-delete { color: #e74c3c; }
.chapter-ornament-popover-delete:hover { background: #e74c3c14; }

.dark-mode .chapter-ornament-popover { background: #1e2d3d; border-color: #2c3e50; }
.dark-mode .chapter-ornament-popover-btn:hover { background: #243447; }

/* Empty state (no chapters) */
.story-empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: #999;
    padding: 40px;
    text-align: center;
}

/* Boutons mobiles : cachés sur desktop */
.story-mobile-panel-btn { display: none; }
.story-mobile-close-btn {
    display: none;
    margin-left: auto;
    background: none; border: none; cursor: pointer;
    color: #666; font-size: 16px; padding: 4px 6px;
    border-radius: 4px; line-height: 1;
}
.story-mobile-close-btn:hover { color: #e74c3c; background: #0000000f; }
.story-mobile-backdrop {
    display: none; position: fixed; inset: 0;
    background: #00000073; z-index: 1002;
}
.story-mobile-backdrop.active { display: block; }

/* Dark mode */
.dark-mode .story-card { border-color: #ffffff1a; color: #ecf0f1; }
.dark-mode .story-card:hover { border-color: #d68910; background: none; }
.dark-mode .story-sidebar { background: #1e2d3d; border-right-color: #ffffff1a; }
.dark-mode .story-sidebar-header { border-bottom-color: #ffffff1a; color: #ecf0f1; }
.dark-mode .story-back-link { color: #aaa; }
.dark-mode .story-back-link:hover { background: #ffffff12; color: #ecf0f1; }
.dark-mode .story-chapter-item:hover { background: #ffffff0d; }
.dark-mode .story-chapter-item.active { background: #d689101f; }
.dark-mode .chapter-link { color: #ecf0f1; }
.dark-mode .chapter-drag-handle { color: #4a6070; }
.dark-mode .story-separator-item { color: #778899; border-left-color: #3a4a5a; }
.dark-mode .story-separator-item:hover { background: #ffffff0a; border-left-color: #5a6a7a; }
.dark-mode a.separator-item-name:hover { color: #aaa; }
.dark-mode .story-sidebar-footer { border-top-color: #ffffff1a; }
.dark-mode .story-panel-tab { color: #5dade2; }
.dark-mode .story-settings-btn { background: #243447; border-color: #ffffff1a; color: #bdc3c7; }
.dark-mode .story-settings-btn:hover { background: #2d4059; color: #ecf0f1; }
.dark-mode .story-settings-dialog { background: #243447; }
.dark-mode .story-settings-modal-header { border-bottom-color: #ffffff1a; color: #ecf0f1; }
.dark-mode .story-settings-close { color: #778899; }
.dark-mode .story-settings-close:hover { background: #ffffff0f; color: #ecf0f1; }
.dark-mode .story-settings-hint { color: #778899; }
.dark-mode .story-settings-danger-zone { border-top-color: #e74c3c40; }
.dark-mode .segmented-control { border-color: #3a3a4a; }
.dark-mode .segmented-option span { background: #1e1e2e; color: #aaa; border-right-color: #3a3a4a; }
.dark-mode .segmented-option:hover span { background: #2a2a3a; }
.dark-mode .segmented-option input:checked + span { background: #3b82f6; color: #fff; }
.dark-mode .story-modal { background: #243447; }
.dark-mode .story-modal-header { border-bottom-color: #ffffff1a; color: #ecf0f1; }
.dark-mode .story-modal-close { color: #778899; }
.dark-mode .story-modal-close:hover { background: #ffffff0f; color: #ecf0f1; }
.dark-mode .story-modal-footer { border-top-color: #ffffff1a; }
.dark-mode .story-modal-option-label { color: #778899; }
.dark-mode .story-modal-radio { color: #ecf0f1; }
.dark-mode .story-add-type-btn { background: #1e2d3d; border-color: #ffffff1a; color: #bdc3c7; }
.dark-mode .story-add-type-btn:hover { border-color: #d68910; color: #d68910; }
.dark-mode .story-add-type-btn.active { background: #d689101a; border-color: #d68910; color: #d68910; }
.dark-mode .story-separator-page-title { color: #ecf0f1; }
.dark-mode .story-read-nav { border-top-color: #ffffff1a; }
.dark-mode .story-sep-img-popover { background: #1e2d3d; border-color: #ffffff26; }
.dark-mode .story-sep-img-popover-item { color: #ecf0f1; }
.dark-mode .story-sep-img-popover-item:hover { background: #ffffff12; }
.dark-mode .story-sep-img-height-row:hover { background: none; }
.dark-mode .story-inline-separator { border-bottom-color: #ffffff1a; }
.dark-mode .story-inline-separator-title { color: #aaa; }
.dark-mode .story-separator-item.active { background: #d689101f; border-left-color: #d68910; color: #f0a62a; }
.dark-mode .story-separator-item.active .separator-item-name { color: #f0a62a; }
.dark-mode .story-delete-confirm-input { background: #1a2634; border-color: #ffffff26; color: #ecf0f1; }
.dark-mode .story-quote { color: #aaa; border-left-color: #d68910; }
.dark-mode .story-main { background: #1a2634; }
.dark-mode .story-toolbar { background: #243447; border-bottom-color: #ffffff1a; }
.dark-mode .story-chapter-title-input { color: #ecf0f1; }
.dark-mode .story-editor-area { background: #1a2634; }
.dark-mode .story-content-textarea { color: #ecf0f1; }
.dark-mode .story-content-display { color: #ecf0f1; }
.dark-mode .story-title-input { background: #1a2634; color: #ecf0f1; border-color: #d68910; }

/* Format toolbar */
.story-format-toolbar {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 5px 14px;
    border-bottom: 1px solid #e8e8e8;
    background: #fafafa;
    flex-shrink: 0;
    flex-wrap: wrap;
    row-gap: 4px;
}
.story-format-select {
    padding: 3px 5px;
    font-size: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    color: inherit;
    cursor: pointer;
    outline: none;
    height: 26px;
}
.story-format-select--narrow { width: 52px; }
.story-format-select:focus { border-color: #d68910; }
.story-format-btn {
    width: 26px;
    height: 26px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #444;
    transition: background 0.12s, border-color 0.12s;
    flex-shrink: 0;
    padding: 0;
}
.story-format-btn:hover { background: #f0f0f0; border-color: #bbb; }
.story-format-btn.active { background: #e8f4fd; border-color: #3498db; color: #2980b9; }
.story-format-sep {
    width: 1px;
    height: 18px;
    background: #e0e0e0;
    margin: 0 3px;
    flex-shrink: 0;
}

/* Resize handle (left edge of notes content, after the 16px tab) */
.story-notes-resize-handle {
    position: absolute;
    left: 16px;
    top: 0;
    bottom: 0;
    width: 5px;
    cursor: col-resize;
    z-index: 10;
    background: transparent;
    transition: background 0.15s;
}
.story-notes-resize-handle:hover { background: #d6891040; }

/* Notes panel (right) */
.story-notes-panel {
    width: 280px;
    max-width: 280px;
    background: #f5f7fa;
    border-left: 1px solid #e0e0e0;
    display: flex;
    flex-direction: row;
    transition: max-width 0.2s ease;
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
}
.story-notes-panel.collapsed { max-width: 22px; }
/* Disable transition while resizing */
.story-notes-panel.resizing { transition: none; }
.story-notes-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}
.story-notes-header {
    padding: 12px 14px 8px;
    font-weight: 600;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
}
.story-notes-save-status { font-size: 11px; color: #b09050; margin-left: auto; font-weight: 400; }
/* Notes list */
.story-notes-list {
    flex: 0 0 auto;
    max-height: 45%;
    overflow-y: auto;
    border-bottom: 1px solid #e0e0e0;
}
.story-notes-section-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #a08030;
    background: #d689100f;
    border-bottom: 1px solid #e0e0e0;
    position: sticky;
    top: 0;
}
.story-notes-section-toggle { cursor: pointer; user-select: none; }
.story-notes-section-toggle:hover { background: #d689101f; }
.story-notes-section-chevron { font-size: 9px; flex-shrink: 0; transition: transform 0.15s; }
.story-notes-add-btn {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    color: #a08030;
    font-size: 12px;
    padding: 1px 4px;
    border-radius: 3px;
    line-height: 1;
}
.story-notes-add-btn:hover { background: #d6891026; }
.story-notes-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    font-size: 12px;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: background 0.12s, border-color 0.12s;
}
.story-notes-item:hover { background: #d689100f; }
.story-notes-item.active { border-left-color: #d68910; background: #d689101a; font-weight: 500; }
.story-notes-item-icon { color: #c9a84c; font-size: 11px; flex-shrink: 0; }
.story-notes-item-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.story-notes-item-delete {
    background: none;
    border: none;
    cursor: pointer;
    color: #ccc;
    font-size: 10px;
    padding: 2px 4px;
    border-radius: 3px;
    opacity: 0;
    flex-shrink: 0;
    transition: opacity 0.12s, color 0.12s;
}
.story-notes-item:hover .story-notes-item-delete { opacity: 1; }
.story-notes-item-delete:hover { color: #e74c3c; }
.story-notes-empty-notes { padding: 8px 14px; font-size: 11px; color: #bbb; font-style: italic; }
.story-notes-rename-input {
    flex: 1;
    font-size: 12px;
    border: 1px solid #d68910;
    border-radius: 3px;
    padding: 1px 4px;
    outline: none;
    background: white;
    min-width: 0;
}

/* Notes editor area */
.story-notes-editor-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.story-notes-active-title {
    padding: 8px 14px 4px;
    font-size: 11px;
    font-weight: 600;
    color: #a08030;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-shrink: 0;
}
.story-notes-textarea {
    flex: 1;
    border: none;
    outline: none;
    resize: none;
    padding: 6px 14px 14px;
    font-size: 13px;
    line-height: 1.6;
    background: transparent;
    color: inherit;
    font-family: inherit;
}

/* Active format button */
.story-format-btn.active { background: #e8f4fd; border-color: #3498db; color: #2980b9; }

/* Scrollbars : espace 4px toujours réservé (pas de décalage), thumb transparent par défaut */
.story-chapter-list,
.story-notes-list,
.story-editor-area,
.story-main { scrollbar-width: thin; scrollbar-color: transparent transparent; }
.story-chapter-list::-webkit-scrollbar,
.story-notes-list::-webkit-scrollbar,
.story-editor-area::-webkit-scrollbar,
.story-main::-webkit-scrollbar { width: 4px; }
.story-chapter-list::-webkit-scrollbar-track,
.story-notes-list::-webkit-scrollbar-track,
.story-editor-area::-webkit-scrollbar-track,
.story-main::-webkit-scrollbar-track { background: transparent; }
.story-chapter-list::-webkit-scrollbar-thumb,
.story-notes-list::-webkit-scrollbar-thumb,
.story-editor-area::-webkit-scrollbar-thumb,
.story-main::-webkit-scrollbar-thumb { background: transparent; }

/* Thumb visible au scroll */
.story-chapter-list.scrolling,
.story-notes-list.scrolling,
.story-editor-area.scrolling,
.story-main.scrolling { scrollbar-color: #00000024 transparent; }
.story-chapter-list.scrolling::-webkit-scrollbar-thumb,
.story-notes-list.scrolling::-webkit-scrollbar-thumb,
.story-editor-area.scrolling::-webkit-scrollbar-thumb,
.story-main.scrolling::-webkit-scrollbar-thumb { background: #00000024; border-radius: 4px; }
.story-chapter-list.scrolling::-webkit-scrollbar-thumb:hover,
.story-notes-list.scrolling::-webkit-scrollbar-thumb:hover,
.story-editor-area.scrolling::-webkit-scrollbar-thumb:hover,
.story-main.scrolling::-webkit-scrollbar-thumb:hover { background: #00000047; }

/* Dark mode: format toolbar */
.dark-mode .story-format-toolbar { background: #1e2d3d; border-bottom-color: #ffffff14; }
.dark-mode .story-format-select { background: #243447; border-color: #ffffff26; color: #ecf0f1; }
.dark-mode .story-format-btn { background: #243447; border-color: #ffffff26; color: #ecf0f1; }
.dark-mode .story-format-btn:hover { background: #2c3e50; }
.dark-mode .story-format-sep { background: #ffffff1f; }

/* Dark mode: notes panel */
.dark-mode .story-notes-panel { background: #1e2d3d; border-left-color: #ffffff1a; }
.dark-mode .story-notes-header { border-bottom-color: #d6891033; color: #ecf0f1; }
.dark-mode .story-notes-chapter-select-wrap { border-bottom-color: #d6891033; }
.dark-mode .story-notes-resize-handle:hover { background: #d6891033; }
.dark-mode .story-chapter-list.scrolling,
.dark-mode .story-notes-list.scrolling,
.dark-mode .story-editor-area.scrolling,
.dark-mode .story-main.scrolling { scrollbar-color: #ffffff33 transparent; }
.dark-mode .story-chapter-list.scrolling::-webkit-scrollbar-thumb,
.dark-mode .story-notes-list.scrolling::-webkit-scrollbar-thumb,
.dark-mode .story-editor-area.scrolling::-webkit-scrollbar-thumb,
.dark-mode .story-main.scrolling::-webkit-scrollbar-thumb { background: #ffffff33; }
.dark-mode .story-chapter-list.scrolling::-webkit-scrollbar-thumb:hover,
.dark-mode .story-notes-list.scrolling::-webkit-scrollbar-thumb:hover,
.dark-mode .story-editor-area.scrolling::-webkit-scrollbar-thumb:hover,
.dark-mode .story-main.scrolling::-webkit-scrollbar-thumb:hover { background: #ffffff59; }
.dark-mode .story-notes-section-header { background: #d6891014; border-bottom-color: #d6891033; }
.dark-mode .story-notes-item:hover { background: #d689100f; }
.dark-mode .story-notes-item.active { background: #d689101f; }
.dark-mode .story-notes-rename-input { background: #243447; color: #ecf0f1; border-color: #d68910; }
.dark-mode .story-notes-active-title { color: #c9a84c; }
.dark-mode .story-notes-textarea { color: #ecf0f1; }
.dark-mode .story-format-btn.active { background: #1e3d5e; border-color: #5dade2; color: #5dade2; }
.dark-mode .story-lyrics-modal { background: #1a2738; }
.dark-mode .story-lyrics-modal-header { border-bottom-color: #3b82f633; }
.dark-mode .story-lyrics-modal-title-input { background: #243447; color: #ecf0f1; border-color: #3b82f64c; }
.dark-mode .story-lyrics-editor { background: #243447; color: #ecf0f1; border-color: #3b82f64c; }
.dark-mode .story-lyrics-char-palette { border-top-color: #3b82f633; }
.dark-mode .story-lyrics-modal-footer { border-top-color: #3b82f633; }
.dark-mode .story-lyrics-line-neutral { color: #9aa5b4; }
.story-format-btn--spotify { color: #1db954; }
.story-format-btn--spotify:hover { background: #1db9541a; }

/* Mention de personnage — bouton + picker */
.story-format-char-mention-wrap { position: relative; display: flex; }
.story-char-mention-picker {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 16px #0000001f;
    padding: 4px;
    z-index: 200;
    min-width: 160px;
    max-height: 260px;
    overflow-y: auto;
}
.story-char-mention-picker.hidden { display: none; }
.story-char-mention-pick-btn .avatar { width: 24px; height: 24px; font-size: 11px; flex-shrink: 0; }
.story-char-mention-pick-btn .avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.story-char-mention-pick-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 5px 8px;
    background: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    text-align: left;
    color: inherit;
}
.story-char-mention-pick-btn:hover { background: #f5f0e8; }

/* Mention inline dans le texte rendu */
.story-char-ref {
    position: relative;
    display: inline;
    cursor: default;
}
.story-char-ref-tooltip {
    display: none;
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 16px #00000024;
    padding: 8px 10px;
    z-index: 100;
    align-items: center;
    gap: 8px;
    min-width: max-content;
    text-decoration: none;
    color: inherit;
    animation: tooltip-in 0.12s ease;
}
@keyframes tooltip-in {
    from { opacity: 0; transform: translateX(-50%) translateY(4px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.story-char-ref-tooltip:hover { border-color: #aaa; }
.story-char-ref:hover .story-char-ref-tooltip,
.story-lyrics-char-wrap:hover .story-char-ref-tooltip { display: flex; }
.story-lyrics-char-wrap { position: relative; display: inline; }
.story-lyrics-tooltip-char { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.story-lyrics-tooltip-name { font-size: 12px; font-weight: 700; text-align: center; }
.story-lyrics-tooltip-sep { display: block; width: 1px; align-self: stretch; background: #e0e0e0; margin: 0 8px; flex-shrink: 0; }
.story-char-ref-avatar {
    width: 96px; height: 96px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 36px; font-weight: 600;
    border: 2.5px solid var(--char-color, #888);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--char-color, #888) 20%, transparent);
}
.story-char-ref-avatar img { width: 100%; height: 100%; object-fit: cover; }
.story-char-ref-info { display: flex; flex-direction: column; gap: 2px; }
.story-char-ref-name { font-size: 13px; font-weight: 700; }
.story-char-ref-desc { font-size: 12px; color: #666; max-width: 320px; white-space: normal; line-height: 1.3; }

.dark-mode .story-char-mention-picker { background: #1e2d3d; border-color: #2c3e50; }
.dark-mode .story-char-mention-pick-btn:hover { background: #243447; }
.dark-mode .story-char-ref-tooltip { background: #1e2d3d; border-color: #2c3e50; }
.dark-mode .story-char-ref-desc { color: #8899aa; }

/* Lyrics block */
.story-lyrics-block {
    border: 1px solid #3b82f666;
    border-radius: 8px;
    overflow: visible;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}
.story-lyrics-title {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: #3b82f612;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    color: #1a6fb5;
    user-select: none;
    list-style: none;
    border-radius: 8px 8px 0 0;
}
.story-lyrics-title::-webkit-details-marker { display: none; }
.story-lyrics-title::before { content: '▶'; font-size: 9px; transition: transform 0.18s; flex-shrink: 0; }
details[open] > .story-lyrics-title::before { transform: rotate(90deg); }
.story-lyrics-title:hover { background: #3b82f621; }
.story-lyrics-section { padding: 6px 16px 10px; }
.story-lyrics-section + .story-lyrics-section { border-top: 1px solid #3b82f626; }
.story-lyrics-char {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: #3b82f6;
    margin-bottom: 5px;
}
.story-lyrics-lines {
    font-size: 14px;
    line-height: 1.7;
    color: #555;
    font-style: italic;
}

.story-lyrics-collapse-btn {
    display: none;
    width: 100%;
    background: none;
    border: none;
    border-top: 1px solid #3b82f626;
    padding: 6px 0;
    color: #3b82f6;
    font-size: 12px;
    cursor: pointer;
    border-radius: 0 0 8px 8px;
}
.story-lyrics-collapse-btn:hover { background: #3b82f612; }
details[open] .story-lyrics-collapse-btn { display: block; }

/* Colored lines in read mode */
.story-lyrics-content { padding: 6px 14px 10px; }
.story-lyrics-line-colored {
    font-size: 14px;
    line-height: 1.75;
    font-style: italic;
    font-weight: 500;
}
.story-lyrics-seg-gradient {
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-style: italic;
}
.story-lyrics-line-neutral {
    font-size: 14px;
    line-height: 1.75;
    font-style: italic;
    color: #555;
}

/* ── Lyrics editor modal ── */
.story-lyrics-modal-overlay {
    position: fixed; inset: 0;
    background: #00000080;
    z-index: 1020;
    display: flex; align-items: center; justify-content: center;
}
.story-lyrics-modal-overlay.hidden { display: none; }
.story-lyrics-modal {
    background: #fff; border-radius: 12px;
    width: 560px; max-width: 95vw;
    max-height: 84vh; display: flex; flex-direction: column;
    box-shadow: 0 8px 40px #00000038;
}
.story-lyrics-modal-header {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 18px; border-bottom: 1px solid #dbeafe;
    font-weight: 600; color: #1a6fb5; font-size: 15px;
}
.story-lyrics-modal-header span { flex: 1; }
.story-lyrics-modal-close {
    background: none; border: none; cursor: pointer;
    font-size: 18px; color: #aaa; padding: 2px 4px; line-height: 1;
}
.story-lyrics-modal-close:hover { color: #555; }
.story-lyrics-modal-title-input {
    margin: 12px 18px 0; padding: 8px 12px;
    border: 1px solid #bfdbfe; border-radius: 6px;
    font-size: 14px; width: calc(100% - 36px); box-sizing: border-box;
}
.story-lyrics-modal-title-input:focus { outline: none; border-color: #3b82f6; }
.story-lyrics-modal-body {
    flex: 1; overflow-y: auto; padding: 10px 18px 0;
    display: flex; flex-direction: column; gap: 6px;
}
/* Contenteditable lyrics editor */
.story-lyrics-editor {
    min-height: 160px; padding: 10px 14px;
    border: 1px solid #bfdbfe; border-radius: 6px;
    font-size: 14px; font-style: italic; color: #333;
    outline: none; line-height: 1.85; cursor: text;
    overflow-y: auto; white-space: pre-wrap;
}
.story-lyrics-editor:focus { border-color: #3b82f6; }
.story-lyrics-editor:empty::before {
    content: attr(placeholder); color: #ccc; pointer-events: none;
}
.story-lyrics-editor [data-chars] {
    border-radius: 3px; padding: 1px 3px; cursor: pointer;
}
.story-lyrics-editor-hint {
    font-size: 12px; color: #bbb; margin: 0 0 6px; font-style: italic;
}
.story-lyrics-char-palette {
    display: flex; flex-wrap: wrap; gap: 8px;
    padding: 12px 18px; border-top: 1px solid #dbeafe; align-items: center;
}
.story-lyrics-char-palette-label {
    width: 100%; font-size: 11px; font-weight: 700;
    text-transform: uppercase; color: #bbb; letter-spacing: 0.06em;
}
.story-lyrics-char-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 12px; border-radius: 20px; border: 2px solid;
    cursor: pointer; font-size: 13px; font-weight: 500;
    transition: background 0.13s, color 0.13s; user-select: none;
}
.story-lyrics-char-chip .chip-dot {
    width: 9px; height: 9px; border-radius: 50%;
    flex-shrink: 0; background: currentColor;
}
.story-lyrics-char-chip.active .chip-dot { background: #fff; }
.story-lyrics-modal-footer {
    display: flex; justify-content: flex-end; gap: 8px;
    padding: 12px 18px; border-top: 1px solid #dbeafe;
}

/* ── Ornament icon picker ── */
.ornament-type-tabs {
    display: flex; gap: 0; border-bottom: 1px solid #e5e7eb; margin-bottom: 10px;
}
.ornament-type-tab {
    padding: 6px 14px; font-size: 13px; font-weight: 500;
    color: #888; background: none; border: none; border-bottom: 2px solid transparent;
    cursor: pointer; margin-bottom: -1px; transition: color 0.15s, border-color 0.15s;
}
.ornament-type-tab:hover { color: #555; }
.ornament-type-tab.active { color: #3b82f6; border-bottom-color: #3b82f6; }
.ornament-tab-content.hidden { display: none; }
.ornament-icon-picker { display: flex; flex-direction: column; gap: 8px; }
.ornament-icon-search {
    width: 100%; padding: 6px 10px; border: 1px solid #d1d5db;
    border-radius: 6px; font-size: 13px; outline: none;
}
.ornament-icon-search:focus { border-color: #3b82f6; }
.ornament-icon-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(34px, 1fr));
    gap: 4px; max-height: 220px; overflow-y: auto;
    border: 1px solid #e5e7eb; border-radius: 6px; padding: 6px;
}
.ornament-icon-item {
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; width: 32px; height: 32px; border-radius: 6px;
    cursor: pointer; border: 2px solid transparent;
    transition: background 0.12s, border-color 0.12s;
    background: none;
}
.ornament-icon-item:hover { background: #f0f4ff; }
.ornament-icon-item.selected { border-color: #3b82f6; background: #eff6ff; }
.ornament-color-row {
    display: flex; align-items: center; gap: 8px; font-size: 13px;
}
.ornament-color-row label { color: #555; }

/* Ornament display in read mode */
.story-read-chapter-ornament-icon {
    font-size: 2rem; line-height: 1; display: block;
    text-align: center; margin: 4px auto;
}

/* Spotify embed in read mode */
.story-spotify-embed {
    margin: 16px auto;
    max-width: 600px;
    border-radius: 12px;
    overflow: hidden;
    line-height: 0;
}

/* ── Tailles vêtements ── */
.size-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}
.size-group:last-child { border-bottom: none; }

.size-group-name {
    font-weight: 600;
    font-size: 14px;
    width: 120px;
    flex-shrink: 0;
}

.size-variants-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    flex: 1;
}

.size-variant {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 4px 8px;
    font-size: 13px;
}

.size-variant-actions {
    display: flex;
    gap: 2px;
    margin-left: 2px;
}

.size-variant-edit-area {
    flex-basis: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 8px 0 4px;
    border-top: 1px dashed #e0e0e0;
    margin-top: 2px;
}

.size-gender-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
    white-space: nowrap;
}
.size-gender-women  { background: #fce4ec; color: #c2185b; }
.size-gender-men    { background: #e3f2fd; color: #1565c0; }
.size-gender-unisex { background: #f3e5f5; color: #6a1b9a; }

.size-value-eu,
.size-value-us {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
}
.size-value-empty { color: #aaa; }

.size-system-tag {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: #888;
    background: #f0f0f0;
    padding: 1px 4px;
    border-radius: 3px;
}

.size-comment-icon {
    font-size: 11px;
    color: #bbb;
    cursor: default;
}

.size-edit-comment-input {
    flex: 1;
    min-width: 120px;
}

.size-add-form {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 10px 0 4px;
    border-top: 1px dashed #e0e0e0;
    margin-top: 8px;
}

/* ── Mensurations ── */
.measurements-layout {
    display: flex;
    gap: 32px;
    align-items: flex-start;
}

.body-diagram {
    width: 100px;
    flex-shrink: 0;
    color: #bbb;
    opacity: 0.7;
}

.measurements-grid {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.measurement-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 0;
    border-bottom: 1px solid #f5f5f5;
}
.measurement-row:last-child { border-bottom: none; }

.measurement-label {
    width: 160px;
    font-size: 13px;
    color: #555;
    flex-shrink: 0;
}

.measurement-display {
    font-size: 14px;
    min-width: 60px;
}

.measurement-edit {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Dark mode — tailles */
.dark-mode .size-group { border-bottom-color: #2a2a3a; }
.dark-mode .size-variant { background: #1e1e2e; border-color: #2a2a3a; }
.dark-mode .size-gender-women  { background: #4a1428; color: #f48fb1; }
.dark-mode .size-gender-men    { background: #0d2744; color: #90caf9; }
.dark-mode .size-gender-unisex { background: #2d1b3d; color: #ce93d8; }
.dark-mode .size-system-tag { background: #2a2a3a; color: #888; }
.dark-mode .size-value-empty { color: #555; }
.dark-mode .size-comment-icon { color: #4a5568; }

/* ── Measurement info dialog ── */
.measurement-info-btn {
    background: none;
    border: none;
    color: #aaa;
    cursor: pointer;
    font-size: 14px;
    padding: 0;
    line-height: 1;
    transition: color 0.15s;
}
.measurement-info-btn:hover { color: #3498db; }

.measurement-info-dialog {
    border: none;
    border-radius: 12px;
    padding: 0;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 8px 32px #00000026;
}
.measurement-info-dialog::backdrop {
    background: #00000040;
}
.measurement-info-dialog-inner {
    padding: 20px 24px;
}
.measurement-info-dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.measurement-info-close {
    background: none;
    border: none;
    font-size: 16px;
    color: #aaa;
    cursor: pointer;
    padding: 0 2px;
    transition: color 0.15s;
}
.measurement-info-close:hover { color: #555; }

.measurement-info-list {
    margin: 0;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 6px 12px;
    align-items: baseline;
}
.measurement-info-list dt {
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
    color: #555;
    display: flex;
    align-items: center;
    gap: 6px;
}
.measurement-info-list dt i {
    color: #3498db;
    width: 12px;
    text-align: center;
    font-size: 11px;
}
.measurement-info-list dd {
    margin: 0;
    font-size: 13px;
    color: #777;
    line-height: 1.4;
}

.dark-mode .measurement-info-dialog {
    background: #1e1e2e;
    color: #e0e0e0;
}
.dark-mode .measurement-info-list dt { color: #bdc3c7; }
.dark-mode .measurement-info-list dd { color: #7f8c9a; }
.dark-mode .measurement-info-close:hover { color: #ccc; }
.dark-mode .size-add-form { border-top-color: #2a2a3a; }
.dark-mode .size-variant-edit-area { border-top-color: #2a2a3a; }
.dark-mode .body-diagram { color: #4a5568; }
.dark-mode .measurement-label { color: #9aa0aa; }
.dark-mode .measurement-row { border-bottom-color: #1e1e2e; }

/* Responsive mensurations */
@media (max-width: 600px) {
    .measurements-layout { flex-direction: column; }
    .body-diagram { display: none; }
    .measurement-label { width: 120px; }
}

/* ── Story : responsive mobile (doit être après tout le CSS story) ── */
/* Tablette + mobile : panneaux en overlay, boutons toggle visibles */
@media (max-width: 1280px) {
    .story-sidebar {
        display: none;
        position: fixed; left: 0; top: 0; bottom: 0;
        width: 85vw; max-width: 320px;
        z-index: 1003;
        box-shadow: 4px 0 24px #0000002e;
    }
    .story-sidebar.mobile-open { display: flex; }
    .story-sidebar-tab { display: none; }

    .story-notes-panel {
        display: none;
        position: fixed; right: 0; top: 0; bottom: 0;
        width: 85vw; max-width: 320px;
        flex-direction: column;
        z-index: 1003;
        box-shadow: -4px 0 24px #0000002e;
    }
    .story-notes-panel.mobile-open { display: flex; }
    .story-notes-tab { display: none; }
    .story-notes-resize-handle { display: none; }
    .story-notes-content { width: 100%; min-width: 0; }

    .story-mobile-panel-btn { display: inline-flex; }
    .story-mobile-close-btn { display: block; }

    /* Tooltips personnages — bottom sheet sur écran tactile */
    .story-char-ref-tooltip,
    .story-lyrics-char-wrap .story-char-ref-tooltip {
        position: fixed;
        bottom: 16px;
        left: 12px;
        right: 12px;
        top: auto;
        transform: none;
        max-width: none;
        min-width: 0;
        flex-wrap: wrap;
        gap: 12px;
        z-index: 1050;
    }
    .story-char-ref-desc { max-width: none; }

    .story-sep-img-popover {
        position: fixed;
        top: 50%;
        left: 50%;
        right: auto;
        transform: translate(-50%, -50%);
        min-width: 240px;
        max-width: calc(100vw - 32px);
    }
}

/* Mobile uniquement : layout colonne et ajustements de taille */
@media (max-width: 768px) {
    .story-layout { flex-direction: column; }
    .story-main { width: 100%; }
    .story-editor-area { padding: 16px; }
    .story-read-mode .story-editor-area { padding: 20px; }
    .story-toolbar { padding: 10px 12px; }
    .story-format-toolbar { padding: 4px 10px; gap: 3px; }
    .story-spotify-embed { max-width: 100%; }
    .story-lyrics-block { overflow: hidden; }
}

/* ── Shopping ─────────────────────────────────────────────────────────────── */

.shopping-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 24px;
    align-items: start;
}

/* Panels */
.shopping-lists-panel {
    background: transparent;
}
.shopping-catalog-panel {
    background: transparent;
}

.shopping-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid #e8eaed;
    font-weight: 600;
    font-size: 15px;
}

/* New-list form */
.shopping-new-list-form {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid #e8eaed;
    background: #fafafa;
}
.shopping-new-list-form input {
    flex: 1;
    padding: 7px 10px;
    border: 1px solid #d0d4da;
    border-radius: 6px;
    font-size: 14px;
}

/* Shopping list item */
.shopping-lists-header-card {
    margin-bottom: 10px;
}
#shopping-lists-container {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.shopping-list-item {
    overflow: hidden;
}
.shopping-list-item-header {
    border: 1px solid #d6e4f7;
    border-left: 4px solid #a8cff0;
    border-radius: 6px;
    background: white;
    transition: border-color 0.15s, box-shadow 0.15s;
    overflow: hidden;
}
.shopping-list-item.active .shopping-list-item-header {
    border-color: #3498db;
    border-left-color: #3498db;
    background: #f0f7ff;
    box-shadow: 0 2px 6px #3498db22;
}

.shopping-list-item-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding-right: 10px;
}

.shopping-list-select-btn {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 16px;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    font-size: 14px;
    color: inherit;
    min-width: 0;
}
.shopping-list-select-btn:hover { background: #f0f4ff; }
.shopping-list-item.active .shopping-list-select-btn { color: #1a6fbb; }

.shopping-list-name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.shopping-list-count {
    display: inline-flex;
    align-items: center;
    background: #e8eaed;
    border-radius: 10px;
    padding: 1px 7px;
    font-size: 12px;
    font-weight: 600;
    color: #555;
    flex-shrink: 0;
}
.shopping-list-count.done { background: #d4edda; color: #276b3a; }

/* Entries panel */
.shopping-list-entries {
    background: white;
    border-radius: 0 0 6px 6px;
    padding: 0 0 4px 0;
    margin-top: 4px;
}

.shopping-entry {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 16px;
    font-size: 14px;
}
.shopping-entry:hover { background: #fafbfc; }

.shopping-entry-check-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.shopping-entry-check-wrap input[type="checkbox"] {
    width: 17px;
    height: 17px;
    cursor: pointer;
    accent-color: #3498db;
}

.shopping-entry-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.shopping-entry.is-checked .shopping-entry-name,
.shopping-entry.is-checked .shopping-entry-format {
    text-decoration: line-through;
    font-style: italic;
    color: #aaa;
}

.shopping-entry-format {
    font-size: 12px;
    color: #888;
    white-space: nowrap;
    flex-shrink: 0;
}

.shopping-entry-actions {
    display: flex;
    align-items: stretch;
    gap: 4px;
    flex-shrink: 0;
}

.shopping-entry-qty {
    display: flex;
    align-items: stretch;
    gap: 0;
    border: 1px solid #d0d4da;
    border-radius: 6px;
    overflow: hidden;
}

.shopping-qty-btn {
    width: 26px;
    background: #f5f7fa;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #555;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.shopping-qty-btn:hover { background: #e8eaed; }

.shopping-entry-qty span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    font-size: 13px;
    font-weight: 600;
    border-left: 1px solid #d0d4da;
    border-right: 1px solid #d0d4da;
    padding: 0 4px;
}

/* Add entry row + list actions */
.shopping-entry-add-row {
    display: flex;
    align-items: stretch;
    gap: 8px;
    padding: 8px 16px 4px;
}
.shopping-entry-add-row input {
    flex: 1;
    padding: 7px 10px;
    border: 1px solid #d0d4da;
    border-radius: 6px;
    font-size: 14px;
}

.shopping-list-actions {
    display: flex;
    align-items: stretch;
    gap: 8px;
    padding: 6px 16px 4px;
}

/* ── View mode (default): hide edit-only elements ── */
.shopping-list-entries:not(.edit-mode) .shopping-qty-btn { display: none; }
.shopping-list-entries:not(.edit-mode) .entry-delete-btn { display: none; }
.shopping-list-entries:not(.edit-mode) .shopping-entry-brand-row { display: none; }
.shopping-list-entries:not(.edit-mode) .shopping-entry-add-row { display: none; }
.shopping-list-entries:not(.edit-mode) .shopping-import-btn { display: none; }
.shopping-list-entries:not(.edit-mode) .shopping-clear-btn { display: none; }

/* ── View mode: card layout per entry (like .list-item) ── */
.shopping-list-entries:not(.edit-mode) {
    padding: 10px 12px 8px;
}
.shopping-list-entries:not(.edit-mode) .shopping-entry {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    margin-bottom: 8px;
    padding: 10px 14px;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
}
.shopping-list-entries:not(.edit-mode) .shopping-entry:hover { background: #f8f9fa; }
.shopping-list-entries:not(.edit-mode) .shopping-entry.is-checked {
    background: #f5f5f5;
    border-color: #d0d0d0;
    opacity: 0.75;
}
.shopping-list-entries:not(.edit-mode) .shopping-entry-main {
    display: flex;
    align-items: center;
    gap: 10px;
}
/* Dissolve the label so its children become direct flex items */
.shopping-list-entries:not(.edit-mode) .shopping-entry-check-wrap {
    display: contents;
}
/* Order: 1=checkbox, 2=qty, 3=name, 4=image/badge */
.shopping-list-entries:not(.edit-mode) .shopping-entry-check-wrap input[type="checkbox"] {
    order: 1;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    cursor: pointer;
}
.shopping-list-entries:not(.edit-mode) .shopping-entry-actions {
    order: 2;
    flex-shrink: 0;
}
.shopping-list-entries:not(.edit-mode) .shopping-entry-name {
    order: 3;
    flex: 1;
    font-size: 15px;
    font-weight: 500;
}
.shopping-list-entries:not(.edit-mode) .shopping-entry-thumb {
    order: 4;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
}
.shopping-list-entries:not(.edit-mode) .shopping-entry-format-badge { order: 4; }
.shopping-list-entries:not(.edit-mode) .shopping-qty-value {
    font-weight: 600;
    font-size: 13px;
    color: #666;
    min-width: 20px;
    text-align: center;
}
.shopping-list-entries:not(.edit-mode) .shopping-entry-name {
    font-size: 15px;
    font-weight: 500;
}
.shopping-list-entries:not(.edit-mode) .shopping-entry-check-wrap {
    gap: 10px;
}
.shopping-list-entries:not(.edit-mode) .shopping-entry-check-wrap input[type="checkbox"] {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    cursor: pointer;
}

/* Edit mode button in list header */
.shopping-edit-mode-btn { color: white !important; }

.shopping-import-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #f5f7fa;
    border: 1px solid #d0d4da;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    color: inherit;
}
.shopping-import-btn:hover { background: #eef3ff; border-color: #3498db; color: #3498db; }

/* Import dialog rows */
.shopping-import-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #f0f2f5;
    cursor: pointer;
}
.shopping-import-row:last-child { border-bottom: none; }
.shopping-import-row input[type="checkbox"] { accent-color: #3498db; width: 16px; height: 16px; flex-shrink: 0; }
.shopping-import-name { font-size: 14px; flex: 1; min-width: 0; }
.shopping-import-meta { font-size: 12px; color: #888; }

/* Catalog item */
.catalog-item {
    border-bottom: 1px solid #f0f2f5;
    padding: 10px 16px;
}
.catalog-item:last-child { border-bottom: none; }

.catalog-item-view {
    display: flex;
    align-items: center;
    gap: 10px;
}

.catalog-item-photo {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
    border: 1px solid #e8eaed;
}

.catalog-item-photo-placeholder {
    width: 44px;
    height: 44px;
    border-radius: 6px;
    background: #f0f2f5;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #bbb;
    font-size: 18px;
    flex-shrink: 0;
}

.catalog-item-info {
    flex: 1;
    min-width: 0;
}

.catalog-item-name {
    font-weight: 500;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.catalog-item-meta {
    display: flex;
    gap: 8px;
    margin-top: 2px;
}

.catalog-item-brand,
.catalog-item-format {
    font-size: 12px;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.catalog-item-actions {
    display: flex;
    align-items: stretch;
    gap: 4px;
    flex-shrink: 0;
}

/* Photo upload label */
.shopping-photo-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    background: #f5f7fa;
    border: 1px solid #d0d4da;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap;
}
.shopping-photo-label:hover { background: #eef3ff; border-color: #3498db; }
.shopping-photo-label input { display: none; }

/* Catalog form bodies */
.catalog-form-photo-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.catalog-photo-preview { display: flex; align-items: center; gap: 6px; }
.catalog-photo-thumb { height: 36px; border-radius: 4px; object-fit: cover; }
.catalog-form-actions { display: flex; justify-content: flex-end; gap: 6px; }
.catalog-textarea { resize: vertical; }
.catalog-form-body { display: flex; flex-direction: column; gap: 8px; padding: 12px 16px; border-bottom: 1px solid #e8eaed; }
.catalog-form-body .form-label { margin-bottom: 2px; font-size: 12px; }
.catalog-form-body .profile-meta-input { width: 100%; }
.catalog-edit-body { display: flex; flex-direction: column; gap: 8px; padding: 8px 0; }
.catalog-edit-body .form-label { margin-bottom: 2px; font-size: 12px; }
.catalog-edit-body .profile-meta-input { width: 100%; }

/* Catalog add form */
.catalog-add-form {
    padding: 12px 16px;
    border-bottom: 1px solid #e8eaed;
    background: #fafafa;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.catalog-add-form input[type="text"] {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid #d0d4da;
    border-radius: 6px;
    font-size: 14px;
}
.catalog-add-form-row {
    display: flex;
    align-items: stretch;
    gap: 8px;
}
.catalog-add-form-row input[type="text"] {
    flex: 1;
}

/* Dark mode */
.dark-mode .shopping-lists-panel,
.dark-mode .shopping-catalog-panel {
    background: transparent;
}
.dark-mode .shopping-panel-header { border-bottom-color: #2a2a3a; }
.dark-mode .shopping-new-list-form { background: #1e1e2e; border-bottom-color: #2a2a3a; }
.dark-mode .shopping-new-list-form input { background: #2a2a3a; border-color: #3a3a4a; color: #e0e0e0; }
.dark-mode .shopping-list-item-header { border-color: #1e3050; border-left-color: #2a5580; background: #1a1a2e; }
.dark-mode .shopping-list-item.active .shopping-list-item-header { background: #111a2e; border-color: #4a9de0; border-left-color: #4a9de0; box-shadow: 0 2px 6px #4a9de022; }
.dark-mode .shopping-list-select-btn:hover { background: #1a2a3a; }
.dark-mode .shopping-list-item.active .shopping-list-select-btn { color: #7ab8e8; }
.dark-mode .shopping-list-entries { border-top-color: #1a3a5a; background: #0e1520; }
.dark-mode .shopping-list-count { background: #2a2a3a; color: #9aa0aa; }
.dark-mode .shopping-list-count.done { background: #1a3a2a; color: #5db87a; }
.dark-mode .shopping-list-entries { border-top-color: #2a2a3a; }
.dark-mode .shopping-entry:hover { background: #2a2a3a; }
.dark-mode .shopping-entry-format { color: #666; }
.dark-mode .shopping-entry-qty { border-color: #3a3a4a; }
.dark-mode .shopping-qty-btn { background: #2a2a3a; color: #9aa0aa; }
.dark-mode .shopping-qty-btn:hover { background: #333345; }
.dark-mode .shopping-entry-qty span { border-color: #3a3a4a; }
.dark-mode .shopping-entry-add-row input { background: #2a2a3a; border-color: #3a3a4a; color: #e0e0e0; }
.dark-mode .shopping-import-btn { background: #2a2a3a; border-color: #3a3a4a; color: #9aa0aa; }
.dark-mode .shopping-import-btn:hover { background: #1a2a4a; border-color: #3498db; color: #3498db; }
.dark-mode .shopping-import-row { border-bottom-color: #2a2a3a; }
.dark-mode .shopping-import-meta { color: #666; }
.dark-mode .catalog-item { border-bottom-color: #2a2a3a; }
.dark-mode .catalog-item-photo-placeholder { background: #2a2a3a; color: #555; }
.dark-mode .catalog-item-photo { border-color: #3a3a4a; }
.dark-mode .catalog-item-brand,
.dark-mode .catalog-item-format { color: #666; }
.dark-mode .shopping-photo-label { background: #2a2a3a; border-color: #3a3a4a; color: #9aa0aa; }
.dark-mode .shopping-photo-label:hover { background: #1a2a4a; border-color: #3498db; }
.dark-mode .catalog-add-form { background: #1e1e2e; border-bottom-color: #2a2a3a; }
.dark-mode .catalog-add-form input[type="text"] { background: #2a2a3a; border-color: #3a3a4a; color: #e0e0e0; }

/* Responsive shopping */
@media (max-width: 820px) {
    .shopping-layout { grid-template-columns: 1fr; }
}

/* ── Shopping : format tags input ────────────────────────────────────────── */
.shopping-formats-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    border: 1px solid #d0d4da;
    border-radius: 6px;
    padding: 4px 8px;
    min-height: 36px;
    background: #fff;
    cursor: text;
}

.shopping-format-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #e8f0fe;
    color: #2a5bd7;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.shopping-format-tag-remove {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    color: #2a5bd7;
    font-size: 11px;
    display: flex;
    align-items: center;
    opacity: 0.6;
}
.shopping-format-tag-remove:hover { opacity: 1; }

.shopping-format-input {
    border: none !important;
    outline: none !important;
    padding: 0 !important;
    background: transparent !important;
    font-size: 13px;
    min-width: 120px;
}

.shopping-import-format-select {
    margin-left: auto;
    flex-shrink: 0;
    padding: 3px 6px;
    border: 1px solid #d0d4da;
    border-radius: 5px;
    font-size: 12px;
    background: #fff;
    color: inherit;
}

.dark-mode .shopping-formats-row { background: #2a2a3a; border-color: #3a3a4a; }
.dark-mode .shopping-format-tag { background: #1a2a4a; color: #7ab3f5; }
.dark-mode .shopping-format-tag-remove { color: #7ab3f5; }
.dark-mode .shopping-import-format-select { background: #2a2a3a; border-color: #3a3a4a; color: #e0e0e0; }

/* ── Shopping : format badge & brand row ─────────────────────────────────── */
.shopping-entry-main {
    display: flex;
    align-items: center;
    gap: 8px;
}
.shopping-entry-main .shopping-entry-check-wrap { flex: 1; min-width: 0; }
.shopping-entry-main .shopping-entry-actions { flex-shrink: 0; }

.shopping-entry-format-badge {
    display: inline-flex;
    align-items: center;
    background: #e8f4fd;
    color: #1a6fa8;
    border: 1px solid #b3d9f5;
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.shopping-entry.is-checked .shopping-entry-format-badge {
    background: #f0f0f0;
    color: #aaa;
    border-color: #ddd;
}

.shopping-entry-brand-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 0 3px 26px;
    font-size: 12px;
    color: #666;
    cursor: pointer;
}
.shopping-entry-brand-row input[type="checkbox"] {
    accent-color: #e67e22;
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    cursor: pointer;
}
.shopping-entry-brand-row input:checked ~ span { color: #e67e22; font-weight: 600; }

.dark-mode .shopping-entry-format-badge {
    background: #1a2d3a;
    color: #5aaddf;
    border-color: #2a4a5a;
}
.dark-mode .shopping-entry.is-checked .shopping-entry-format-badge {
    background: #2a2a3a;
    color: #555;
    border-color: #333;
}
.dark-mode .shopping-entry-brand-row { color: #777; }
.dark-mode .shopping-entry-brand-row input:checked ~ span { color: #c87941; }

/* ── Shopping : commentaires ─────────────────────────────────────────────── */
.catalog-item-comment {
    display: block;
    font-size: 12px;
    font-style: italic;
    color: #888;
    margin-top: 2px;
    line-height: 1.4;
}

.shopping-entry-comment-row {
    padding: 2px 0 4px 26px;
    min-height: 20px;
}

.shopping-entry-comment-text {
    display: block;
    font-size: 12px;
    font-style: italic;
    color: #888;
    cursor: pointer;
    line-height: 1.4;
}
.shopping-entry-comment-text:hover { color: #555; text-decoration: underline dotted; }

.shopping-entry-comment-add {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 11px;
    color: #bbb;
    padding: 0;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.shopping-entry-comment-add:hover { color: #888; }

.shopping-entry-comment-input {
    width: 100%;
    padding: 3px 6px;
    border: 1px solid #d0d4da;
    border-radius: 5px;
    font-size: 12px;
    font-style: italic;
}

.dark-mode .catalog-item-comment { color: #666; }
.dark-mode .shopping-entry-comment-text { color: #666; }
.dark-mode .shopping-entry-comment-text:hover { color: #999; }
.dark-mode .shopping-entry-comment-add { color: #444; }
.dark-mode .shopping-entry-comment-add:hover { color: #777; }
.dark-mode .shopping-entry-comment-input { background: #2a2a3a; border-color: #3a3a4a; color: #e0e0e0; }

/* ── Shopping : miniature et lightbox ───────────────────────────────────── */
.shopping-entry-thumb {
    width: 36px;
    height: 36px;
    object-fit: cover;
    border-radius: 5px;
    flex-shrink: 0;
    cursor: zoom-in;
    border: 1px solid #e0e0e0;
    transition: opacity 0.15s;
}
.shopping-entry-thumb:hover { opacity: 0.85; }
.shopping-entry.is-checked .shopping-entry-thumb { opacity: 0.4; }

.photo-lightbox-dialog {
    border: none;
    background: transparent;
    padding: 0;
    max-width: 90vw;
    max-height: 90vh;
    outline: none;
}
.photo-lightbox-dialog::backdrop {
    background: #000000cc;
}
.photo-lightbox-dialog img {
    display: block;
    max-width: 90vw;
    max-height: 88vh;
    border-radius: 8px;
    object-fit: contain;
}
.photo-lightbox-close {
    position: fixed;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #ffffffcc;
    border: none;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
}
.photo-lightbox-close:hover { background: #fff; }

.shopping-import-select-all-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0 8px;
    border-bottom: 2px solid #d0d4da;
    margin-bottom: 4px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
}
.shopping-import-select-all-row input[type="checkbox"] {
    accent-color: #3498db;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    cursor: pointer;
}
.dark-mode .shopping-import-select-all-row { border-bottom-color: #3a3a4a; }

/* ── Course feature ──────────────────────────────────────────────────────── */

/* Folder grid (index page) */
.course-folders-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}
.course-folder-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 0;
    padding: 0;
    overflow: hidden;
    transition: box-shadow .15s;
}
.course-folder-card:hover { box-shadow: 0 4px 14px #d8d8d8; }
.course-folder-link {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    padding: 16px;
    text-decoration: none;
    color: inherit;
    min-width: 0;
}
.course-folder-icon { font-size: 1.8rem; color: #8e44ad; flex-shrink: 0; }
.course-folder-info { display: flex; flex-direction: column; min-width: 0; }
.course-folder-name { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.course-folder-meta { font-size: 12px; margin-top: 2px; }
.course-folder-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px 10px 8px 4px;
    flex-shrink: 0;
}

/* 3-column layout */
.course-layout {
    display: flex;
    height: 100vh;
    gap: 0;
    overflow: hidden;
}

/* Sidebar */
.course-sidebar {
    width: 240px;
    min-width: 240px;
    background: #f7f7fb;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
}
.course-sidebar-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 12px;
    border-bottom: 1px solid #e0e0e0;
    font-weight: 600;
    font-size: 14px;
}
.course-back-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    color: #555;
    text-decoration: none;
    flex-shrink: 0;
    transition: background .15s;
}
.course-back-link:hover { background: #e0e0e0; color: #222; }
.course-folder-title { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.course-chapters-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}
.course-chapter-item {
    display: flex;
    align-items: center;
    padding: 0 6px;
    border-radius: 6px;
    margin: 0 6px;
    transition: background .1s;
    cursor: grab;
}
.course-chapter-item.active { background: #ede6f5; }
.course-chapter-item:hover { background: #eee; }
.course-chapter-item.active:hover { background: #e0d5f0; }
.course-chapter-item.dragging { opacity: .4; }
.course-chapter-item.drag-over { border-top: 2px solid #8e44ad; }
.course-chapter-btn {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    padding: 8px 4px;
    font-size: 13px;
    color: #333;
    min-width: 0;
}
.course-drag-handle { color: #ccc; font-size: 11px; flex-shrink: 0; }
.course-chapter-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.course-chapter-delete {
    background: none;
    border: none;
    cursor: pointer;
    color: #ccc;
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 12px;
    flex-shrink: 0;
    transition: color .1s;
}
.course-chapter-delete:hover { color: #e74c3c; }
.course-add-chapter-btn {
    margin: 8px;
    background: none;
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 8px;
    font-size: 13px;
    color: #888;
    cursor: pointer;
    width: calc(100% - 16px);
    transition: border-color .15s, color .15s;
}
.course-add-chapter-btn:hover { border-color: #8e44ad; color: #8e44ad; }
.course-sidebar-footer { padding: 12px; border-top: 1px solid #e0e0e0; }

/* Editor */
.course-editor-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}
.course-empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #aaa;
    font-size: 1.1rem;
    gap: 12px;
}
.course-empty-state i { font-size: 3rem; }
#course-editor-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}
.course-editor-sticky-top {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #fff;
}
.course-chapter-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px 10px;
    border-bottom: 1px solid #e8e8e8;
}
.course-chapter-title {
    flex: 1;
    font-size: 1.3rem;
    font-weight: 700;
    color: #2c3e50;
    outline: none;
    border: none;
    line-height: 1.3;
}
.course-chapter-title:empty::before { content: 'Titre du chapitre'; color: #ccc; }
.course-save-status { font-size: 12px; color: #888; flex-shrink: 0; }
.course-help-inline-btn { flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%; border: none; background: #2980b9; color: #fff; font-size: 12px; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; opacity: .7; transition: opacity .15s; }
.course-help-inline-btn:hover { opacity: 1; }

.course-help-overlay { position: fixed; inset: 0; background: #0007; z-index: 1200; display: flex; align-items: center; justify-content: center; padding: 20px; }
.course-help-modal { background: #fff; border-radius: 12px; width: min(960px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; box-shadow: 0 12px 48px #0004; }
.course-help-modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid #e0e0e0; flex-shrink: 0; font-weight: 700; font-size: 16px; }
.course-help-modal-close { background: none; border: none; cursor: pointer; font-size: 18px; color: #666; display: flex; align-items: center; }
.course-help-modal-close:hover { color: #e74c3c; }
.course-help-tabs { display: flex; border-bottom: 2px solid #e0e0e0; flex-shrink: 0; }
.course-help-tab { flex: 1; padding: 12px 8px; border: none; background: none; cursor: pointer; font-size: 14px; font-weight: 600; color: #666; display: flex; align-items: center; justify-content: center; gap: 6px; border-bottom: 3px solid transparent; margin-bottom: -2px; transition: color .15s, border-color .15s; }
.course-help-tab:hover { color: #2980b9; }
.course-help-tab.active { color: #2980b9; border-bottom-color: #2980b9; }
.course-help-body { flex: 1; overflow-y: auto; padding: 20px; }
.course-help-pane .tuto-card { box-shadow: none; border: none; padding: 0; margin-bottom: 0; }

@media (max-width: 768px) {
    .course-help-tabs { flex-direction: column; }
    .course-help-tab { border-bottom: none; border-left: 3px solid transparent; justify-content: flex-start; padding-left: 16px; }
    .course-help-tab.active { border-left-color: #2980b9; border-bottom-color: transparent; }
}

.dark-mode .course-help-modal { background: #1e1e2e; }
.dark-mode .course-help-modal-header { border-bottom-color: #2a2a3a; }
.dark-mode .course-help-tabs { border-bottom-color: #2a2a3a; }
.dark-mode .course-help-tab { color: #888; }
.dark-mode .course-help-tab.active { color: #60a5fa; border-bottom-color: #60a5fa; }
.course-toolbar {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 6px 12px;
    border-bottom: 1px solid #e8e8e8;
    flex-wrap: wrap;
    background: #fafafa;
}
.course-toolbar-btn {
    background: none;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    padding: 5px 8px;
    color: #555;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .1s;
}
.course-toolbar-btn:hover { background: #e8e8e8; border-color: #d0d0d0; }
.course-toolbar-btn.uploading { position: relative; pointer-events: none; opacity: .7; }
.course-toolbar-btn.uploading::after { content: attr(data-progress); position: absolute; bottom: -18px; left: 50%; transform: translateX(-50%); font-size: 10px; white-space: nowrap; color: #8e44ad; }
.course-toolbar-sep { width: 1px; height: 20px; background: #ddd; margin: 0 4px; }
.course-content {
    flex-shrink: 0;
    min-height: 60vh;
    padding: 20px 28px;
    outline: none;
    font-size: 15px;
    line-height: 1.7;
    color: #333;
}
.course-content:empty::before { content: 'Commencez à écrire…'; color: #ccc; }
.course-content h2 { font-size: 1.3rem; color: #2c3e50; margin-top: 24px; }
.course-content h3 { font-size: 1.1rem; color: #2c3e50; margin-top: 18px; }
.course-content ul, .course-content ol { padding-left: 24px; }
.course-img { max-width: 100%; border-radius: 6px; margin-top: 8px; margin-bottom: 8px; cursor: pointer; display: block; }
.course-img.selected { outline: 2px solid #8e44ad; outline-offset: 2px; }
.media-align-center { margin-left: auto; margin-right: auto; }
.media-align-right  { margin-left: auto; margin-right: 0; }
#course-img-popover {
    position: fixed;
    z-index: 300;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 16px #00000024;
    padding: 4px;
    min-width: 220px;
}
.dark-mode #course-img-popover { background: #1e1e2e; border-color: #3a3a4a; }
.course-video-wrap { position: relative; padding-bottom: 56.25%; height: 0; margin: 12px 0; border-radius: 6px; overflow: hidden; max-width: 100%; }
.course-video-wrap iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
.course-video-native { width: 100%; max-width: 100%; height: auto; border-radius: 6px; margin-top: 12px; margin-bottom: 12px; display: block; background: #000; }
.course-video-native.selected { outline: 2px solid #3498db; outline-offset: 2px; }

/* Lexicon panel */
.course-lexicon-panel {
    width: 280px;
    min-width: 280px;
    border-left: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    overflow: visible;
    background: #fff;
    position: relative;
    transition: width .2s, min-width .2s;
}
.course-lexicon-panel.collapsed { width: 0; min-width: 0; overflow: visible; }
.course-lexicon-panel.collapsed .course-lexicon-inner { display: none; }
.course-lexicon-toggle {
    position: absolute;
    left: -16px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 11px;
    color: #888;
    box-shadow: 0 1px 4px #d8d8d8;
}
.course-lexicon-toggle:hover { color: #333; }
.course-lexicon-inner {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    width: 280px;
}
.course-lexicon-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 12px 14px;
    border-bottom: 1px solid #e8e8e8;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}
.course-panel-label { display: block; font-size: 11px; font-weight: 600; color: #888; text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 2px; }
.course-panel-search { margin: 8px 14px 4px; }
.course-panel-search .search-input { font-size: 13px; }
.course-lexicon-filter--flex { flex: 1; min-width: 0; }
.course-lexicon-filter {
    font-size: 12px;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    padding: 4px 8px;
    background: #fff;
    color: #333;
    cursor: pointer;
}
.course-lexicon-entries {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}
.course-lexicon-entry {
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    margin-bottom: 6px;
    padding: 8px 10px;
    background: #fafafa;
    transition: opacity .2s;
}
.course-lexicon-entry.is-mastered { opacity: .5; }
.course-lex-term { font-weight: 600; font-size: 13px; color: #2c3e50; margin-bottom: 2px; }
.course-lex-def { font-size: 12px; color: #555; line-height: 1.4; }
.course-lex-actions { display: flex; gap: 4px; margin-top: 6px; }
.lex-mastered-btn, .lex-edit-btn, .lex-delete-btn {
    background: none;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    cursor: pointer;
    padding: 3px 7px;
    font-size: 11px;
    color: #888;
    transition: background .1s, color .1s;
}
.lex-mastered-btn:hover, .lex-mastered-btn.active { background: #d5f5e3; color: #1a7a45; border-color: #a9dfbf; }
.lex-edit-btn:hover { background: #eee; color: #333; }
.lex-delete-btn:hover { background: #fde8e8; color: #c0392b; border-color: #f5b7b1; }
.course-lex-edit { display: flex; flex-direction: column; gap: 6px; }
.course-lex-empty { font-size: 13px; padding: 8px 0; }
.course-lex-keywords {
    display: flex; flex-wrap: wrap; gap: 4px;
    margin: 4px 0 2px;
}
.course-lex-kw-tag {
    font-size: 11px; padding: 2px 7px;
    background: #ede9f8; color: #6c3db0;
    border-radius: 10px; border: 1px solid #c9b8ef;
    font-weight: 500;
}
.dark-mode .course-lex-kw-tag { background: #2d2040; color: #c4a8f5; border-color: #5a3e90; }
.course-lexicon-add {
    padding: 10px;
    border-top: 1px solid #e8e8e8;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}

/* Accordion sections in the right panel */
.course-panel-section {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-bottom: 1px solid #e8e8e8;
    flex-shrink: 0;
}
.course-panel-section.open {
    flex: 1;
    min-height: 0;
}
.course-panel-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    color: #444;
    transition: background .1s;
    flex-shrink: 0;
}
.course-panel-section-header:hover { background: #f5f5f5; }
.course-panel-chevron { margin-left: auto; font-size: 11px; transition: transform .2s; }
.course-panel-section.open .course-panel-chevron { transform: rotate(180deg); }
.course-panel-section-body {
    display: none;
    flex-direction: column;
    overflow: hidden;
    flex: 1;
    min-height: 0;
}
.course-panel-section.open .course-panel-section-body { display: flex; }

/* Question items in the right panel */
.course-question-entries {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}
.course-question-item {
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    margin-bottom: 6px;
    padding: 8px 10px;
    background: #fafafa;
    transition: opacity .2s;
}
.course-question-item.is-mastered { opacity: .5; }
.course-q-type-badge {
    display: inline-block;
    font-size: 10px;
    padding: 1px 6px;
    background: #ebe8f5;
    border-radius: 10px;
    color: #6c3db0;
    margin-bottom: 4px;
    font-weight: 500;
}
.course-q-question { font-weight: 600; font-size: 13px; color: #2c3e50; margin-bottom: 2px; }
.course-q-answer { font-size: 12px; color: #777; line-height: 1.4; font-style: italic; }
.course-q-actions { display: flex; gap: 4px; margin-top: 6px; }
.q-mastered-btn, .q-edit-btn, .q-delete-btn {
    background: none;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    cursor: pointer;
    padding: 3px 7px;
    font-size: 11px;
    color: #888;
    transition: background .1s, color .1s;
}
.q-mastered-btn:hover, .q-mastered-btn.active { background: #d5f5e3; color: #1a7a45; border-color: #a9dfbf; }
.q-edit-btn:hover { background: #eee; color: #333; }
.q-delete-btn:hover { background: #fde8e8; color: #c0392b; border-color: #f5b7b1; }
.course-q-edit { display: flex; flex-direction: column; gap: 6px; }
.course-q-empty { font-size: 13px; padding: 8px 0; }
.course-question-add {
    padding: 10px;
    border-top: 1px solid #e8e8e8;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}
.course-q-type-select {
    font-size: 12px;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    padding: 4px 8px;
    background: #fff;
    color: #333;
    cursor: pointer;
}

.q-type-info { color: #bbb; font-size: 13px; cursor: help; flex-shrink: 0; margin-left: 4px; }
.q-type-info:hover { color: #8e44ad; }
.course-flashcard-icon { position: absolute; bottom: 10px; right: 12px; color: #8e44ad; font-size: 11px; opacity: 0.5; pointer-events: auto; cursor: help; }

/* Text-selection tooltip */
.course-sel-tooltip {
    position: fixed;
    z-index: 1000;
    background: #222;
    color: #fff;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 12px;
    box-shadow: 0 3px 12px #00000055;
    white-space: nowrap;
    pointer-events: auto;
    transform: translateX(-50%);
}
.course-sel-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #222;
}
.course-sel-tooltip button {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 12px;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}
.course-sel-tooltip button:hover { color: #c9a8f5; }

/* Revision page answer box */
.rev-correct-badge {
    display: inline-block;
    padding: 4px 12px;
    background: #d5f5e3;
    color: #1a7a45;
    border-radius: 20px;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 10px;
}

.rev-correct-answer-keywords {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #aed6f1;
    font-size: 12px;
    font-weight: 600;
    color: #2471a3;
}
.rev-correct-answer-keywords-tags { margin-left: 4px; }
.rev-correct-definition {
    margin-top: 8px;
    padding: 10px 14px;
    background: #f8f9fa;
    border: 2px solid #3498db;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.5;
    color: #2c3e50;
}
.rev-answer-box {
    margin-top: 16px;
    padding: 14px;
    background: #f0e8fa;
    border-radius: 8px;
    font-size: 15px;
    line-height: 1.5;
    color: #4a235a;
}

/* Revision page — layout */
.rev-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.rev-header-info { display: flex; align-items: center; gap: 12px; }
.rev-filters { padding: 16px; margin-bottom: 20px; }
.rev-filters-row { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }
.rev-filter-label { font-weight: 600; }
.rev-filter-select { min-width: 180px; }
.rev-settings-wrap { position: relative; margin-left: auto; display: flex; }
.rev-option-list { display: flex; flex-direction: column; gap: 10px; }
.rev-empty { text-align: center; padding: 48px; color: #888; }
.rev-empty-icon { font-size: 2.5rem; color: #27ae60; margin-bottom: 12px; display: block; }
.rev-empty-text { font-size: 1.1rem; }
.rev-progress { margin-bottom: 12px; }
.rev-progress-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.rev-counter { font-weight: 600; color: #555; }
.rev-mastered-count { font-size: 13px; color: #888; }
.rev-progress-track { background: #e0e0e0; border-radius: 4px; height: 6px; }
.rev-progress-fill { background: #8e44ad; height: 6px; border-radius: 4px; transition: width .3s; }
.rev-card { padding: 28px; }
.rev-question-row { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; }
.rev-question { font-size: 1.1rem; font-weight: 500; flex: 1; line-height: 1.5; }
.rev-aside-btn { margin-left: 16px; flex-shrink: 0; }
.rev-reveal-btn { width: 100%; }
.rev-input-row { display: flex; gap: 8px; }
.rev-input-field { flex: 1; }
.rev-feedback { margin-top: 12px; padding: 12px; border-radius: 8px; }
.rev-feedback-correct { background: #d5f5e3; color: #1a7a45; }
.rev-feedback-incorrect { background: #fde8e8; color: #c0392b; }
.rev-feedback-show { background: #f0f4ff; color: #2c3e50; }
.rev-feedback-correct-lex { background: transparent; }
.rev-zone-actions { display: flex; gap: 8px; margin-top: 10px; }
.rev-nav { display: flex; justify-content: space-between; margin-top: 24px; }
.rev-reveal-html-answer { margin-top: 8px; }
.rev-reveal-keywords { margin-top: 10px; padding-top: 10px; border-top: 1px solid #d0d8f0; }
.rev-reveal-keywords-label { font-size: 12px; font-weight: 600; color: #555; display: block; margin-bottom: 6px; }
.rev-reveal-keywords-tags { display: flex; flex-wrap: wrap; gap: 4px; }

/* ── Dark mode — Course ──────────────────────────────────────────────────── */
.dark-mode .course-folder-card { background: #1e1e2e; border-color: #2a2a3a; }
.dark-mode .course-folder-card:hover { box-shadow: 0 4px 14px #222222; }
.dark-mode .course-folder-link { color: #e0e0e0; }
.dark-mode .course-sidebar { background: #181828; border-right-color: #2a2a3a; }
.dark-mode .course-sidebar-header { border-bottom-color: #2a2a3a; color: #d0d0e0; }
.dark-mode .course-back-link { color: #aaa; }
.dark-mode .course-back-link:hover { background: #2a2a3a; color: #fff; }
.dark-mode .course-chapter-item:hover { background: #2a2a3a; }
.dark-mode .course-chapter-item.active { background: #3a2a55; }
.dark-mode .course-chapter-btn { color: #d0d0e0; }
.dark-mode .course-drag-handle { color: #444; }
.dark-mode .course-add-chapter-btn { border-color: #3a3a4a; color: #888; background: none; }
.dark-mode .course-add-chapter-btn:hover { border-color: #8e44ad; color: #b87de8; }
.dark-mode .course-sidebar-footer { border-top-color: #2a2a3a; }
.dark-mode .course-editor-sticky-top { background: #1a2634; }
.dark-mode .course-chapter-header { border-bottom-color: #2a2a3a; }
.dark-mode .course-chapter-title { color: #e0e0f0; }
.dark-mode .course-toolbar { background: #181828; border-bottom-color: #2a2a3a; }
.dark-mode .course-toolbar-btn { color: #aaa; }
.dark-mode .course-toolbar-btn:hover { background: #2a2a3a; border-color: #3a3a4a; }
.dark-mode .course-toolbar-sep { background: #3a3a4a; }
.dark-mode .course-content { color: #d0d0e0; }
.dark-mode .course-content h2 { color: #aed6f1; }
.dark-mode .course-content h3 { color: #aed6f1; }
.dark-mode .course-lexicon-panel { background: #1e1e2e; border-left-color: #2a2a3a; }
.dark-mode .course-lexicon-toggle { background: #1e1e2e; border-color: #2a2a3a; color: #888; }
.dark-mode .course-lexicon-header { border-bottom-color: #2a2a3a; color: #d0d0e0; }
.dark-mode .course-lexicon-filter { background: #1e1e2e; border-color: #3a3a4a; color: #d0d0e0; }
.dark-mode .course-lexicon-entry { background: #181828; border-color: #2a2a3a; }
.dark-mode .course-lex-term { color: #e0d0f8; }
.dark-mode .course-lex-def { color: #aaa; }
.dark-mode .lex-mastered-btn, .dark-mode .lex-edit-btn, .dark-mode .lex-delete-btn { border-color: #3a3a4a; color: #888; }
.dark-mode .course-lexicon-add { border-top-color: #2a2a3a; }
.dark-mode .course-panel-section { border-bottom-color: #2a2a3a; }
.dark-mode .course-panel-section-header { color: #d0d0e0; }
.dark-mode .course-panel-section-header:hover { background: #2a2a3a; }
.dark-mode .course-question-item { background: #181828; border-color: #2a2a3a; }
.dark-mode .course-q-type-badge { background: #2d2040; color: #c4a8f5; }
.dark-mode .course-q-question { color: #e0d0f8; }
.dark-mode .course-q-answer { color: #aaa; }
.dark-mode .q-mastered-btn, .dark-mode .q-edit-btn, .dark-mode .q-delete-btn { border-color: #3a3a4a; color: #888; }
.dark-mode .course-question-add { border-top-color: #2a2a3a; }
.dark-mode .course-q-type-select { background: #1e1e2e; border-color: #3a3a4a; color: #d0d0e0; }
.dark-mode .rev-answer-box { background: #2a1a3a; color: #d0b8f0; }

/* ── Journal ─────────────────────────────────────────────────────────────── */
.journal-layout { display: flex; gap: 24px; align-items: flex-start; }
.journal-timeline { flex: 1; min-width: 0; }
.journal-sidebar { width: 260px; flex-shrink: 0; }

.journal-day-group { margin-bottom: 28px; }
.journal-day-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 14px;
    color: #555;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 2px solid #f0f0f0;
}
.journal-day-header .journal-day-label { font-size: 16px; color: #2c3e50; }
.journal-entry-card {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 10px;
    display: flex;
    gap: 14px;
    transition: box-shadow .15s;
}
.journal-entry-card:hover { box-shadow: 0 2px 10px #0000001a; }
.journal-mood-dot {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #fff;
    flex-shrink: 0;
}
.journal-entry-body { flex: 1; min-width: 0; }
.journal-entry-title { font-weight: 600; font-size: 14px; color: #2c3e50; margin-bottom: 2px; }
.journal-entry-meta { font-size: 12px; color: #aaa; margin-bottom: 6px; }
.journal-entry-snippet { font-size: 13px; color: #666; line-height: 1.5; }
.journal-entry-actions { display: flex; gap: 4px; margin-top: 8px; }
.journal-entry-actions button { background: none; border: 1px solid #e0e0e0; border-radius: 4px; cursor: pointer; padding: 3px 8px; font-size: 11px; color: #888; }
.journal-entry-actions button:hover { background: #f5f5f5; }

/* Journal header */
.journal-header-identity { display: flex; align-items: center; gap: 12px; }
.journal-icon-pink { color: #e91e8c; }

/* Journal entry forms */
.journal-type-btns { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.journal-entry-fields-row { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; align-items: flex-end; }
.journal-field-group { display: flex; flex-direction: column; }
.journal-field-group--title { flex: 2; min-width: 180px; }
.journal-form-label { display: block; font-size: 11px; font-weight: 600; color: #888; text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 3px; }
.journal-date-input { max-width: 160px; }
.journal-time-input { max-width: 120px; }
.journal-title-input { width: 100%; }
.journal-form-actions { display: flex; gap: 8px; margin-top: 10px; justify-content: flex-end; }

/* New entry form */
.journal-new-form {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
}

/* Heatmap stats */
.journal-heatmap { display: flex; flex-direction: column; gap: 3px; }
.journal-heatmap-row { display: flex; gap: 3px; align-items: center; }
.journal-heatmap-label { width: 28px; height: 14px; line-height: 14px; font-size: 11px; color: #aaa; text-align: right; flex-shrink: 0; }
.journal-heatmap-cell {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    background: #f0f0f0;
    cursor: default;
    position: relative;
}
.journal-heatmap-cell[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    font-size: 11px;
    padding: 3px 7px;
    border-radius: 4px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 10;
}
.journal-mood-legend { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.journal-mood-legend-item { display: flex; align-items: center; gap: 5px; font-size: 12px; color: #555; }
.journal-mood-legend-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.journal-stat-bar { background: #f0f0f0; border-radius: 4px; height: 8px; overflow: hidden; margin-top: 4px; }
.journal-stat-bar-fill { height: 100%; border-radius: 4px; transition: width .3s; }

/* Editor inline */
.journal-editor-wrap { display: flex; flex-direction: column; gap: 0; }
.journal-content-area {
    min-height: 200px;
    padding: 14px;
    outline: none;
    font-size: 14px;
    line-height: 1.7;
    color: #333;
    border: 1px solid #e0e0e0;
    border-top: none;
    border-radius: 0 0 8px 8px;
}

/* Day navigation */
.journal-day-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    background: #f7f7f9;
    border-radius: 8px;
    padding: 8px 12px;
}
.journal-day-nav-arrow { padding: 4px 10px; flex-shrink: 0; }
.journal-day-nav-label {
    font-size: 1rem;
    font-weight: 700;
    color: #333;
}
.jdp-trigger-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #aaa;
    font-size: 15px;
    padding: 2px 6px;
    border-radius: 4px;
    line-height: 1;
    vertical-align: middle;
}
.jdp-trigger-btn:hover { color: #e91e8c; }
/* Custom datepicker */
.journal-datepicker {
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,.12);
    padding: 12px;
    z-index: 200;
    width: 260px;
}
.jdp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.jdp-title { font-weight: 700; font-size: 14px; }
.jdp-nav {
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
}
.jdp-nav:hover { background: #f0f0f5; color: #333; }
.jdp-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}
.jdp-dow {
    text-align: center;
    font-size: 11px;
    color: #aaa;
    font-weight: 600;
    padding: 4px 0;
}
.jdp-day {
    text-align: center;
    font-size: 13px;
    padding: 6px 2px;
    border-radius: 6px;
    border: none;
    background: none;
    cursor: pointer;
    color: #333;
}
.jdp-day:hover:not([disabled]) { background: #f0f0f5; }
.jdp-day[disabled] { color: #ccc; cursor: default; }
.jdp-today { color: #e91e8c; font-weight: 700; }
.jdp-current { background: #e91e8c; color: #fff; font-weight: 700; }
.jdp-current:hover { background: #c2185b; }
.dark-mode .journal-datepicker { background: #1e1e2e; border-color: #3a3a4a; box-shadow: 0 4px 20px rgba(0,0,0,.4); }
.dark-mode .jdp-day { color: #ccc; }
.dark-mode .jdp-day:hover:not([disabled]) { background: #2a2a3a; }
.dark-mode .jdp-day[disabled] { color: #444; }
.dark-mode .jdp-nav { color: #aaa; }
.dark-mode .jdp-nav:hover { background: #2a2a3a; color: #fff; }
.dark-mode .journal-day-nav { background: #1e1e2e; }
.dark-mode .journal-day-nav-label { color: #e0d0f8; }
.dark-mode .journal-day-nav-picker-btn { background: #2a2a3a; border-color: #3a3a4a; color: #ccc; }

/* Entry type toggle buttons */
.journal-type-btn {
    background: #f7f7f9;
    color: #555;
    border: 2px solid #e0e0e0;
    font-weight: 600;
    transition: background .15s, border-color .15s, color .15s;
}
.journal-type-btn:hover { background: #efefef; }
.journal-type-btn.active {
    background: #fff;
    border-color: var(--jbtn-color, #e91e8c);
    color: var(--jbtn-color, #e91e8c);
}
.dark-mode .journal-type-btn { background: #2a2a3a; border-color: #3a3a4a; color: #ccc; }
.dark-mode .journal-type-btn.active { background: #1e1e2e; }

/* Emotion detail blocks (multi-select) */
.journal-emotion-block {
    border: 1.5px solid var(--mood-color, #e91e8c);
    border-radius: 10px;
    overflow: hidden;
}
.journal-emotion-block-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: color-mix(in srgb, var(--mood-color, #e91e8c) 10%, transparent);
    font-size: 14px;
}
.journal-emotion-block-remove {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    color: #aaa;
    padding: 2px 6px;
    border-radius: 4px;
    line-height: 1;
}
.journal-emotion-block-remove:hover { color: #e74c3c; background: #fee; }
.journal-emotion-block-body {
    display: flex;
    flex-direction: column;
    padding: 10px 12px 12px;
    gap: 0;
}
.journal-emotion-block-label { font-size: 12px; color: #666; margin-bottom: 4px; }
.journal-block-note {
    margin-top: 8px;
    padding: 8px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
    color: #333;
}
.journal-block-note:focus { outline: none; border-color: #b0b0c8; }
.dark-mode .journal-emotion-block-header { background: color-mix(in srgb, var(--mood-color, #e91e8c) 15%, #1e1e2e); }
.dark-mode .journal-block-note { background: #181828; color: #d0d0e0; border-color: #3a3a4a; }

/* Category tabs */
.journal-cat-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.journal-cat-tab {
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid #ddd;
    background: #f7f7f9;
    font-size: 12px;
    cursor: pointer;
    color: #555;
    transition: background .15s, border-color .15s;
}
.journal-cat-tab:hover { background: #ede8f8; border-color: #c9b8e8; }
.journal-cat-tab.active { background: #e91e8c; border-color: #e91e8c; color: #fff; font-weight: 600; }

/* Mood grid (categorized) */
.journal-mood-grid { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.journal-mood-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 8px 10px;
    border-radius: 8px;
    border: 2px solid transparent;
    cursor: pointer;
    background: #f7f7f9;
    transition: border-color .15s, background .15s;
    font-size: 11px;
    color: #555;
    min-width: 56px;
}
.journal-mood-btn i { font-size: 18px; }
.journal-mood-btn:hover { background: #f0f0f5; }
.journal-mood-btn.selected { border-color: var(--mood-color, currentColor); background: #fff; font-weight: 600; }

/* Intensity slider */
.journal-intensity-slider {
    display: block;
    width: 100%;
    max-width: 340px;
    margin-top: 8px;
    accent-color: #e91e8c;
}

/* Selected mood display */
.journal-selected-mood {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #fdf0f6;
    border-radius: 8px;
    border: 1px solid #f0c0d8;
}

/* Dark mode */
.dark-mode .journal-entry-card { background: #1e1e2e; border-color: #2a2a3a; }
.dark-mode .journal-day-header { color: #aaa; border-bottom-color: #2a2a3a; }
.dark-mode .journal-day-header .journal-day-label { color: #e0d0f8; }
.dark-mode .journal-entry-title { color: #e0d0f8; }
.dark-mode .journal-entry-snippet { color: #999; }
.dark-mode .journal-new-form { background: #1e1e2e; border-color: #2a2a3a; }
.dark-mode .journal-mood-btn { background: #2a2a3a; color: #ccc; }
.dark-mode .journal-cat-tab { background: #2a2a3a; border-color: #3a3a4a; color: #ccc; }
.dark-mode .journal-cat-tab.active { background: #e91e8c; border-color: #e91e8c; color: #fff; }
.dark-mode .journal-selected-mood { background: #2a1a2e; border-color: #6a2a4a; }
.dark-mode .journal-mood-btn.selected { background: #1e1e2e; }
.dark-mode .journal-heatmap-cell { background: #2a2a3a; }
.dark-mode .journal-content-area { background: #181828; color: #d0d0e0; border-color: #3a3a4a; }

/* ── Course subfolders ───────────────────────────────────────────────────── */

.course-breadcrumb {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px 8px;
    font-size: 11px;
    flex-wrap: wrap;
    border-bottom: 1px solid #e0e0e0;
}
.course-breadcrumb-link {
    color: #8e44ad;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100px;
}
.course-breadcrumb-link:hover { text-decoration: underline; }
.course-breadcrumb-sep { font-size: 8px; color: #aaa; flex-shrink: 0; }

/* Subfolders in sidebar */
.course-sidebar-subfolders { padding: 4px 0; }
.course-subfolder-item {
    display: flex;
    align-items: center;
    padding: 0 6px;
    border-radius: 6px;
    margin: 0 6px;
    transition: background .1s;
}
.course-subfolder-item:hover { background: #eee; }
.course-subfolder-item-link {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 4px;
    text-decoration: none;
    color: #6c3483;
    font-size: 13px;
    min-width: 0;
}
.course-subfolder-item-link i { color: #8e44ad; font-size: 12px; flex-shrink: 0; }
.course-subfolder-item-link .course-chapter-label { color: #6c3483; }
.subfolder-rename-btn, .subfolder-delete-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 11px;
    color: #ccc;
    opacity: 0;
    transition: color .1s, opacity .1s;
}
.course-subfolder-item:hover .subfolder-rename-btn,
.course-subfolder-item:hover .subfolder-delete-btn { opacity: 1; }
.subfolder-rename-btn:hover { color: #555; }
.subfolder-delete-btn:hover { color: #e74c3c; }
.course-subfolder-item.is-renaming .course-subfolder-item-link { pointer-events: none; }
.course-subfolder-item.is-renaming .course-subfolder-rename-input { pointer-events: auto; cursor: text; }
@media (hover: none) {
    .subfolder-rename-btn, .subfolder-delete-btn { display: none; }
}

.course-sidebar-divider {
    height: 1px;
    background: #e0e0e0;
    margin: 6px 12px;
}

/* ── Dark mode — subfolders ──────────────────────────────────────────────── */
.dark-mode .course-breadcrumb { border-bottom-color: #2a2a3a; }
.dark-mode .course-breadcrumb-link { color: #b87de8; }
.dark-mode .course-subfolder-item:hover { background: #2a2a3a; }
.dark-mode .course-subfolder-item-link { color: #c0a0e0; }
.dark-mode .course-subfolder-item-link i { color: #b87de8; }
.dark-mode .course-subfolder-item-link .course-chapter-label { color: #c0a0e0; }
.dark-mode .subfolder-rename-btn:hover { color: #ccc; }
.dark-mode .course-sidebar-divider { background: #2a2a3a; }

.course-subfolder-item.subfolder-drop-over {
    background: #e8d5f5;
    outline: 2px dashed #8e44ad;
    outline-offset: -2px;
}
.dark-mode .course-subfolder-item.subfolder-drop-over {
    background: #3a2a55;
    outline-color: #b87de8;
}

.course-back-link--parent { transition: background .15s, color .15s, outline .15s; }
.course-back-link--parent.drop-over {
    background: #e8d5f5;
    color: #6c3483;
    outline: 2px dashed #8e44ad;
    outline-offset: 2px;
}
.dark-mode .course-back-link--parent.drop-over {
    background: #3a2a55;
    color: #d0b8f0;
    outline-color: #b87de8;
}

.course-breadcrumb-droptarget.drop-over {
    background: #e8d5f5;
    color: #6c3483;
    border-radius: 4px;
    outline: 2px dashed #8e44ad;
    outline-offset: 2px;
}
.dark-mode .course-breadcrumb-droptarget.drop-over {
    background: #3a2a55;
    color: #d0b8f0;
    outline-color: #b87de8;
}

/* ── Course toolbar extras ───────────────────────────────────────────────── */
.course-toolbar-select {
    font-size: 12px;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    padding: 3px 4px;
    background: #fff;
    color: #333;
    cursor: pointer;
    height: 28px;
}
.course-toolbar-select--narrow { width: 52px; }
.course-toolbar-select:focus { outline: 2px solid #8e44ad; }


.course-content blockquote {
    border-left: 3px solid #8e44ad;
    margin: 8px 0;
    padding: 4px 12px;
    color: #666;
    font-style: italic;
    background: #f9f4fe;
    border-radius: 0 4px 4px 0;
}

.dark-mode .course-toolbar-select { background: #1e1e2e; border-color: #3a3a4a; color: #d0d0e0; }
.dark-mode .course-content blockquote { background: #2a1a3a; color: #aaa; border-left-color: #8e44ad; }

/* Course color picker */
.course-color-wrap { position: relative; }
.course-color-trigger {
    flex-direction: column;
    gap: 1px;
    padding: 4px 7px 3px;
}
.course-color-swatch {
    display: block;
    width: 16px;
    height: 3px;
    border-radius: 2px;
    flex-shrink: 0;
    background: #333333;
}
.course-color-popover {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 100;
    background: #fff;
    border: 1px solid #d0d0d0;
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 4px 16px #c0c0c0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.course-color-popover input[type="color"] {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #d0d0d0;
    padding: 2px;
    cursor: pointer;
    background: none;
}
.course-color-popover input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
    border-radius: 50%;
}
.course-color-popover input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 50%;
}
.course-color-hex-input {
    width: 110px;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 13px;
    font-family: monospace;
    text-align: center;
    outline: none;
    color: #333;
}
.course-color-hex-input:focus { border-color: #8e44ad; }
.dark-mode .course-color-popover { background: #1e1e2e; border-color: #3a3a4a; box-shadow: 0 4px 16px #111111; }
.dark-mode .course-color-hex-input { background: #181828; border-color: #3a3a4a; color: #d0d0e0; }

/* ── Course : lexicon standalone page ───────────────────────────────────── */
.lex-nav-title-wrap { position: relative; }
.lex-nav-trigger {
    display: flex; align-items: center; gap: 8px;
    background: none; border: none; cursor: pointer;
    font-size: 1.6rem; font-weight: 700; color: #2c3e50;
    padding: 4px 8px; border-radius: 6px;
    transition: background 0.15s;
}
.lex-nav-trigger:hover { background: #f0f0f0; }
.lex-nav-chevron { font-size: 14px; color: #aaa; transition: transform 0.2s; }
.lex-nav-title-wrap.open .lex-nav-chevron { transform: rotate(180deg); }
.lex-nav-dropdown {
    display: none; position: absolute; top: calc(100% + 4px); left: 0;
    background: #fff; border: 1px solid #e0e0e0; border-radius: 8px;
    box-shadow: 0 6px 24px #00000018; min-width: 240px; max-height: 320px;
    overflow-y: auto; z-index: 200; padding: 4px 0;
}
.lex-nav-title-wrap.open .lex-nav-dropdown { display: block; }
.lex-nav-option {
    display: flex; align-items: center; gap: 8px;
    text-decoration: none; color: #333; font-size: 14px;
    padding: 8px 12px; transition: background 0.1s; white-space: nowrap;
}
.lex-nav-depth-1 { padding-left: 28px; }
.lex-nav-depth-2 { padding-left: 44px; }
.lex-nav-option i { font-size: 12px; color: #8e44ad; flex-shrink: 0; }
.lex-nav-option:hover { background: #f5f0ff; }
.lex-nav-option--active { background: #ede7f6; font-weight: 600; color: #6c3483; }
.lex-nav-option--active i { color: #6c3483; }
.dark-mode .lex-nav-trigger { color: #d0d0e0; }
.dark-mode .lex-nav-trigger:hover { background: #2a2a3a; }
.dark-mode .lex-nav-dropdown { background: #1e2d3d; border-color: #2a2a3a; }
.dark-mode .lex-nav-option { color: #d0d0e0; }
.dark-mode .lex-nav-option:hover { background: #2a1a3a; }
.dark-mode .lex-nav-option--active { background: #3a2050; color: #c0a0e0; }
.course-standalone-toolbar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.course-standalone-toolbar .search-wrapper { flex: 1; min-width: 200px; }
.course-standalone-header { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.course-standalone-header .section-label { margin-bottom: 0; }
.course-standalone-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-bottom: 16px; }
.course-standalone-card { background: #fff; border: 1px solid var(--border-color, #e0e0e0); border-radius: 8px; padding: 14px 16px; }
.course-standalone-card .course-lex-view,
.course-standalone-card .course-q-view { display: flow-root; }
.course-standalone-card .course-lex-actions,
.course-standalone-card .course-q-actions { float: right; margin-left: 8px; display: flex; gap: 4px; }
.course-standalone-section { margin-bottom: 32px; }
.course-standalone-add { padding: 16px; }
.course-standalone-add .profile-meta-input { width: 100%; display: block; margin-bottom: 8px; }
.course-standalone-edit-actions { display: flex; gap: 6px; justify-content: flex-end; margin-top: 8px; }
.course-standalone-card .course-lex-edit .profile-meta-input,
.course-standalone-card .course-q-edit .profile-meta-input,
.course-standalone-card .course-q-edit select { width: 100%; display: block; }
.dark-mode .course-standalone-card { background: #1e2d3d; border-color: #ffffff1a; }
.course-edit-actions { display: flex; gap: 6px; justify-content: flex-end; }
.course-panel-add-btn { width: 100%; }
.course-sidebar-footer .btn { width: 100%; justify-content: center; }
.course-subfolder-form { padding: 0 8px 8px; }
.course-subfolder-form-row { display: flex; gap: 6px; }
.course-subfolder-form-row .profile-meta-input { font-size: 13px; }
.course-subfolder-rename-input { flex: 1; font-size: 13px; padding: 2px 6px; }
.course-toolbar-h-label { font-weight: 700; font-size: 13px; }
.course-toolbar-unit { font-size: 13px; }

/* ── Course : responsive mobile ─────────────────────────────────────────────── */
.course-mobile-toolbar { display: none; }
.course-mobile-close-btn { display: none; background: none; border: none; cursor: pointer; color: #666; font-size: 18px; padding: 4px 8px; }
.course-mobile-close-btn:hover { color: #333; }

/* Tablette + mobile : panneaux en overlay, boutons toggle visibles */
@media (max-width: 1280px) {
    .course-editor-wrap { min-width: 0; }

    .course-sidebar {
        display: none;
        position: fixed; left: 0; top: 0; bottom: 0;
        width: 85vw; max-width: 320px;
        z-index: 1003;
        box-shadow: 4px 0 24px #0000002e;
        overflow-y: auto;
    }
    .course-sidebar.mobile-open { display: flex; }

    .course-lexicon-panel {
        display: none;
        position: fixed; right: 0; top: 0; bottom: 0;
        width: 85vw; max-width: 320px;
        z-index: 1003;
        box-shadow: -4px 0 24px #0000002e;
        border-left: none;
    }
    .course-lexicon-panel.mobile-open { display: flex; }
    .course-lexicon-panel .course-lexicon-inner { width: 100%; }
    .course-lexicon-toggle { display: none; }

    .course-mobile-toolbar {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 12px;
        border-bottom: 1px solid var(--border-color, #e0e0e0);
        background: #fff;
    }
    .story-mobile-panel-btn { display: inline-flex; }
    .course-mobile-close-btn { display: block; }
}

/* Mobile uniquement : layout colonne */
@media (max-width: 768px) {
    .course-layout { flex-direction: column; }
    .course-editor-wrap { width: 100%; }
}

/* ── Photo grid (albums) ───────────────────────────────────────────────────── */
.photo-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.photo-grid-item {
    position: relative;
    width: calc(25% - 5px);
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 6px;
    background: #f0f0f0;
}
.photo-grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
/* ── Moods ────────────────────────────────────────── */
.mood-list {
    list-style: none;
    margin: 0 0 8px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.mood-item {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    background: var(--bg-card);
    transition: border-color .15s;
}
.mood-item--active {
    border-color: #27ae60;
    background: #f0faf4;
}
.dark-mode .mood-item--active { background: #1a2e22; border-color: #2ecc71; }
.mood-item-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.mood-icon-preview {
    width: 32px;
    text-align: center;
    font-size: 18px;
    flex: 0 0 auto;
}
.mood-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.mood-item-name { font-size: 14px; }
.mood-item-desc { font-size: 12px; }
.mood-item-actions {
    display: flex;
    gap: 6px;
    flex: 0 0 auto;
}
.mood-edit-form { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.mood-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
}
.mood-active-badge { font-size: 11px; }
.mood-color-input { width: 32px; height: 28px; padding: 2px 3px; border: 1px solid var(--border-color, #e0e0e0); border-radius: 6px; cursor: pointer; background: none; }
.profile-meta-sub { font-size: 12px; }
/* ── Media tabs (icon / image switcher) ── */
.media-tabs { display: flex; border-bottom: 2px solid var(--border-color, #e0e0e0); margin-bottom: 1rem; }
.media-tab { background: none; border: none; border-bottom: 2px solid transparent; margin-bottom: -2px; padding: 0.4rem 1rem; font-size: 0.9rem; font-weight: 500; color: var(--text-muted, #888); cursor: pointer; transition: color .15s, border-color .15s; }
.media-tab.active { color: #3498db; border-bottom-color: #3498db; font-weight: 600; }
.media-tabs.mb-sm { margin-bottom: 8px; }
.mood-suggestion-group { margin-bottom: 16px; }
.mood-suggestion-group:last-child { margin-bottom: 0; }
.mood-suggestion-group-title { font-weight: 700; font-size: 13px; margin-bottom: 10px; display: flex; align-items: center; gap: 7px; text-transform: uppercase; letter-spacing: .5px; }
.mood-suggestion-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.mood-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border: 1.5px solid; border-radius: 20px; font-size: 13px; font-weight: 500; cursor: pointer; transition: background .15s, transform .1s; }
.mood-chip:hover { transform: translateY(-1px); }
.mood-chip:active { transform: none; }
/* Positive group — green */
.mood-suggestion-group[data-group="positive"] .mood-suggestion-group-title { color: #27ae60; }
.mood-suggestion-group[data-group="positive"] .mood-chip { color: #1a7a48; background: #eafaf1; border-color: #a9dfbf; }
.mood-suggestion-group[data-group="positive"] .mood-chip > i { color: #27ae60; }
.mood-suggestion-group[data-group="positive"] .mood-chip:hover { background: #d5f5e3; border-color: #27ae60; }
/* Negative group — red-pink */
.mood-suggestion-group[data-group="negative"] .mood-suggestion-group-title { color: #c0392b; }
.mood-suggestion-group[data-group="negative"] .mood-chip { color: #922b21; background: #fdedec; border-color: #f1948a; }
.mood-suggestion-group[data-group="negative"] .mood-chip > i { color: #e74c3c; }
.mood-suggestion-group[data-group="negative"] .mood-chip:hover { background: #fadbd8; border-color: #e74c3c; }
/* Neutral group — purple */
.mood-suggestion-group[data-group="neutral"] .mood-suggestion-group-title { color: #7d3c98; }
.mood-suggestion-group[data-group="neutral"] .mood-chip { color: #5b2c6f; background: #f5eef8; border-color: #c39bd3; }
.mood-suggestion-group[data-group="neutral"] .mood-chip > i { color: #8e44ad; }
.mood-suggestion-group[data-group="neutral"] .mood-chip:hover { background: #e8daef; border-color: #8e44ad; }
/* Dark mode overrides */
.dark-mode .mood-suggestion-group[data-group="positive"] .mood-chip { color: #a9dfbf; background: #0e2d1a; border-color: #27ae6060; }
.dark-mode .mood-suggestion-group[data-group="positive"] .mood-chip:hover { background: #1a4a2e; border-color: #27ae60; }
.dark-mode .mood-suggestion-group[data-group="negative"] .mood-chip { color: #f1948a; background: #2d0e0e; border-color: #c0392b60; }
.dark-mode .mood-suggestion-group[data-group="negative"] .mood-chip:hover { background: #4a1a1a; border-color: #e74c3c; }
.dark-mode .mood-suggestion-group[data-group="neutral"] .mood-chip { color: #c39bd3; background: #1e0e2d; border-color: #7d3c9860; }
.dark-mode .mood-suggestion-group[data-group="neutral"] .mood-chip:hover { background: #2e1a40; border-color: #8e44ad; }

/* Unread notification highlight */
.card--unread { border-left: 3px solid #f39c12; }

@media (max-width: 768px) {
    .photo-grid-item {
        width: calc(50% - 3px);
    }
}

/* ── Sidebar active profile ── */
.sidebar-profile-block {
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255,255,255,.1);
    margin-bottom: 4px;
}
.sidebar-profile-row {
    display: flex;
    align-items: center;
    gap: 4px;
}
/* Covers both <a> and <button> used as the profile link.
   Uses .sidebar-profile-block parent to beat .sidebar-links a (specificity 0,1,1). */
.sidebar-profile-block .sidebar-profile-link {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
    padding: 5px 6px;
    border-radius: 6px;
    text-decoration: none;
    color: #ecf0f1;
    background: none;
    border: none;
    cursor: pointer;
    transition: background .15s;
    font-size: 13px;
    font-weight: 600;
}
.sidebar-profile-block .sidebar-profile-link:hover { background: rgba(255,255,255,.1); color: #fff; }
.sidebar-profile-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #2980b9;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
    overflow: hidden;
}
.sidebar-profile-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sidebar-profile-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Small switch icon button at end of profile row */
.sidebar-profile-switch-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    border-radius: 4px;
    background: none;
    border: none;
    color: #ecf0f1;
    cursor: pointer;
    opacity: .5;
    font-size: 11px;
    transition: opacity .15s, background .15s;
}
.sidebar-profile-switch-btn:hover { opacity: 1; background: rgba(255,255,255,.12); }
/* Switcher items inside the submenu */
.sidebar-profile-block .dropdown-link {
    color: #ecf0f1;
    align-items: center;
    padding: 7px 12px 7px 16px;
    font-size: 13px;
}
.sidebar-profile-block .dropdown-link:hover { background: rgba(255,255,255,.1); }

/* ── Profile log ── */
.profile-log-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #aaa;
    font-size: 15px;
    padding: 2px 4px;
    line-height: 1;
    transition: color .15s;
}
.profile-log-btn:hover { color: #2980b9; }
.profile-log-popup {
    position: absolute;
    left: 0;
    top: calc(100% + 6px);
    z-index: 400;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,.14);
    min-width: 280px;
    max-width: 360px;
    padding: 12px 14px 10px;
}
.profile-log-popup-header {
    font-size: 12px;
    font-weight: 700;
    color: #888;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.profile-log-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.profile-log-entry {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 5px 0;
    border-bottom: 1px solid #f4f4f4;
}
.profile-log-entry:last-child { border-bottom: none; }
.profile-log-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #bdc3c7;
    flex-shrink: 0;
    margin-top: 5px;
}
.profile-log-content { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; flex: 1; min-width: 0; }
.profile-log-action { font-size: 12px; font-weight: 600; color: #34495e; }
.profile-log-detail { font-size: 11px; color: #888; }
.profile-log-date { font-size: 11px; color: #aaa; margin-left: auto; white-space: nowrap; }
.profile-log-swatch {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 2px;
    border: 1px solid #0002;
    vertical-align: middle;
}
.dark-mode .profile-log-popup { background: #1e2d3d; border-color: #2c3e50; }
.dark-mode .profile-log-entry { border-bottom-color: #2c3e50; }
.dark-mode .profile-log-action { color: #ecf0f1; }
.dark-mode .profile-log-detail { color: #95a5a6; }

/* ── Album layout ── */
.album-show-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; gap: 12px; }
.album-breadcrumb { font-size: 13px; color: #aaa; margin-bottom: 6px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.album-breadcrumb a { color: #aaa; text-decoration: none; }
.album-breadcrumb-current { color: #333; }
.album-title-row { display: flex; align-items: center; gap: 10px; }
.album-title-icon { color: #16a085; }
.album-rename-btn { flex-shrink: 0; }
.album-rename-form { display: none; align-items: center; gap: 8px; margin-top: 4px; }
.album-rename-input { font-size: 1.4rem; font-weight: 700; width: 280px; max-width: 100%; }
.album-subfolder-section { margin-bottom: 20px; }
.album-subfolder-header { font-size: 13px; font-weight: 600; color: #666; margin-bottom: 8px; }
.album-subfolder-icon { color: #e67e22; }
.album-toolbar { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; align-items: stretch; }
.album-toolbar-search { flex: 1; min-width: 200px; display: flex; }
.album-toolbar-search-input { flex: 1; border-radius: 6px 0 0 6px; border-right: none; }
.album-toolbar-search-btn { border-radius: 0 6px 6px 0; }
.album-upload-inner { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-start; }
.album-drop-zone { flex: 0 0 auto; width: 180px; height: 150px; border: 2px dashed #ccc; border-radius: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; color: #aaa; font-size: 13px; text-align: center; gap: 8px; }
.album-drop-zone-icon { font-size: 2rem; }
.album-upload-form { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 10px; }
.album-upload-label { font-size: 12px; font-weight: 600; color: #666; }
.album-date-row { display: flex; gap: 6px; margin-top: 4px; align-items: center; }
.album-date-day, .album-date-month { width: 58px; }
.album-date-year { width: 74px; }
.album-keywords-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.album-keywords-input { max-width: 300px; }
.album-people-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; margin-bottom: 4px; }
.album-upload-people-btn { font-size: 12px; padding: 4px 10px; }
.album-upload-pending { display: none; margin-top: 16px; border-top: 1px solid #eee; padding-top: 14px; }
.album-pending-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.album-send-row { display: flex; gap: 8px; align-items: center; }
.album-upload-progress { font-size: 13px; color: #666; }
.album-upload-error { display: none; color: #e74c3c; font-size: 13px; margin-top: 8px; }
.album-thumb { cursor: pointer; }
.album-upload-panel { display: none; padding: 20px; margin-bottom: 20px; }
.album-filter-empty { display: none; text-align: center; padding: 48px; color: #aaa; }
.album-grid-empty { text-align: center; padding: 48px; color: #aaa; }
.album-thumb-overlay { position: absolute; bottom: 0; left: 0; right: 0; padding: 4px 6px; background: linear-gradient(transparent, rgba(0,0,0,.5)); display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.album-thumb-year { font-size: 10px; color: #fff; background: rgba(0,0,0,.3); border-radius: 3px; padding: 1px 4px; }
.album-thumb-more { font-size: 10px; color: #fff; }
.album-empty-icon-big { font-size: 2.5rem; margin-bottom: 12px; display: block; }
.album-empty-text { font-size: 1.1rem; }
/* Album index */
.album-search-card { padding: 14px 16px; margin-bottom: 20px; }
.album-search-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.album-search-icon { color: #aaa; flex-shrink: 0; }
.album-search-count { font-size: 13px; color: #aaa; white-space: nowrap; }
.album-filter-row { display: none; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.album-filter-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.album-search-results { display: none; margin-bottom: 24px; }
.album-search-empty { display: none; text-align: center; padding: 32px; color: #aaa; font-size: 14px; }
.album-search-input { flex: 1; min-width: 160px; }
.album-card-link { display: flex; flex-direction: column; gap: 8px; padding: 16px; border: 1px solid #e0e0e0; border-radius: 8px; text-decoration: none; color: inherit; }
.album-card-inner { display: flex; align-items: center; gap: 12px; }
.album-card-date { font-size: 12px; color: #999; }
.album-card-desc-text { font-size: 13px; color: #666; margin: 0; }
/* Lightbox */
.lightbox-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.85); z-index: 1000; align-items: center; justify-content: center; }
.lightbox-overlay.active { display: flex; }
.lightbox-close { position: absolute; top: 16px; right: 20px; background: none; border: none; color: #fff; font-size: 1.8rem; cursor: pointer; z-index: 1001; }
.lightbox-download { position: absolute; top: 18px; right: 60px; color: #fff; font-size: 1.3rem; z-index: 1001; opacity: .8; line-height: 1; }
.lightbox-prev, .lightbox-next { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(0,0,0,.4); border: none; color: #fff; font-size: 1.4rem; border-radius: 50%; width: 44px; height: 44px; cursor: pointer; display: none; }
.lightbox-prev { left: 10px; }
.lightbox-next { right: 10px; }
.lightbox-prev.visible, .lightbox-next.visible { display: flex; align-items: center; justify-content: center; }
.lightbox-inner { display: flex; max-width: 95vw; max-height: 95vh; width: 100%; }
.lightbox-image-area { flex: 1; display: flex; align-items: center; justify-content: center; min-width: 0; }
.lightbox-img { max-width: 100%; max-height: 90vh; object-fit: contain; border-radius: 4px; }
.lightbox-panel { width: 280px; flex-shrink: 0; background: #fff; border-radius: 0 8px 8px 0; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.lightbox-panel-label { font-size: 11px; color: #aaa; margin-bottom: 4px; }
.lightbox-kw-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.lightbox-people-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; }
.lightbox-people-add { font-size: 12px; padding: 4px 10px; }
.lightbox-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 8px; border-top: 1px solid #eee; }
.lightbox-save-btn { flex: 1; }
.lightbox-save-status { font-size: 12px; color: #aaa; text-align: center; }

/* ── Album tablette (769–1024px) ── */
@media (max-width: 1024px) {
    .album-show-header { flex-direction: column; align-items: flex-start; }
    .album-show-header > .btn { align-self: flex-start; }
    .album-rename-input { width: 100%; }
    .album-drop-zone { width: 100%; flex: none; height: 120px; }
    .album-upload-form { min-width: 0; width: 100%; }
    .album-keywords-input { max-width: 100%; width: 100%; }
    .lightbox-panel { width: 220px; padding: 10px; }
    .lightbox-panel-label { font-size: 10px; }
    .album-date-day, .album-date-month { width: 52px; }
    .album-date-year { width: 68px; }
}

/* ── Album photo drag to sub-folder ── */
.album-subfolder-wrap,
.album-create-wrap { position: relative; display: flex; }
.album-card-wrap { position: relative; display: flex; flex-direction: column; cursor: grab; }
.album-card-wrap > a { flex: 1; }
.album-subfolder-card { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border: 1px solid #e0e0e0; border-radius: 8px; text-decoration: none; color: inherit; }
.album-subfolder-avatar { width: 36px; height: 36px; font-size: 16px; flex-shrink: 0; }
.album-subfolder-info { min-width: 0; }
.album-subfolder-info .album-card-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.album-subfolder-date { font-size: 12px; color: #999; }
.album-card-wrap.dragging { opacity: .35; pointer-events: none; }
.album-card-wrap.drag-over { outline: 2px dashed #16a085; outline-offset: 3px; border-radius: 8px; }
.album-card-delete     { position: absolute; top: 8px; right: 8px; }
.album-card-appearance { position: absolute; top: 8px; right: 38px; }
.album-avatar-bg { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 8px; background: var(--album-bg, #7f8c8d); color: white; font-size: 18px; flex-shrink: 0; }
#album-appearance-cpick .cpick-swatch { background: #7f8c8d; }
.album-subfolder-popover { position: absolute; top: calc(100% + 6px); right: 0; background: #fff; border: 1px solid #dde1e7; border-radius: 8px; padding: 10px; z-index: 100; box-shadow: 0 4px 12px #0000001a; }
.album-subfolder-form { display: flex; gap: 8px; align-items: center; }
.album-subfolder-form .profile-meta-input { width: 200px; }
.dark-mode .album-subfolder-popover { background: #243447; border-color: #ffffff26; }
.album-thumb[draggable] { cursor: grab; }
.album-thumb.dragging { opacity: .35; pointer-events: none; }
.subfolder-drop-target.drag-over {
    outline: 3px dashed #e67e22;
    outline-offset: 2px;
    background: #e67e2212;
}

/* ── Album thumbnail download overlay ── */
.album-thumb-download {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #00000066;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 3;
    text-decoration: none;
}
.photo-grid-item:hover .album-thumb-download {
    opacity: 1;
}

/* ── Type-block drag & drop ── */
.type-block[draggable] { cursor: grab; }
.type-block[draggable]:active { cursor: grabbing; }
.type-block.dragging { opacity: .35; pointer-events: none; }
.type-block.drag-over .type-block-icon {
    box-shadow: 0 4px 12px #0000002e, 0 0 0 3px white, 0 0 0 6px var(--block-color);
    transform: translateY(-4px) scale(1.06);
}


/* ============================================================
   Daily-Do
   ============================================================ */

/* Grid of list cards */
.daily-do-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; align-items: start; }
.daily-do-card { background: var(--card-bg, #fff); border: 1px solid var(--border-color, #e0e0e0); border-radius: 12px; display: flex; flex-direction: column; overflow: hidden; }
.daily-do-card-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--border-color, #e0e0e0); gap: 8px; }
.daily-do-card-title { font-weight: 600; font-size: 16px; cursor: pointer; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.daily-do-card-title:hover { text-decoration: underline; }

/* Items in manage list */
.daily-do-items { flex: 1; }
.daily-do-item { display: flex; align-items: flex-start; border-bottom: 1px solid var(--border-color, #f0f0f0); position: relative; overflow: hidden; }
.daily-do-item:last-child { border-bottom: none; }
.daily-do-item-bar { width: 4px; align-self: stretch; flex-shrink: 0; }
.daily-do-item-body { flex: 1; padding: 10px 12px; min-width: 0; }
.daily-do-item-content { font-size: 14px; line-height: 1.5; color: var(--text-primary, #333); }
.daily-do-item-image { max-width: 100%; border-radius: 6px; margin-top: 8px; max-height: 120px; object-fit: cover; }
.daily-do-item-icon { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 6px; font-size: 16px; margin-top: 6px; }
.daily-do-item-meta { display: flex; align-items: center; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.daily-do-item-tag { font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 10px; border: 1px solid; }
.daily-do-recurrence-badge { font-size: 11px; color: #999; display: inline-flex; align-items: center; gap: 3px; }
.daily-do-item-actions { display: flex; flex-direction: row; gap: 2px; padding: 6px 6px 6px 0; flex-shrink: 0; align-items: center; }
.dd-add-item-btn { margin: 12px 16px; width: calc(100% - 32px); justify-content: center; }

/* Rich text editor */
.dd-toolbar { display: flex; gap: 2px; padding: 6px 8px; border: 1px solid #ccc; border-bottom: none; border-radius: 4px 4px 0 0; background: #f8f9fa; flex-wrap: wrap; }
.dd-toolbar-btn { background: none; border: none; cursor: pointer; padding: 4px 8px; border-radius: 3px; font-size: 13px; color: #444; line-height: 1; transition: background 0.15s; }
.dd-toolbar-btn:hover { background: #e0e0e0; }
.dd-editor { border: 1px solid #ccc; border-radius: 0 0 4px 4px; min-height: 80px; padding: 10px 12px; font-size: 14px; line-height: 1.5; outline: none; overflow-y: auto; max-height: 200px; }
.dd-editor:focus { border-color: #3498db; box-shadow: 0 0 0 2px #3498db33; }

/* Tag chips */
.dd-tag-select { position: relative; }
.dd-tag-select-trigger { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; padding: 8px 12px; background: var(--bg-primary, #fff); border: 1px solid var(--border-color, #ddd); border-radius: 6px; cursor: pointer; font-size: 14px; color: var(--text-primary, #1a1a1a); }
.dd-tag-select-trigger:hover { border-color: var(--primary, #2980b9); }
.dd-tag-select-dropdown { position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: var(--bg-primary, #fff); border: 1px solid var(--border-color, #ddd); border-radius: 6px; box-shadow: 0 4px 12px rgba(0,0,0,.12); z-index: 200; max-height: 220px; overflow-y: auto; }
.dd-tag-select-option { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 12px; background: none; border: none; cursor: pointer; font-size: 14px; color: var(--text-primary, #1a1a1a); text-align: left; }
.dd-tag-select-option:hover { background: var(--bg-secondary, #f5f5f5); }
.dd-tag-select-swatch { display: inline-block; width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.dd-tag-select-label { display: inline-flex; align-items: center; gap: 8px; }
.dd-tag-cpick .cpick-swatch { background: #6c757d; }
.dd-tag-select-swatch--empty { background: transparent; border: 1px solid #ccc; }
#item-icon-preview { background: #6c757d; }
.dd-recurrence-interval { width: 70px; }
.dd-recurrence-monthday { width: 80px; }
.dd-recurrence-time { width: 120px; }
.dark-mode .dd-tag-select-trigger { background: var(--bg-primary); border-color: var(--border-color); }
.dark-mode .dd-tag-select-dropdown { background: var(--bg-primary); border-color: var(--border-color); }
.dark-mode .dd-tag-select-option:hover { background: var(--bg-secondary); }
.dd-tag-chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px 4px 12px; border-radius: 20px; font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; flex-shrink: 0; }
.dd-tag-action { background: none; border: none; cursor: pointer; color: inherit; opacity: 0.7; padding: 0 2px; font-size: 11px; line-height: 1; }
.dd-tag-action:hover { opacity: 1; }

/* Recurrence config */
.dd-recurrence { display: flex; flex-direction: column; gap: 10px; }
.dd-recurrence-type { display: flex; gap: 14px; flex-wrap: wrap; }
.dd-recurrence-type label { display: flex; align-items: center; gap: 4px; cursor: pointer; font-size: 14px; }
.dd-weekdays { display: flex; gap: 6px; flex-wrap: wrap; }
.dd-weekday-btn { width: 32px; height: 32px; border-radius: 50%; border: 1.5px solid #ccc; background: none; cursor: pointer; font-size: 11px; font-weight: 600; color: #666; display: flex; align-items: center; justify-content: center; transition: background 0.15s, border-color 0.15s, color 0.15s; }
.dd-weekday-btn.selected { background: #3498db; border-color: #3498db; color: #fff; }

/* Archive calendar */
.dd-archive-month-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.dd-archive-month-title { font-size: 20px; font-weight: 700; }
.dd-calendar { width: 100%; border-collapse: collapse; }
.dd-calendar th { text-align: center; font-size: 12px; font-weight: 600; color: #888; padding: 8px 0; text-transform: uppercase; letter-spacing: 0.5px; }
.dd-calendar td { text-align: center; padding: 4px; vertical-align: top; }
.dd-calendar-day { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%; margin: 0 auto; position: relative; font-size: 14px; font-weight: 500; color: #333; transition: background 0.15s; }
.dd-calendar-day.other-month { color: #ccc; }
.dd-calendar-day.has-checked { background: #e8f5e9; color: #27ae60; font-weight: 700; cursor: pointer; }
.dd-calendar-day.has-checked:hover { background: #c8e6c9; }
.dd-calendar-day.today { box-shadow: 0 0 0 2px #3498db; }
.dd-check-badge { position: absolute; bottom: 1px; right: 1px; width: 13px; height: 13px; background: #27ae60; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 7px; color: #fff; }
.dd-archive-detail { margin-top: 20px; }
.dd-archive-detail-header { font-size: 15px; font-weight: 600; margin-bottom: 12px; color: #2c3e50; text-transform: capitalize; }
.dd-archive-occurrence { display: flex; align-items: flex-start; gap: 10px; padding: 10px 14px; border-radius: 8px; margin-bottom: 8px; background: #f8f9fa; border-left: 4px solid #ccc; }
.dd-archive-occurrence.has-tag { border-left-color: var(--tag-color, #ccc); }

/* Dashboard Daily-Do section */
.dd-day-nav { display: flex; align-items: center; gap: 10px; }
.dd-day-nav-label { font-size: 14px; font-weight: 600; color: var(--text-primary, #1a1a1a); min-width: 140px; text-align: center; }

/* Birthday cards */
.birthday-card-link { text-decoration: none; flex: 0 0 auto; }
.birthday-card { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-left: 4px solid #e67e22; min-width: 200px; }
.birthday-card-name { font-weight: 600; color: var(--text-primary, #1a1a1a); }
.birthday-card-age { font-weight: 400; color: #888; font-size: 13px; }
.birthday-card-date { font-size: 13px; margin-top: 2px; }
.birthday-today { color: #e67e22; font-weight: 600; }
.birthday-soon { color: #e67e22; }
.birthday-card-dm { color: #aaa; margin-left: 4px; }

/* Dashboard section settings */
.dashboard-sections-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.dashboard-section-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--bg-secondary, #f5f5f5); border-radius: 8px; cursor: grab; user-select: none; border: 2px solid transparent; }
.dashboard-section-row.dragging { opacity: 0.4; }
.dashboard-section-row.drag-over { border-color: var(--primary, #2980b9); }
.dashboard-section-handle { color: #aaa; cursor: grab; font-size: 14px; }
.dashboard-section-label { flex: 1; font-size: 14px; font-weight: 500; color: var(--text-primary, #1a1a1a); }
.dark-mode .dashboard-section-row { background: var(--bg-secondary); }
.dd-dashboard-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.dd-dashboard-card { background: var(--card-bg, #fff); border: 1px solid var(--border-color, #e0e0e0); border-radius: 10px; overflow: hidden; }
.dd-dashboard-card-header { padding: 10px 14px; border-bottom: 1px solid var(--border-color, #f0f0f0); font-weight: 600; font-size: 14px; }
.dd-dashboard-item { display: flex; align-items: stretch; border-bottom: 1px solid var(--border-color, #f5f5f5); position: relative; overflow: hidden; }
.dd-dashboard-item:last-child { border-bottom: none; }
.dd-dashboard-item-bar { width: 3px; flex-shrink: 0; }
.dd-dashboard-item-check { padding: 10px 12px; display: flex; align-items: center; flex: 1; gap: 10px; cursor: pointer; font-size: 13px; line-height: 1.4; user-select: none; transition: background 0.1s; }
.dd-dashboard-item-check:hover { background: #f8f9fa; }
.dd-dashboard-item-check.checked { opacity: 0.55; }
.dd-dashboard-item-check.checked .daily-do-item-content { text-decoration: line-through; }
.dd-dashboard-checkbox { width: 18px; height: 18px; border-radius: 4px; border: 1.5px solid #ccc; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: background 0.15s, border-color 0.15s; color: #fff; font-size: 10px; }
.dd-dashboard-item-check.checked .dd-dashboard-checkbox { background: #27ae60; border-color: #27ae60; }

/* Dark mode */
.dark-mode .dd-editor { background: #1e2d3d; border-color: #ffffff26; color: #ecf0f1; }
.dark-mode .dd-toolbar { background: #243447; border-color: #ffffff26; }
.dark-mode .dd-toolbar-btn { color: #bdc3c7; }
.dark-mode .dd-toolbar-btn:hover { background: #2c3e50; }
.dark-mode .daily-do-card { background: #1e2d3d; border-color: #ffffff1a; }
.dark-mode .daily-do-item { border-color: #ffffff0f; }
.dark-mode .daily-do-item-content { color: #ecf0f1; }
.dark-mode .dd-archive-occurrence { background: #243447; }
.dark-mode .dd-dashboard-card { background: #1e2d3d; border-color: #ffffff1a; }
.dark-mode .dd-dashboard-item { border-color: #ffffff0a; }
.dark-mode .dd-dashboard-item-check:hover { background: #ffffff08; }
.dark-mode .dd-calendar-day { color: #ecf0f1; }
.dark-mode .dd-calendar-day.other-month { color: #4a6070; }
.dark-mode .dd-calendar-day.has-checked { background: #1b4332; color: #6fcf97; }
.dark-mode .dd-calendar-day.has-checked:hover { background: #245c42; }
.dark-mode .dd-weekday-btn { border-color: #ffffff33; color: #bdc3c7; }
.dark-mode .dd-archive-detail-header { color: #ecf0f1; }

/* Travel notification thumbnails */
.travel-notif-thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}
.travel-notif-thumb-placeholder {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    background: #f0f4f8;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #aaa;
    font-size: 1.1rem;
    flex-shrink: 0;
}

/* Travel comparator map popup avatars */
.travel-map-avatar-img { width: 14px; height: 14px; border-radius: 50%; }
.travel-map-avatar-text { font-size: 10px; font-weight: 600; }

/* ── Profils + groupes : grille auto sur tablette ───────────────────────── */
@media (max-width: 1024px) {
    .profile-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
    .profile-grid .card { margin-bottom: 0; }
    .profile-grid .profile-card .profile-card-body,
    .profile-grid .group-card > div:nth-child(2) { flex-direction: column !important; align-items: center !important; gap: 8px !important; text-align: center; }
    .profile-grid .profile-card .profile-card-info,
    .profile-grid .group-card > div:nth-child(2) > div { flex: unset !important; }
    .profile-grid .profile-card .profile-card-body h3,
    .profile-grid .group-card > div:nth-child(2) h3 { margin: 0 0 4px !important; font-size: 13px; }
    .profile-grid .profile-card .profile-card-body p,
    .profile-grid .group-card > div:nth-child(2) p { margin: 0 !important; font-size: 12px; }
    .profile-grid .profile-card-actions { left: 6px; right: 6px; justify-content: space-between; }
    .profile-grid .profile-card-actions:not(:has(.favorite-btn)) .profile-card-gear { margin-left: auto; }
    .profile-grid .settings-dropdown { min-width: 150px; font-size: 13px; }
    .profile-grid .card.profile-card:has(.settings-dropdown.active) { z-index: 10; }
    .profile-grid .group-card-actions { left: 6px !important; right: 6px !important; justify-content: space-between; }
    .profile-grid .profile-card-desc { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
    .profile-grid .profile-card-desc.expanded { display: block; overflow: visible; }
    .profile-card-expand-btn { display: none; }
    .profile-grid .profile-card-expand-btn { display: flex; justify-content: center; width: 100%; background: none; border: none; cursor: pointer; padding: 4px 0 0; color: #aaa; font-size: 11px; }
    .profile-grid .profile-card-expand-btn .fa-chevron-down { transition: transform 0.2s; }
    .profile-grid .profile-card-expand-btn.expanded .fa-chevron-down { transform: rotate(180deg); }
    .profile-section.mb-xl { margin-bottom: 12px; }
    .grid-wide { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .grid-wide .card { margin-bottom: 0; }
    .grid-wide.mb-xl { margin-bottom: 12px; }
    .dashboard-birthday-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
    .dashboard-birthday-list .birthday-card-link { display: flex; }
    .dashboard-birthday-list .birthday-card { flex: 1; min-width: 0; margin-bottom: 0; }
    .profile-new-label { display: none; }
}

/* ── Dashboard mobile: 2-column layout ─────────────────────────────────── */
@media (max-width: 768px) {
    /* Birthday cards: grille 2 colonnes, carte verticale centrée */
    .dashboard-birthday-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .dashboard-birthday-list .birthday-card-link { display: flex; }
    .dashboard-birthday-list .birthday-card { margin-bottom: 0; }
    .dashboard-birthday-list .birthday-card {
        flex: 1;
        min-width: 0;
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 10px 8px;
        gap: 6px;
    }

    /* Grilles groupes/profils: 2 colonnes, avatar centré au-dessus du nom */
    .grid-wide {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .grid-wide .card > div:first-child {
        flex-direction: column !important;
        align-items: center !important;
        gap: 8px !important;
        text-align: center;
    }
    .grid-wide .card > div:first-child > div { flex: unset !important; }
    .grid-wide .card > div:first-child h3 { margin: 0 0 4px !important; }
    .grid-wide .card > div:first-child p { margin: 0 !important; }
    .grid-wide .card { margin-bottom: 0; }
    .grid-wide.mb-xl { margin-bottom: 12px; }
    .dashboard-birthday-list { margin-bottom: 12px; }
    .main-content .container h2.mb-md,
    .main-content .container div.flex.mb-md:not(:has(h1)) { margin-top: 32px; }
    .main-content .container h2 { font-size: 1.15rem; gap: 10px; }

    /* Page profils: grille 2 colonnes (mobile) */
    .profile-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .profile-grid .card { margin-bottom: 0; }
    .profile-grid .profile-card .profile-card-body,
    .profile-grid .group-card > div:nth-child(2) {
        flex-direction: column !important;
        align-items: center !important;
        gap: 8px !important;
        text-align: center;
    }
    .profile-grid .profile-card .profile-card-info,
    .profile-grid .group-card > div:nth-child(2) > div { flex: unset !important; }
    .profile-grid .profile-card .profile-card-body h3,
    .profile-grid .group-card > div:nth-child(2) h3 { margin: 0 0 4px !important; font-size: 13px; }
    .profile-grid .profile-card .profile-card-body p,
    .profile-grid .group-card > div:nth-child(2) p { margin: 0 !important; font-size: 12px; }
    .profile-section.mb-xl { margin-bottom: 12px; }

    /* Settings dropdown dans grille 2 colonnes */
    .profile-grid .settings-dropdown { min-width: 150px; font-size: 13px; }
    .profile-grid .card.profile-card:has(.settings-dropdown.active) { z-index: 10; }

    /* Group edit : cards membres en colonne (photo centée + info en dessous) */
    .profile-grid .group-member-card > div:nth-child(2) {
        flex-direction: column !important;
        align-items: center !important;
        gap: 8px !important;
        text-align: center;
    }
    .profile-grid .group-member-card > div:nth-child(2) > div { flex: unset !important; }
    .profile-grid .group-member-card > div:nth-child(2) h3 { margin: 0 0 4px !important; font-size: 13px; }
    .profile-grid .group-member-card > div:nth-child(2) p { margin: 0 !important; font-size: 12px; }

    /* Group card : favoris en haut à gauche, engrenage en haut à droite */
    .profile-grid .group-card-actions {
        left: 6px !important;
        right: 6px !important;
        justify-content: space-between;
    }

    /* Description tronquée + bouton expand (fictional uniquement) */
    .profile-grid .profile-card-desc {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    .profile-grid .profile-card-desc.expanded {
        display: block;
        overflow: visible;
    }
    .profile-card-expand-btn { display: none; }
    .profile-grid .profile-card-expand-btn {
        display: flex;
        justify-content: center;
        width: 100%;
        background: none;
        border: none;
        cursor: pointer;
        padding: 4px 0 0;
        color: #aaa;
        font-size: 11px;
    }
    .profile-grid .profile-card-expand-btn .fa-chevron-down { transition: transform 0.2s; }
    .profile-grid .profile-card-expand-btn.expanded .fa-chevron-down { transform: rotate(180deg); }

    /* Admin permissions : table en mode carte */
    .perm-table thead { display: none; }
    .perm-table,
    .perm-table tbody { display: block; }
    .perm-table .perm-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 0 !important; }
    .perm-table .perm-row td { display: block; padding: 0 !important; border: none; }
    .perm-table .perm-row td:nth-child(1) { flex: 1; min-width: 0; }
    .perm-table .perm-row td:nth-child(2) { flex-shrink: 0; }
    .perm-table .perm-row td:nth-child(3) { width: 100%; text-align: left !important; }
    .perm-table .perm-row td:nth-child(3) > div { justify-content: flex-start !important; }

    /* Journal : boutons icon-only + champs plein largeur */
    .journal-btn-label { display: none; }
    .journal-entry-fields-row { flex-direction: column; gap: 6px; }
    .journal-field-group { width: 100%; }
    .journal-field-group--title { flex: none; min-width: 0; }
    .journal-date-input,
    .journal-time-input { max-width: none; width: 100%; }

    /* Daily-Do archive : calendrier dans la card */
    .dd-calendar td { padding: 2px; }
    .dd-calendar-day { width: 36px; height: 36px; font-size: 12px; }

    /* Profile show : boutons empilés verticalement sur mobile */
    .profile-show-actions { flex-direction: column; align-items: flex-end; flex-shrink: 0; gap: 4px; }
    .profile-show-header-left { min-width: 0; flex: 1; }

    /* Lexique standalone : gap réduit entre les cards */
    .course-standalone-grid { gap: 8px; }

    /* Album : sous-dossiers en 2 colonnes, icône au-dessus */
    #children-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    #children-grid .album-subfolder-card { flex-direction: column; align-items: center; text-align: center; padding: 10px 6px; gap: 6px; }
    #children-grid .album-subfolder-info .album-card-name { white-space: normal; overflow: visible; text-overflow: unset; font-size: 13px; }
}

/* ── Tablette : adaptations supplémentaires (769–1024px) ────────────────── */
@media (max-width: 1024px) {
    /* Album : sous-dossiers en 2 colonnes */
    #children-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    #children-grid .album-subfolder-card { flex-direction: column; align-items: center; text-align: center; padding: 10px 6px; gap: 6px; }
    #children-grid .album-subfolder-info .album-card-name { white-space: normal; overflow: visible; text-overflow: unset; font-size: 13px; }

    /* Photo grid : 2 colonnes (était 4) */
    .photo-grid-item { width: calc(50% - 3px); }

    /* Profile show : boutons en colonne */
    .profile-show-actions { flex-direction: column; align-items: flex-end; flex-shrink: 0; gap: 4px; }
    .profile-show-header-left { min-width: 0; flex: 1; }

    /* Lexique standalone : gap réduit */
    .course-standalone-grid { gap: 8px; }

    /* Journal : labels icône-only, champs pleine largeur */
    .journal-btn-label { display: none; }
    .journal-entry-fields-row { flex-direction: column; gap: 6px; }
    .journal-field-group { width: 100%; }
    .journal-field-group--title { flex: none; min-width: 0; }
    .journal-date-input, .journal-time-input { max-width: none; width: 100%; }

    /* Admin permissions : table en mode carte */
    .perm-table thead { display: none; }
    .perm-table, .perm-table tbody { display: block; }
    .perm-table .perm-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 0 !important; }
    .perm-table .perm-row td { display: block; padding: 0 !important; border: none; }
    .perm-table .perm-row td:nth-child(1) { flex: 1; min-width: 0; }
    .perm-table .perm-row td:nth-child(2) { flex-shrink: 0; }
    .perm-table .perm-row td:nth-child(3) { width: 100%; text-align: left !important; }
    .perm-table .perm-row td:nth-child(3) > div { justify-content: flex-start !important; }

    /* Daily-Do : calendrier compact */
    .dd-calendar td { padding: 2px; }
    .dd-calendar-day { width: 36px; height: 36px; font-size: 12px; }
}

/* ── List card (profile/information.html.twig) ── */
.profile-show-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; gap: 10px; flex-wrap: nowrap; }
.profile-show-header-left { display: flex; align-items: center; gap: 15px; min-width: 0; flex: 1; }

.list-card {
    padding: 15px;
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 8px;
    position: relative;
}
.list-card-settings {
    position: absolute;
    top: 10px;
    right: 10px;
}
.list-card-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 10px;
    padding-right: 30px;
}
.list-card-name { font-size: 13px; color: #666; }
.list-card-description { color: #666; font-size: 14px; margin: 10px 0 0; }
.card-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

/* ── Journal editor (journal/edit.html.twig) ── */
.card-journal { max-width: 760px; margin: 0 auto; }
.journal-field { margin-bottom: 16px; }
.journal-field-label { font-weight: 600; font-size: 13px; color: #666; margin-bottom: 6px; }
.journal-field-row { display: flex; gap: 8px; flex-wrap: wrap; }
.journal-date-input { max-width: 160px; }
.journal-time-input { max-width: 120px; }
.journal-intensity-value { color: #e91e8c; font-weight: 700; }
.journal-edit-actions { display: flex; justify-content: flex-end; margin-top: 20px; }
.course-toolbar--top-rounded { border-radius: 8px 8px 0 0; }

/* ── Mini éditeur illustré ───────────────────────────────────────────────── */
.mini-editor-wrap { border: 1px solid #d0d0d0; border-radius: 8px; overflow: hidden; }
.mini-editor-toolbar { display: flex; gap: 2px; padding: 4px 6px; background: #f5f5f5; border-bottom: 1px solid #d0d0d0; flex-wrap: wrap; align-items: center; }
.mini-editor-btn { background: none; border: none; padding: 4px 7px; cursor: pointer; border-radius: 4px; color: #555; font-size: 12px; line-height: 1; }
.mini-editor-btn:hover { background: #e0e0e0; color: #222; }
.mini-editor-sep { width: 1px; background: #d0d0d0; align-self: stretch; margin: 2px 2px; }
.mini-editor-content { min-height: 72px; max-height: 320px; overflow-y: auto; padding: 10px; font-size: 14px; line-height: 1.5; outline: none; }
.mini-editor-content img { width: 100%; cursor: pointer; display: inline-block; vertical-align: top; margin: 2px; }
.mini-editor-content img.mini-selected { outline: 2px solid #3498db; border-radius: 2px; }
.mini-editor-content img.img-float-left { float: left; display: block !important; margin: 4px 10px 4px 0; }
.mini-editor-content img.img-float-right { float: right; display: block !important; margin: 4px 0 4px 10px; }
.mini-editor-content::after { content: ''; display: block; clear: both; }
.mini-img-popover { position: fixed; z-index: 9999; background: #fff; border: 1px solid #d0d0d0; border-radius: 8px; padding: 6px 10px; display: flex; align-items: center; gap: 6px; box-shadow: 0 4px 16px #c0c0c0; }
.mini-img-popover.hidden { display: none; }
.mini-img-popover-sep { width: 1px; background: #d0d0d0; align-self: stretch; margin: 0 2px; }
.mini-img-align-btn { background: none; border: none; cursor: pointer; padding: 3px 6px; border-radius: 4px; color: #555; font-size: 12px; line-height: 1; }
.mini-img-align-btn:hover, .mini-img-align-btn.active { background: #e0e0e0; color: #222; }
.text-emotion { color: #e91e8c; }
.text-journal-text { color: #8e44ad; }
.text-faded { color: #aaa; }
.input-narrow { width: 70px; }
.select-auto { width: auto; }
.py-sm { padding-top: 5px; padding-bottom: 5px; }

/* ── Profile-tag : grille 2 colonnes sur mobile ── */
@media (max-width: 1024px) {
    .tag-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .tag-grid .tag-card { margin-bottom: 0; }
    .tag-grid .tag-card-body { flex-direction: column; align-items: center; text-align: center; gap: 8px; }
    .tag-grid .tag-card-name { font-size: 13px; }
    .tag-grid .tag-card-date { font-size: 12px; }
    .tag-grid .settings-dropdown { min-width: 140px; font-size: 13px; }
    .tag-grid .card.tag-card:has(.settings-dropdown.active) { z-index: 10; }
}

/* ── form-body-grid : responsive multi-colonnes (après toutes les règles form-section) ── */
@media (min-width: 768px) {
    .form-body-grid { grid-template-columns: 1fr 1fr; }
    .form-body-grid .form-section--identity { grid-row: 1 / 3; padding-right: 32px; border-right: 1px solid var(--border-color, #e0e0e0); border-top: none; padding-top: 0; margin-top: 0; }
    .form-body-grid .form-section--picture,
    .form-body-grid .form-section--fictional { border-top: none; padding-top: 0; margin-top: 0; padding-left: 32px; }
    .form-body-grid .form-section--fictional { border-top: 1px solid var(--border-color, #e0e0e0); padding-top: 24px; margin-top: 24px; }
}
@media (min-width: 1400px) {
    .form-body-grid { grid-template-columns: repeat(3, 1fr); }
    .form-body-grid .form-section--identity { grid-row: auto; padding-right: 32px; border-right: 1px solid var(--border-color, #e0e0e0); }
    .form-body-grid .form-section--picture { padding-left: 32px; padding-right: 32px; border-right: 1px solid var(--border-color, #e0e0e0); }
    .form-body-grid .form-section--fictional { padding-left: 32px; border-top: none; padding-top: 0; margin-top: 0; }
}

/* ── story-modal--form : grille 2 colonnes (Daily-Do item, etc.) ── */
@media (min-width: 768px) {
    .story-modal--form .form-body-grid .form-section--identity { grid-row: auto; }
    .story-modal--form .form-body-grid .form-section--full { grid-column: 1 / -1; }
}
@media (min-width: 1400px) {
    .story-modal--form .form-body-grid { grid-template-columns: 1fr 1fr; }
}

/* ── Liste de voyages ────────────────────────────────────────────────────── */
#travel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.travel-card { border: 1px solid var(--border-color, #e0e0e0); border-radius: 8px; overflow: hidden; background: var(--card-bg, #fff); position: relative; }
.travel-drag-handle { position: absolute; top: 8px; left: 8px; cursor: grab; color: #fff; background: #00000066; border-radius: 4px; padding: 2px 6px; z-index: 2; font-size: 1rem; }
.travel-card-photo { position: relative; height: 160px; background: #f0f0f0; overflow: hidden; }
.travel-photo { width: 100%; height: 100%; object-fit: cover; }
.travel-photo-placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 2.5rem; color: #bbb; background: #f5f5f5; }
.travel-visited-badge { position: absolute; bottom: 8px; right: 8px; background: #27ae60; color: #fff; padding: 2px 8px; border-radius: 12px; font-size: 0.75rem; font-weight: 600; }
.travel-card-body { padding: 0.75rem; }
.travel-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 0.25rem; }
.travel-card-name { font-size: 1rem; font-weight: 600; }
.travel-card-footer { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.travel-score-buttons { display: flex; gap: 2px; }
.score-btn { background: none; border: 1px solid transparent; border-radius: 4px; cursor: pointer; font-size: 1.1rem; padding: 2px 4px; opacity: 0.5; transition: opacity 0.15s, border-color 0.15s; }
.score-btn:hover, .score-btn.active { opacity: 1; border-color: var(--primary-color, #3498db); }
.visited-toggle { font-size: 0.8rem; padding: 3px 8px; }
.visited-filter-bar { display: flex; background: var(--input-bg, #f0f0f0); border-radius: 20px; padding: 3px; gap: 2px; width: fit-content; margin-bottom: 1rem; }
.vf-btn { background: none; border: none; border-radius: 16px; padding: 4px 16px; font-size: 0.85rem; cursor: pointer; color: var(--text-muted, #666); transition: background 0.15s, color 0.15s; font-weight: 500; }
.vf-btn.vf-active { background: #fff; color: var(--text-color, #222); box-shadow: 0 1px 4px #0000001f; }

/* ── Liste personnalisée ─────────────────────────────────────────────────── */
#custom-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.custom-card { border: 1px solid var(--border-color, #e0e0e0); border-radius: 8px; background: var(--card-bg, #fff); padding: 0.75rem; position: relative; }
.custom-card.custom-card-with-photo { padding: 0; overflow: hidden; }
.custom-card-photo { position: relative; height: 160px; background: #f0f0f0; overflow: hidden; }
.custom-photo { width: 100%; height: 100%; object-fit: cover; }
.custom-card-with-photo .custom-card-header { padding: 0.75rem 0.75rem 0 0.75rem; }
.custom-card-with-photo .custom-card-fields { padding: 0 0.75rem 0.75rem 0.75rem; }
.custom-drag-handle { position: absolute; top: 8px; left: 8px; cursor: grab; color: #aaa; font-size: 0.9rem; z-index: 2; }
.custom-card-with-photo .custom-drag-handle { color: #fff; background: #00000066; border-radius: 4px; padding: 2px 6px; }
.custom-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 0.5rem; padding-left: 1.25rem; }
.custom-card-name { font-size: 1rem; font-weight: 600; }
.custom-card-fields { display: flex; flex-direction: column; gap: 0.4rem; }
.custom-field-row { display: flex; gap: 0.5rem; align-items: flex-start; flex-wrap: wrap; }
.custom-field-label { min-width: 90px; font-weight: 500; flex-shrink: 0; }
.custom-field-value { flex: 1; word-break: break-word; }

/* ── Répertoire professionnel ────────────────────────────────────────────── */
#pro-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.pro-card { border: 1px solid var(--border-color, #e0e0e0); border-radius: 8px; background: var(--card-bg, #fff); display: flex; position: relative; padding: 0.75rem; gap: 0.75rem; }
.pro-drag-handle { position: absolute; top: 6px; left: 6px; cursor: grab; color: #999; font-size: 0.9rem; z-index: 2; }
.pro-card-avatar { flex-shrink: 0; }
.pro-avatar-img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; }
.pro-avatar-icon { width: 64px; height: 64px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.6rem; color: #fff; }
.pro-card-body { flex: 1; min-width: 0; padding-top: 0.25rem; }
.pro-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 0.25rem; }
.pro-card-name { font-size: 1rem; font-weight: 600; }
.pro-status-badge { font-size: 0.72rem !important; padding: 2px 8px; border-radius: 10px; margin-top: 0.25rem; display: inline-block; }
.pro-open { background: #27ae60; color: #fff; }
.pro-closed { background: #e74c3c; color: #fff; }
.pro-hours-btn { cursor: pointer; border: none; font: inherit; }
.pro-hours-dropdown { display: none; position: absolute; left: 0; top: calc(100% + 4px); background: var(--card-bg, #fff); border: 1px solid var(--border-color, #e0e0e0); border-radius: 8px; box-shadow: 0 4px 16px #0000001a; z-index: 50; min-width: 200px; padding: 8px 10px; white-space: nowrap; }
.pro-hours-dropdown.open { display: block; }
.pro-hours-week { width: 100%; border-collapse: collapse; font-size: 12px; }
.pro-hours-week td { padding: 2px 6px 2px 0; vertical-align: top; }
.pro-hours-week .phw-days { font-weight: 600; color: var(--text-color, #333); }
.pro-hours-week .phw-slots { color: var(--text-muted, #666); }
.pro-hours-week .phw-today .phw-days { color: #3498db; }
.pro-phones a, .pro-emails a { color: var(--primary-color, #3498db); }
.pro-address-link { color: var(--text-color, #333); text-decoration: none; border-bottom: 1px dashed #aaa; }
.pro-address-link:hover { border-bottom-color: var(--primary-color, #3498db); color: var(--primary-color, #3498db); }

/* ── Recettes ────────────────────────────────────────────────────────────── */
.recipe-filter-bar { display: flex; flex-direction: column; gap: 0.6rem; margin-bottom: 1rem; }
.recipe-filter-row { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.recipe-filter-select { width: auto; flex-shrink: 0; }
.recipe-filter-wrap { position: relative; flex-shrink: 0; }
.filter-chips { display: flex; flex-wrap: wrap; gap: 0.3rem; align-items: center; }
.filter-chip { display: flex; align-items: center; gap: 0.3rem; background: #f0f0f0; border-radius: 20px; padding: 2px 8px 2px 4px; font-size: 0.8rem; }
.filter-chip button { background: none; border: none; cursor: pointer; color: #888; font-size: 0.75rem; padding: 0; line-height: 1; }
.filter-chip button:hover { color: #e74c3c; }
.filter-dropdown { display: none; position: absolute; top: 100%; left: 0; right: 0; z-index: 50; background: #fff; border: 1px solid #e0e0e0; border-radius: 6px; box-shadow: 0 4px 12px #0000001a; max-height: 200px; overflow-y: auto; }
.filter-dropdown-item { display: flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0.75rem; cursor: pointer; font-size: 0.88rem; }
.filter-dropdown-item:hover { background: #f5f5f5; }
.recipe-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
.recipe-card { text-decoration: none; color: inherit; transition: transform 0.15s, box-shadow 0.15s; padding: 0; overflow: hidden; }
.recipe-card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px #0000001a; }
.recipe-card-header { background: linear-gradient(135deg, #e67e22, #d35400); overflow: hidden; height: 120px; display: flex; align-items: center; justify-content: center; }
.recipe-card-img { width: 100%; height: 100%; object-fit: cover; display: block; flex-shrink: 0; }
.recipe-card-icon { font-size: 2rem; color: #ffffffe5; }
.recipe-card-body { padding: 1rem; }
.recipe-card-name { margin: 0 0 0.25rem; font-size: 1rem; }
.recipe-card-desc { margin: 0 0 0.5rem; }
.recipe-card-meta { display: flex; gap: 0.75rem; }
.recipe-empty-icon { font-size: 2rem; color: #ccc; margin-bottom: 0.5rem; }

/* ── Grilles de listes : 2 colonnes sur tablette (769–1024px, sidebar en flux) ── */
@media (max-width: 1024px) {
    #travel-grid { grid-template-columns: repeat(2, 1fr); }
    #custom-grid { grid-template-columns: repeat(2, 1fr); }
    #pro-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
    #travel-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
    #custom-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
    #pro-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
}

/* ── Notation d'items / complétion de listes ────────────────────────────── */
.complete-header { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.complete-profiles { display: flex; align-items: center; gap: 10px; font-size: 14px; color: #555; }
.list-selector { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #555; flex-wrap: wrap; }
.list-selector select { padding: 4px 8px; border: 1px solid #ccc; border-radius: 6px; font-size: 13px; background: #fff; }
.new-list-name-input { display: none; align-items: center; gap: 8px; margin-top: 6px; font-size: 13px; }
.new-list-name-input.active { display: flex; }
.new-list-name-input input { flex: 1; padding: 6px 10px; border: 1px solid #ccc; border-radius: 6px; font-size: 13px; max-width: 260px; }
.items-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.item-card { background: #fff; border: 2px solid #e0e0e0; border-radius: 8px; padding: 12px 14px; transition: border-color 0.15s, background 0.15s; }
.item-card.rated { border-color: #27ae60; background: #f0fff4; }
.item-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; gap: 8px; }
.item-card-name { font-weight: 600; font-size: 14px; flex: 1; }
.item-comment-toggle { background: none; border: none; color: #bbb; cursor: pointer; padding: 2px 4px; font-size: 14px; transition: color 0.15s; flex-shrink: 0; }
.item-comment-toggle:hover, .item-comment-toggle.active { color: #3498db; }
.item-score-buttons { display: flex; gap: 2px; }
.item-score-btn { background: none; border: 2px solid transparent; border-radius: 8px; cursor: pointer; font-size: 22px; padding: 2px 4px; line-height: 1; transition: all 0.15s; opacity: 0.4; }
.item-score-btn:hover { transform: scale(1.15); opacity: 0.8; }
.item-score-btn.selected { opacity: 1; transform: scale(1.05); border-color: #3498db; }
.item-comment-row { display: none; margin-top: 8px; }
.item-comment-row.active { display: flex; gap: 6px; align-items: center; }
.item-comment-row input { flex: 1; padding: 5px 8px; border: 1px solid #ddd; border-radius: 6px; font-size: 12px; }
.item-comment-row input:focus { border-color: #3498db; outline: none; }
.item-saving { font-size: 11px; color: #27ae60; margin-top: 4px; height: 14px; }
.item-comment-display { margin-top: 6px; font-size: 12px; color: #666; font-style: italic; display: none; }
.item-comment-display.active { display: block; }
.travel-items-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.travel-item-card { background: #fff; border: 2px solid #e0e0e0; border-radius: 8px; overflow: hidden; transition: border-color 0.15s; }
.travel-item-card.rated { border-color: #27ae60; }
.travel-item-photo { width: 100%; height: 100px; object-fit: cover; }
.travel-item-photo-placeholder { width: 100%; height: 100px; background: #f0f4f8; display: flex; align-items: center; justify-content: center; color: #aaa; font-size: 1.5rem; }
.travel-item-body { padding: 10px 12px; }
.travel-item-name { font-weight: 600; font-size: 14px; margin-bottom: 2px; }
.travel-item-meta { font-size: 12px; color: #888; margin-bottom: 8px; }

/* ── Grilles notation/complétion : 2 colonnes tablette ──────────────────── */
@media (max-width: 1024px) {
    .items-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
    .items-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
}

/* ── Bouton aide contextuelle ──────────────────────────────────────────── */
.help-btn {
    position: fixed;
    top: 18px;
    right: 0;
    z-index: 1050;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: #2980b9;
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: -2px 2px 8px #0003;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translateX(calc(100% - 28px));
    transition: transform 0.2s ease, background 0.15s;
    will-change: transform;
}
.help-btn:hover { transform: translateX(-4px); background: #1a6a99; }

.help-modal-overlay {
    position: fixed;
    inset: 0;
    background: #0006;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.help-modal {
    background: #fff;
    border-radius: 10px;
    width: min(80vw, calc(100vw - 40px));
    max-height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px #0003;
}
.help-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
}
.help-modal-title { font-weight: 700; font-size: 15px; }
.help-modal-close { background: none; border: none; cursor: pointer; font-size: 16px; color: #666; display: flex; align-items: center; }
.help-modal-close:hover { color: #e74c3c; }
.help-modal-body { padding: 16px; overflow-y: auto; flex: 1; }
.help-modal-body .tuto-card { margin-bottom: 0; box-shadow: none; border: none; padding: 0; }
.help-modal-loading { text-align: center; color: #aaa; padding: 20px 0; }

@media (max-width: 768px) {
    .help-modal-overlay { padding: 12px; }
    .help-modal { width: 100%; }
}

.dark-mode .help-modal { background: #1e1e2e; }
.dark-mode .help-modal-header { border-bottom-color: #2a2a3a; }
.dark-mode .help-modal-close { color: #aaa; }

/* ── Page tutoriel ─────────────────────────────────────────────────────── */
.tuto-search-wrap { position: relative; margin-bottom: 20px; }
.tuto-search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #999; pointer-events: none; }
.tuto-search-input { width: 100%; padding: 10px 12px 10px 36px; border: 1px solid #d0d8e4; border-radius: 8px; font-size: 14px; background: #fff; }
.tuto-search-input:focus { outline: 2px solid #8e44ad; border-color: #8e44ad; }
.tuto-no-results { color: #888; text-align: center; padding: 20px 0; }
.tuto-result-item { margin-bottom: 16px; }
.tuto-result-breadcrumb { display: inline-block; font-size: 11px; color: #8e44ad; text-decoration: none; font-weight: 700; margin-bottom: 6px; }
.tuto-result-breadcrumb:hover { text-decoration: underline; }
.tuto-result-item .tuto-card { margin-bottom: 0; }
mark.tuto-mark { background: #fef08a; color: #000; border-radius: 2px; padding: 0 2px; font-style: normal; }
.tuto-layout { display: flex; gap: 24px; align-items: flex-start; }
.tuto-toc { width: 220px; min-width: 220px; position: sticky; top: 20px; font-size: 13px; }
.tuto-toc-title { font-weight: 700; font-size: 14px; margin-bottom: 10px; }
.tuto-toc-list { margin: 0; padding-left: 16px; }
.tuto-toc-list li { margin-bottom: 5px; }
.tuto-toc-list ol { padding-left: 14px; margin-top: 4px; }
.tuto-toc-list a { color: #2c3e50; text-decoration: none; }
.tuto-toc-list a:hover { color: #8e44ad; text-decoration: underline; }
.tuto-content { flex: 1; min-width: 0; }
.tuto-section { margin-bottom: 32px; }
.tuto-h2 { font-size: 18px; font-weight: 700; margin: 0 0 12px; padding-bottom: 8px; border-bottom: 2px solid #e0e0e0; }
.tuto-h3 { font-size: 15px; font-weight: 700; margin: 16px 0 8px; }
.tuto-h4 { font-size: 14px; font-weight: 600; margin: 12px 0 6px; color: #555; }
.tuto-card { margin-bottom: 12px; }
.tuto-list { padding-left: 20px; margin: 8px 0; }
.tuto-list li { margin-bottom: 6px; line-height: 1.5; }
.tuto-ui { display: inline-flex; align-items: center; gap: 3px; background: #f0f4f8; border: 1px solid #d0d8e4; border-radius: 4px; padding: 2px 6px; font-size: 12px; vertical-align: middle; white-space: nowrap; }
.tuto-tip { background: #fef9e7; border-left: 3px solid #f1c40f; border-radius: 4px; padding: 10px 14px; margin: 12px 0; font-size: 13px; }
.tuto-tip i { color: #f39c12; margin-right: 4px; }

@media (max-width: 1024px) {
    .tuto-layout { flex-direction: column; }
    .tuto-toc { width: 100%; min-width: unset; position: static; }
}

.dark-mode .tuto-search-input { background: #1e1e2e; border-color: #3a3a4a; color: #d0d0e0; }
.dark-mode .tuto-result-breadcrumb { color: #a78bfa; }
.dark-mode mark.tuto-mark { background: #7c6d00; color: #fff; }
.dark-mode .tuto-search-icon { color: #666; }
.dark-mode .tuto-toc-list a { color: #d0d0e0; }
.dark-mode .tuto-h2 { border-bottom-color: #2a2a3a; }
.dark-mode .tuto-h4 { color: #aaa; }
.dark-mode .tuto-ui { background: #1e1e2e; border-color: #3a3a4a; }
.dark-mode .tuto-tip { background: #2a2a1a; border-left-color: #b7950b; }

/* CSS-only tabs for tutorial popups */
.tuto-tabs > input[type="radio"] { display: none; }
.tuto-tab-bar { display: flex; border-bottom: 2px solid #e9ecef; margin-bottom: 14px; flex-wrap: wrap; }
.tuto-tab-lbl { padding: 7px 13px; cursor: pointer; font-size: 13px; font-weight: 500; color: #666; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: color 0.15s; }
.tuto-tab-lbl:hover { color: #3498db; }
.tuto-tabs > .tuto-tab-pane { display: none; }
.tuto-tabs > #tnt-1:checked ~ .tuto-tab-bar label[for="tnt-1"],
.tuto-tabs > #tnt-2:checked ~ .tuto-tab-bar label[for="tnt-2"],
.tuto-tabs > #tnt-3:checked ~ .tuto-tab-bar label[for="tnt-3"] { color: #3498db; border-bottom-color: #3498db; }
.tuto-tabs > #tnt-1:checked ~ #tnt-p1,
.tuto-tabs > #tnt-2:checked ~ #tnt-p2,
.tuto-tabs > #tnt-3:checked ~ #tnt-p3 { display: block; }
.dark-mode .tuto-tab-bar { border-bottom-color: #2a2a3a; }
.dark-mode .tuto-tab-lbl { color: #aaa; }
.dark-mode .tuto-tabs > #tnt-1:checked ~ .tuto-tab-bar label[for="tnt-1"],
.dark-mode .tuto-tabs > #tnt-2:checked ~ .tuto-tab-bar label[for="tnt-2"],
.dark-mode .tuto-tabs > #tnt-3:checked ~ .tuto-tab-bar label[for="tnt-3"] { color: #5ba4e5; border-bottom-color: #5ba4e5; }

/* ── Friend shares: collapsible category sections ───────────────────────── */
.share-section { border: 1px solid var(--border-color, #e9ecef); border-radius: 8px; margin-top: 12px; overflow: hidden; }
.share-section-header { display: flex; align-items: center; gap: 8px; padding: 13px 16px; cursor: pointer; list-style: none; background: var(--card-bg, #fff); font-size: 14px; font-weight: 600; user-select: none; }
.share-section-header::-webkit-details-marker { display: none; }
.share-section-header::marker { display: none; }
.share-section-title { flex: 1; }
.share-section-count { font-size: 11px; font-weight: 600; color: #888; background: #f0f0f0; border-radius: 10px; padding: 2px 8px; flex-shrink: 0; }
.share-section-chevron { font-size: 11px; color: #bbb; transition: transform 0.2s; flex-shrink: 0; }
.share-section[open] > .share-section-header .share-section-chevron { transform: rotate(180deg); }
.share-section-body { border-top: 1px solid var(--border-color, #e9ecef); padding: 0 16px 8px; }
.share-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border-color, #eee); }
.share-row:last-child { border-bottom: none; }
.share-row-label { flex: 1; font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-row-depth-1 { padding-left: 20px; }
.share-row-depth-2 { padding-left: 40px; }
.share-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.share-course-opts { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.share-course-opt-label { display: flex; align-items: center; gap: 4px; cursor: pointer; font-size: 12px; color: #555; white-space: nowrap; }
.dark-mode .share-section-header { background: var(--card-bg, #1e2d3d); }
.dark-mode .share-section-count { background: #2a2a3a; color: #aaa; }
.dark-mode .share-course-opt-label { color: #aaa; }

/* ── Email verification ── */
.check-email-icon { font-size: 2.5rem; color: var(--primary-color, #3498db); margin: 0 0 16px; }

/* ── Register form : responsive multi-colonnes ── */
@media (min-width: 768px) {
    .card-auth--register { max-width: 820px; }
    .form-body-grid--register .form-section--account { grid-row: 1 / 3; padding-right: 32px; border-right: 1px solid var(--border-color, #e0e0e0); }
    .form-body-grid--register .form-section--profile { border-top: none; padding-top: 0; margin-top: 0; padding-left: 32px; }
    .form-body-grid--register .form-section--photo { padding-left: 32px; border-top: 1px solid var(--border-color, #e0e0e0); padding-top: 24px; margin-top: 24px; }
}
@media (min-width: 1100px) {
    .card-auth--register { max-width: 1100px; }
    .form-body-grid--register { grid-template-columns: repeat(3, 1fr); }
    .form-body-grid--register .form-section--account { grid-row: auto; }
    .form-body-grid--register .form-section--profile { padding-right: 32px; border-right: 1px solid var(--border-color, #e0e0e0); border-top: none; padding-top: 0; margin-top: 0; }
    .form-body-grid--register .form-section--photo { border-top: none; padding-top: 0; margin-top: 0; }
}
