/* ===== VARIABLES ===== */
:root {
    --color-primary: #6c5ce7;
    --color-secondary: #a29bfe;
    --color-bg: #ffffff;
    --color-surface: #f8f9fa;
    --color-border: #e9ecef;
    --color-text: #2d3436;
    --color-text-light: #636e72;
    --color-text-muted: #b2bec3;
    --color-success: #00b894;
    --color-warning: #fdcb6e;
    --color-danger: #e17055;
    --color-info: #74b9ff;
    --font-title: 'Poppins', sans-serif;
    --font-body: 'Inter', sans-serif;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.15);
    --sidebar-width: 64px;
    --header-height: 56px;
    --chat-width: 300px;
    --chat-collapsed-width: 40px;
}

/* ===== ÉCRAN DE CONNEXION ===== */
.login-overlay {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #6c5ce7 0%, #a29bfe 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
}

.login-card {
    background: white;
    border-radius: 16px;
    padding: 40px 32px;
    width: 90%;
    max-width: 360px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.login-logo {
    margin-bottom: 16px;
}

.login-title {
    font-family: var(--font-title);
    font-size: 24px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 4px;
}

.login-subtitle {
    font-size: 13px;
    color: var(--color-text-light);
    margin-bottom: 24px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.login-password {
    text-align: center;
    font-size: 14px;
    padding: 12px 16px;
}

.login-btn {
    padding: 12px;
    font-size: 14px;
    font-weight: 600;
}

.login-error {
    font-size: 12px;
    color: var(--color-danger);
    min-height: 16px;
}

/* ===== RESET ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background: var(--color-bg);
    color: var(--color-text);
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ===== HEADER ===== */
.header {
    height: var(--header-height);
    background: var(--color-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    flex-shrink: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logo {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    object-fit: contain;
    background: white;
    padding: 2px;
}

.header-title {
    font-family: var(--font-title);
    font-weight: 600;
    font-size: 15px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-btn {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
    position: relative;
}

.header-btn:hover {
    opacity: 1;
}

.mobile-chat-btn {
    display: none;
}

.notif-badge {
    position: absolute;
    top: -4px;
    right: -6px;
    background: var(--color-danger);
    color: white;
    font-size: 10px;
    font-weight: 700;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-body);
}

/* ===== APP BODY ===== */
.app-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 16px;
    gap: 8px;
    flex-shrink: 0;
}

.sidebar-item {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 18px;
    transition: background 0.2s;
    cursor: pointer;
}

.sidebar-item:hover {
    background: var(--color-border);
}

.sidebar-item.active {
    background: var(--color-primary);
    color: white;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: var(--color-bg);
}

/* ===== CHAT PANEL ===== */
.chat-panel {
    background: var(--color-surface);
    border-left: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: width 0.3s ease;
}

.chat-panel.open {
    width: var(--chat-width);
}

.chat-panel.collapsed {
    width: var(--chat-collapsed-width);
}

.chat-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-avatar {
    width: 28px;
    height: 28px;
    background: var(--color-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 11px;
    font-weight: 700;
}

.chat-avatar.small {
    width: 24px;
    height: 24px;
    font-size: 9px;
}

.chat-name {
    font-weight: 600;
    font-size: 13px;
}

.chat-status-dot {
    width: 6px;
    height: 6px;
    background: var(--color-success);
    border-radius: 50%;
}

.chat-status-dot.small {
    width: 5px;
    height: 5px;
}

.chat-header-right {
    display: flex;
    gap: 8px;
}

.chat-btn {
    background: none;
    border: none;
    font-size: 12px;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.chat-btn:hover {
    opacity: 1;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-bubble {
    padding: 10px 14px;
    border-radius: var(--radius-lg);
    font-size: 12px;
    line-height: 1.5;
    max-width: 90%;
    word-wrap: break-word;
}

.chat-bubble.ia {
    background: var(--color-primary);
    color: white;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
}

.chat-bubble.user {
    background: var(--color-border);
    color: var(--color-text);
    border-bottom-right-radius: 4px;
    align-self: flex-end;
}

.chat-actions {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.chat-action-btn {
    padding: 5px 12px;
    border-radius: 8px;
    font-size: 11px;
    border: none;
    cursor: pointer;
    transition: opacity 0.2s;
}

.chat-action-btn.primary {
    background: var(--color-primary);
    color: white;
}

.chat-action-btn.secondary {
    background: var(--color-border);
    color: var(--color-text-light);
}

/* Styles chat input déplacés en fin de fichier — section CHAT INPUT AMÉLIORÉ */

.chat-send-btn {
    width: 32px;
    height: 32px;
    background: var(--color-primary);
    border-radius: 50%;
    border: none;
    color: white;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

.chat-send-btn:hover {
    opacity: 0.9;
}

/* Chat collapsed state */
.chat-collapsed {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 12px;
    gap: 6px;
}

.chat-open-label {
    font-size: 10px;
    color: var(--color-primary);
    writing-mode: vertical-lr;
    cursor: pointer;
}

.chat-panel.collapsed .chat-header,
.chat-panel.collapsed .chat-messages,
.chat-panel.collapsed .chat-input-area {
    display: none;
}

.chat-panel.collapsed .chat-collapsed {
    display: flex !important;
}

.chat-panel.open .chat-collapsed {
    display: none !important;
}

/* ===== CARDS ===== */
.card {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: 16px;
}

.card-stat {
    text-align: center;
}

.card-stat-value {
    font-size: 24px;
    font-weight: 700;
    font-family: var(--font-title);
}

.card-stat-label {
    font-size: 11px;
    color: var(--color-text-light);
    margin-top: 4px;
}

/* ===== DASHBOARD ===== */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}
.dash-stat-clickable { cursor: pointer; transition: transform 0.15s, box-shadow 0.15s; }
.dash-stat-clickable:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.dashboard-blocks {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 16px;
}
.dashboard-columns {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 16px;
    margin-top: 16px;
}

.dash-section-title {
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.dash-count {
    background: var(--color-surface);
    color: var(--color-text-light);
    font-size: 10px;
    padding: 1px 7px;
    border-radius: 10px;
    font-weight: 600;
}
.dash-empty {
    font-size: 12px;
    color: var(--color-text-muted);
    padding: 8px 0;
}

/* Dashboard posts list */
.dash-post-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    padding: 8px 6px;
    border-bottom: 1px solid var(--color-border);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background 0.15s;
}
.dash-post-item:hover { background: var(--color-surface); }
.dash-post-item:last-child { border-bottom: none; }
.dash-post-date {
    color: var(--color-text-muted);
    font-size: 11px;
    min-width: 75px;
}
.dash-post-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dash-post-indicators {
    display: flex;
    gap: 2px;
    font-size: 11px;
}

/* Dashboard alerts */
.dash-alerts { border-left: 3px solid var(--color-warning); }
.dash-alert-list { display: flex; flex-direction: column; gap: 2px; }
.dash-alert-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    padding: 6px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s;
}
.dash-alert-item:hover { background: var(--color-surface); }
.dash-alert-icon { font-size: 10px; }
.dash-alert-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}
.dash-alert-msg {
    font-size: 10px;
    color: var(--color-text-muted);
    white-space: nowrap;
}
.dash-more {
    font-size: 11px;
    color: var(--color-text-muted);
    text-align: center;
    padding: 4px;
}

/* Dashboard blocks — drag & drop */
.dash-block {
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;
}
.dash-block-drag-handle {
    position: absolute;
    top: 8px;
    right: 8px;
    cursor: grab;
    color: var(--color-text-muted);
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.2s;
    user-select: none;
    line-height: 1;
}
.dash-block:hover .dash-block-drag-handle { opacity: 0.5; }
.dash-block-drag-handle:hover { opacity: 1 !important; }
.dash-block-dragging {
    opacity: 0.5;
    transform: scale(0.98);
    box-shadow: var(--shadow-md);
}
.dash-block-dragover {
    border: 2px dashed var(--color-primary) !important;
    background: rgba(108, 92, 231, 0.03);
}

/* Dashboard dates clés */
.dash-date-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    padding: 7px 6px;
    border-bottom: 1px solid var(--color-border);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background 0.15s;
}
.dash-date-item:hover { background: var(--color-surface); }
.dash-date-item:last-child { border-bottom: none; }
.dash-date-day {
    font-weight: 600;
    color: var(--color-primary);
    min-width: 55px;
    font-size: 11px;
}
.dash-date-name { flex: 1; }
.dash-date-countdown {
    font-size: 10px;
    font-weight: 600;
    color: var(--color-danger);
    background: #fff3e0;
    padding: 2px 6px;
    border-radius: 8px;
}
.dash-date-dismiss {
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    font-size: 12px;
    padding: 2px 4px;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.2s, color 0.15s, background 0.15s;
    line-height: 1;
}
.dash-date-item:hover .dash-date-dismiss { opacity: 1; }
.dash-date-dismiss:hover { color: var(--color-danger); background: #fee; }

/* Suggestion assistant */
.dash-suggestion-block { border-left: 3px solid var(--color-primary); }
.dash-suggestion-text {
    font-size: 12px;
    line-height: 1.6;
    color: var(--color-text);
}
.dash-suggestion-placeholder {
    animation: pulse 1.5s infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* ===== MODALE ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.modal-content {
    background: var(--color-bg);
    border-radius: var(--radius-lg);
    padding: 24px;
    max-width: 600px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

/* ===== TOASTS ===== */
.toast-container {
    position: fixed;
    bottom: 16px;
    right: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 300;
    max-width: 360px;
}

.toast {
    background: white;
    border-radius: var(--radius-md);
    padding: 14px 16px;
    box-shadow: var(--shadow-md);
    display: flex;
    gap: 12px;
    align-items: flex-start;
    border-left: 4px solid var(--color-primary);
    animation: slideIn 0.3s ease;
}

.toast-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.toast-body {
    flex: 1;
}

.toast-title {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 2px;
}

.toast-message {
    font-size: 11px;
    color: var(--color-text-light);
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    font-size: 14px;
    color: var(--color-text-muted);
    cursor: pointer;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ===== NOTIFICATION DROPDOWN ===== */
.notif-dropdown {
    position: fixed;
    top: calc(var(--header-height) + 4px);
    right: 16px;
    width: 380px;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 150;
    overflow: hidden;
}

.notif-dropdown-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.notif-dropdown-title {
    font-weight: 700;
    font-size: 14px;
}

.notif-mark-read {
    background: none;
    border: none;
    font-size: 11px;
    color: var(--color-primary);
    cursor: pointer;
}

.notif-dropdown-list {
    max-height: 400px;
    overflow-y: auto;
}

/* ===== FORMULAIRES ===== */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-light);
    margin-bottom: 4px;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: var(--font-body);
    outline: none;
    transition: border-color 0.2s;
    background: white;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--color-primary);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

/* ===== BADGES ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    color: white;
}

.badge-facebook { background: #3b5998; }
.badge-instagram { background: #e1306c; }
.badge-linkedin { background: #0077b5; }
.badge-tiktok { background: #000000; }

.badge-statut-idee { background: var(--color-border); color: var(--color-text-light); }
.badge-statut-en_cours { background: #fff3e0; color: var(--color-warning); border: 1px solid var(--color-warning); }
.badge-statut-a_valider { background: #e3f2fd; color: var(--color-info); border: 1px solid var(--color-info); }
.badge-statut-programme { background: #e8f5e9; color: var(--color-success); border: 1px solid var(--color-success); }
.badge-statut-publie { background: var(--color-success); color: white; }

/* ===== BOUTONS ===== */
.btn {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-family: var(--font-body);
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn:hover {
    opacity: 0.9;
}

.btn-primary {
    background: var(--color-primary);
    color: white;
}

.btn-secondary {
    background: var(--color-surface);
    color: var(--color-text);
}

.btn-danger {
    background: #fff0f0;
    color: var(--color-danger);
}

/* ===== SECTION PAGES ===== */
.section-title {
    font-family: var(--font-title);
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
}

.section-subtitle {
    font-size: 13px;
    color: var(--color-text-light);
    margin-bottom: 20px;
}

/* ===== GRID UTILITAIRES ===== */
.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

/* ===== CALENDRIER ===== */
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    margin-bottom: 16px;
}

.calendar-counters {
    display: flex;
    gap: 12px;
    font-size: 12px;
}

.calendar-counter {
    padding: 3px 10px;
    border-radius: 4px;
    font-weight: 600;
}

.calendar-counter.programme { background: #e8f5e9; color: var(--color-success); }
.calendar-counter.en-cours { background: #fff3e0; color: var(--color-warning); }
.calendar-counter.idee { background: var(--color-surface); color: var(--color-text-light); }
.calendar-counter.clickable { cursor: pointer; transition: transform 0.15s, box-shadow 0.15s; }
.calendar-counter.clickable:hover { transform: translateY(-1px); box-shadow: 0 2px 8px rgba(0,0,0,0.1); }

/* PANNEAU FILTRE COMPTEURS */
.counter-filter-panel {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 50;
    background: white;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    min-width: 320px;
    max-width: 420px;
    max-height: 300px;
    overflow-y: auto;
    margin-top: 6px;
}
.calendar-counters { position: relative; }
.counter-filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid var(--color-border);
    font-size: 12px;
}
.counter-filter-list { padding: 4px 0; }
.counter-filter-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.15s;
}
.counter-filter-item:hover { background: var(--color-surface); }
.counter-filter-date {
    color: var(--color-text-muted);
    font-size: 11px;
    min-width: 80px;
}
.counter-filter-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.counter-filter-empty {
    padding: 16px;
    text-align: center;
    font-size: 11px;
    color: var(--color-text-muted);
}

.calendar-nav {
    display: flex;
    align-items: center;
    gap: 12px;
}

.calendar-nav-btn {
    border: 1px solid var(--color-border);
    background: white;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 12px;
}

.calendar-nav-btn:hover {
    background: var(--color-surface);
}

.calendar-nav-title {
    font-weight: 700;
    font-size: 15px;
    font-family: var(--font-title);
    min-width: 160px;
    text-align: center;
}

.calendar-view-toggle {
    display: flex;
    gap: 4px;
}

.calendar-view-btn {
    padding: 5px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text-light);
}

.calendar-view-btn.active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

/* ===== GRILLE MOIS ===== */
.month-grid-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border-bottom: 1px solid var(--color-border);
}

.month-grid-header-day {
    text-align: center;
    padding: 8px;
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-light);
}

.month-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.month-day {
    padding: 6px;
    min-height: 105px;
    border-right: 1px solid #f0f0f0;
    border-bottom: 1px solid #f0f0f0;
}

.month-day:nth-child(7n) {
    border-right: none;
}

.month-day.outside {
    opacity: 0.4;
}

.month-day.today {
    background: #f0f0ff;
}

.month-day-number {
    font-size: 11px;
    color: var(--color-text);
    margin-bottom: 4px;
}

.month-day-number.has-event {
    font-weight: 600;
}

.month-day-event {
    display: inline-block;
    margin-left: 4px;
    background: var(--color-danger);
    color: white;
    font-size: 8px;
    padding: 1px 5px;
    border-radius: 3px;
}

/* Post inline (vue mois) */
.month-post {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 3px 5px;
    border-radius: 4px;
    background: var(--color-surface);
    margin-bottom: 3px;
    cursor: pointer;
    font-size: 10px;
    transition: opacity 0.2s;
}

.month-post:hover {
    opacity: 0.8;
}

.month-post.statut-programme,
.month-post.statut-publie { border-left: 3px solid var(--color-success); }
.month-post.statut-en_cours,
.month-post.statut-a_valider { border-left: 3px solid var(--color-warning); }
.month-post.statut-idee { border-left: 3px solid var(--color-text-muted); }

.month-post-time {
    font-weight: 700;
    font-size: 9px;
    min-width: 28px;
    color: var(--color-primary);
}

.month-post-time.empty {
    color: var(--color-text-muted);
}

.month-post-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.month-post-thumb {
    width: 20px;
    height: 20px;
    border-radius: 3px;
    object-fit: cover;
    flex-shrink: 0;
}

/* ===== VUE SEMAINE ===== */
.week-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    min-height: 420px;
}

.week-day {
    border-right: 1px solid #f0f0f0;
}

.week-day:last-child {
    border-right: none;
}

.week-day-header {
    padding: 10px;
    text-align: center;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface);
}

.week-day-name {
    font-size: 10px;
    color: var(--color-text-light);
    font-weight: 600;
}

.week-day-number {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-text);
}

.week-day-body {
    padding: 8px;
}

.week-day-add {
    color: var(--color-text-muted);
    font-size: 10px;
    text-align: center;
    margin-top: 40px;
    cursor: pointer;
}

.week-day-add:hover {
    color: var(--color-primary);
}

/* Card post (vue semaine) */
.week-post-card {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 8px;
    background: white;
    cursor: pointer;
    margin-bottom: 8px;
    transition: box-shadow 0.2s;
}

.week-post-card:hover {
    box-shadow: var(--shadow-sm);
}

.week-post-card.statut-programme,
.week-post-card.statut-publie { border-left: 4px solid var(--color-success); }
.week-post-card.statut-en_cours,
.week-post-card.statut-a_valider { border-left: 4px solid var(--color-warning); }
.week-post-card.statut-idee { border-left: 4px solid var(--color-text-muted); }

.week-post-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.week-post-title {
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 4px;
}

.week-post-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.week-post-time {
    color: var(--color-primary);
    font-weight: 700;
    font-size: 11px;
}

.week-post-format {
    font-size: 9px;
    color: var(--color-text-light);
}

.week-post-indicators {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
}

.indicator-badge {
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 600;
}

.indicator-badge.valide { background: #e8f5e9; color: var(--color-success); }
.indicator-badge.en_cours { background: #fff3e0; color: var(--color-warning); }
.indicator-badge.vide { background: var(--color-surface); color: var(--color-text-muted); }

.week-post-thumb {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    flex-shrink: 0;
}

.week-post-actions {
    display: flex;
    gap: 4px;
    border-top: 1px solid #f0f0f0;
    padding-top: 6px;
}

.week-action-btn {
    font-size: 9px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: 2px 6px;
    cursor: pointer;
}

.week-action-btn:hover {
    background: var(--color-border);
}

/* ===== MODALE FICHE POST ===== */
.post-modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.post-modal-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: var(--color-text-muted);
}

.post-modal-body {
    padding: 20px;
    max-height: 65vh;
    overflow-y: auto;
}

.post-section-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
    margin-top: 20px;
}

.post-section-label:first-child {
    margin-top: 0;
}

.post-indicators {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.post-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--color-text-light);
    font-weight: 600;
}

.post-indicator-badge {
    font-size: 10px;
    padding: 3px 10px;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
}

.post-indicator-badge.valide { background: #e8f5e9; color: var(--color-success); }
.post-indicator-badge.en_cours { background: #fff3e0; color: var(--color-warning); }
.post-indicator-badge.vide { background: var(--color-surface); color: var(--color-text-muted); }

/* Zone visuel */
.visual-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.visual-btn-upload,
.visual-btn-create {
    flex: 1;
    padding: 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.visual-btn-upload {
    border: 2px dashed var(--color-border);
    background: var(--color-surface);
    color: var(--color-text-light);
}

.visual-btn-create {
    border: 2px dashed var(--color-secondary);
    background: #f8f7ff;
    color: var(--color-primary);
    position: relative;
}

.visual-btn-create .phase-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: var(--color-warning);
    color: var(--color-text);
    font-size: 8px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
}

.visual-preview {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.visual-thumb {
    width: 120px;
    height: 120px;
    border-radius: var(--radius-md);
    object-fit: cover;
    position: relative;
}

.visual-thumb-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0,0,0,0.5);
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 10px;
    cursor: pointer;
}

.visual-note {
    background: #fffde7;
    border: 1px dashed var(--color-warning);
    border-radius: var(--radius-sm);
    padding: 10px;
}

.visual-note label {
    font-size: 10px;
    font-weight: 600;
    color: var(--color-text-light);
    display: block;
    margin-bottom: 4px;
}

.visual-note textarea {
    width: 100%;
    padding: 6px 8px;
    border: none;
    background: transparent;
    font-size: 11px;
    font-family: var(--font-body);
    resize: none;
    min-height: 36px;
    outline: none;
}

/* Hashtags pills */
.hashtags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    min-height: 36px;
}

.hashtag-pill {
    background: var(--color-primary);
    color: white;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.hashtag-pill .remove {
    cursor: pointer;
    opacity: 0.7;
}

.hashtag-pill .remove:hover {
    opacity: 1;
}

.hashtag-input {
    border: none;
    outline: none;
    font-size: 11px;
    font-family: var(--font-body);
    min-width: 80px;
    flex: 1;
}

/* Statut buttons */
.statut-buttons {
    display: flex;
    gap: 6px;
}

.statut-btn {
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    border: 1px solid var(--color-border);
    background: white;
    color: var(--color-text-light);
    cursor: pointer;
}

.statut-btn.active-idee { background: var(--color-text-muted); color: white; border-color: var(--color-text-muted); }
.statut-btn.active-en_cours { background: var(--color-warning); color: white; border-color: var(--color-warning); }
.statut-btn.active-a_valider { background: var(--color-info); color: white; border-color: var(--color-info); }
.statut-btn.active-programme { background: var(--color-success); color: white; border-color: var(--color-success); }
.statut-btn.active-publie { background: var(--color-success); color: white; border-color: var(--color-success); }

/* Footer modale */
.post-modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Lien parenté */
.post-parent-link {
    padding: 8px 12px;
    background: #f0f0ff;
    border-radius: var(--radius-sm);
    font-size: 11px;
    color: var(--color-text-light);
    margin-bottom: 16px;
}

.post-parent-link a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 600;
}

/* Dimensions hint */
.dimension-hint {
    font-size: 10px;
    color: var(--color-text-muted);
    margin-top: 4px;
}

/* ===== SECTION POSTS (liste) ===== */
.posts-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    align-items: center;
}

.posts-filter-select {
    padding: 6px 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-family: var(--font-body);
    background: white;
}

.posts-list-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--color-border);
    cursor: pointer;
    transition: background 0.2s;
}

.posts-list-item:hover {
    background: var(--color-surface);
}

.posts-list-date {
    font-size: 11px;
    color: var(--color-text-muted);
    min-width: 80px;
}

.posts-list-time {
    font-size: 11px;
    color: var(--color-primary);
    font-weight: 700;
    min-width: 36px;
}

.posts-list-title {
    flex: 1;
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.posts-list-thumb {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    object-fit: cover;
}

/* ===== CHAT INPUT AMÉLIORÉ ===== */
.chat-input-area {
    padding: 10px 12px;
    border-top: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chat-file-preview {
    padding: 6px 8px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
}

.chat-file-preview-inner {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-attachment {
    margin-bottom: 6px;
}

.chat-attachment img {
    display: block;
    max-width: 100%;
    border-radius: 8px;
}

#chat-upload-btn {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

textarea.chat-input {
    width: 100%;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 8px 14px;
    font-size: 12px;
    font-family: var(--font-body);
    outline: none;
    transition: border-color 0.2s;
    resize: none;
    min-height: 42px;
    max-height: 108px;
    overflow-y: auto;
    line-height: 1.4;
}

textarea.chat-input:focus {
    border-color: var(--color-primary);
}

.chat-input-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
}

.chat-icon-btn {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.chat-icon-btn:hover {
    opacity: 1;
}

.chat-icon-btn.recording {
    opacity: 1;
    color: var(--color-danger);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ===== EMOJI PICKER ===== */
.emoji-picker {
    position: absolute;
    bottom: 100%;
    right: 0;
    width: 280px;
    background: white;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    z-index: 100;
    margin-bottom: 4px;
}

.emoji-tabs {
    display: flex;
    border-bottom: 1px solid var(--color-border);
    padding: 4px;
    gap: 2px;
}

.emoji-tab {
    background: none;
    border: none;
    font-size: 16px;
    padding: 4px 6px;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0.5;
}

.emoji-tab.active {
    opacity: 1;
    background: var(--color-surface);
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    padding: 8px;
    max-height: 160px;
    overflow-y: auto;
}

.emoji-item {
    font-size: 18px;
    padding: 4px;
    text-align: center;
    cursor: pointer;
    border-radius: 4px;
}

.emoji-item:hover {
    background: var(--color-surface);
}

/* ===== PANNEAU GÉNÉRATION VISUELLE ===== */
.visual-gen-panel {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 12px;
    background: var(--color-surface);
    margin-bottom: 12px;
}

.visual-gen-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.visual-gen-moteur {
    font-size: 10px;
    color: var(--color-text-muted);
}

.visual-gen-change {
    background: none;
    border: none;
    color: var(--color-primary);
    font-size: 10px;
    cursor: pointer;
    text-decoration: underline;
    margin-left: 4px;
}

.visual-gen-prompt-area {
    margin-bottom: 10px;
}

.visual-gen-prompt {
    width: 100%;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    font-size: 11px;
    font-family: var(--font-body);
    resize: vertical;
    min-height: 60px;
    outline: none;
}

.visual-gen-prompt:focus {
    border-color: var(--color-primary);
}

.visual-gen-dims {
    font-size: 10px;
    color: var(--color-text-muted);
    margin-top: 4px;
}

.visual-gen-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.visual-gen-img {
    width: 100%;
    max-height: 300px;
    object-fit: contain;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    margin-bottom: 10px;
}

/* Dropdown moteur */
.moteur-dropdown {
    background: white;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    z-index: 200;
    min-width: 140px;
}

.moteur-option {
    padding: 8px 12px;
    font-size: 12px;
    cursor: pointer;
}

.moteur-option:hover {
    background: var(--color-surface);
}

.moteur-option.active {
    color: var(--color-primary);
    font-weight: 600;
}

/* ===== TEMPLATES GALLERY ===== */
.tpl-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.tpl-filter-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid var(--color-border);
    border-radius: 20px;
    background: var(--color-bg);
    color: var(--color-text-light);
    font-size: 13px;
    font-family: var(--font-body);
    cursor: pointer;
    transition: all 0.2s;
}

.tpl-filter-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.tpl-filter-btn.active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

.tpl-filter-wrap {
    position: relative;
    display: inline-flex;
}

.tpl-filter-wrap .tpl-filter-btn {
    padding-right: 24px;
}

.tpl-filter-del {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 14px;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.2s;
}

.tpl-filter-wrap:hover .tpl-filter-del {
    opacity: 1;
}

.tpl-filter-del:hover {
    color: var(--color-danger);
}

.tpl-filter-add {
    border-style: dashed;
    font-size: 16px;
    font-weight: 600;
    min-width: 38px;
    padding: 8px 12px;
}

.tpl-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.tpl-card {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: box-shadow 0.2s, transform 0.2s;
}

.tpl-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.tpl-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tpl-card-icon {
    font-size: 28px;
}

.tpl-card-cat {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tpl-card-title {
    font-family: var(--font-title);
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text);
    margin: 0;
}

.tpl-card-desc {
    font-size: 13px;
    color: var(--color-text-light);
    margin: 0;
    line-height: 1.4;
}

.tpl-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tpl-card-format {
    font-size: 12px;
    color: var(--color-text-muted);
    text-transform: capitalize;
}

.tpl-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tpl-tag {
    font-size: 11px;
    color: var(--color-primary);
    background: var(--color-primary)10;
    padding: 2px 8px;
    border-radius: 10px;
}

.tpl-card-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid var(--color-border);
}

.tpl-card-actions .btn-sm {
    padding: 6px 14px;
    font-size: 12px;
}

.tpl-card-actions .btn-ghost {
    background: none;
    border: 1px solid var(--color-border);
    color: var(--color-text-light);
}

.tpl-card-actions .btn-ghost:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.tpl-preview-modal {
    max-width: 600px;
    width: 90%;
}

.tpl-preview-text {
    background: var(--color-surface);
    border-radius: var(--radius-sm);
    padding: 14px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--color-text);
    white-space: pre-wrap;
}

/* Menu contextuel template */
.tpl-menu-btn {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    line-height: 1;
}

.tpl-menu-btn:hover {
    background: var(--color-surface);
    color: var(--color-text);
}

.tpl-context-menu {
    position: fixed;
    z-index: 1000;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    min-width: 150px;
    padding: 4px 0;
}

.tpl-context-menu button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 8px 14px;
    border: none;
    background: none;
    font-size: 13px;
    font-family: var(--font-body);
    color: var(--color-text);
    cursor: pointer;
}

.tpl-context-menu button:hover {
    background: var(--color-surface);
}

/* Éditeur de template (modal) */
.tpl-editor-modal,
.tpl-preview-modal {
    max-width: 680px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    background: var(--color-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.tpl-editor-form .grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

/* Emoji picker pour icône template */
.tpl-emoji-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.tpl-emoji-opt {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-bg);
    font-size: 16px;
    cursor: pointer;
    transition: all 0.15s;
    padding: 0;
}

.tpl-emoji-opt:hover {
    border-color: var(--color-primary);
    transform: scale(1.15);
}

.tpl-emoji-opt.active {
    border-color: var(--color-primary);
    background: var(--color-primary)15;
    box-shadow: 0 0 0 2px var(--color-primary)30;
}

/* ===== ÉDITEUR VISUEL ===== */
.editor-overlay {
    position: fixed;
    inset: 0;
    z-index: 250;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
}

.editor-container {
    display: flex;
    gap: 0;
    max-width: 96vw;
    max-height: 96vh;
    width: 100%;
    height: 100%;
}

.editor-canvas-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: repeating-conic-gradient(#2a2a2a 0% 25%, #333 0% 50%) 50% / 20px 20px;
}

#editor-canvas {
    box-shadow: 0 4px 40px rgba(0, 0, 0, 0.5);
    cursor: default;
}

.editor-sidebar {
    width: 280px;
    min-width: 280px;
    background: var(--color-bg);
    border-left: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.editor-close-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    border-bottom: 1px solid var(--color-border);
}

.editor-title {
    font-family: var(--font-title);
    font-weight: 600;
    font-size: 14px;
    color: var(--color-text);
}

.editor-close-btn {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
}

.editor-close-btn:hover {
    background: var(--color-surface);
    color: var(--color-text);
}

.editor-toolbar {
    display: flex;
    gap: 4px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--color-border);
}

.editor-tool-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 4px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-bg);
    cursor: pointer;
    transition: all 0.15s;
}

.editor-tool-btn:hover {
    border-color: var(--color-primary);
    background: var(--color-primary)08;
}

.editor-tool-icon {
    font-size: 18px;
}

.editor-tool-label {
    font-size: 10px;
    color: var(--color-text-light);
}

.editor-section {
    padding: 12px 14px;
    border-bottom: 1px solid var(--color-border);
}

.editor-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-muted);
    margin-bottom: 8px;
}

.editor-bg-types {
    display: flex;
    gap: 4px;
    margin-bottom: 10px;
}

.editor-bg-type-btn {
    flex: 1;
    padding: 5px 8px;
    font-size: 11px;
    font-family: var(--font-body);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-bg);
    color: var(--color-text-light);
    cursor: pointer;
    transition: all 0.15s;
}

.editor-bg-type-btn.active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

.editor-prop-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.editor-prop-label {
    font-size: 12px;
    color: var(--color-text-light);
    white-space: nowrap;
}

.editor-color-input {
    width: 36px;
    height: 28px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 1px;
    cursor: pointer;
}

.editor-mini-btn {
    padding: 3px 8px;
    font-size: 11px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-bg);
    color: var(--color-text-light);
    cursor: pointer;
    font-family: var(--font-body);
    transition: all 0.15s;
}

.editor-mini-btn.active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

.editor-mini-btn:hover {
    border-color: var(--color-primary);
}

.editor-hint {
    font-size: 12px;
    color: var(--color-text-muted);
    font-style: italic;
    margin: 4px 0;
}

.editor-layers-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.editor-layer-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s;
}

.editor-layer-item:hover {
    background: var(--color-surface);
}

.editor-layer-item.selected {
    background: var(--color-primary)15;
    border: 1px solid var(--color-primary)30;
}

.editor-layer-name {
    font-size: 12px;
    color: var(--color-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.editor-layer-btns {
    display: flex;
    gap: 2px;
}

.editor-layer-btns button {
    background: none;
    border: none;
    font-size: 14px;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
}

.editor-layer-btns button:hover {
    background: var(--color-border);
    color: var(--color-text);
}

.editor-actions {
    margin-top: auto;
    padding: 14px;
    border-top: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.editor-text-overlay {
    position: fixed;
    z-index: 300;
    background: transparent;
    border: 2px solid var(--color-primary);
    outline: none;
    resize: none;
    overflow: hidden;
    line-height: 1.3;
    padding: 0;
    margin: 0;
}

/* Menu choix visuel (IA / Éditeur) */
.visual-choice-menu {
    position: fixed;
    z-index: 200;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    min-width: 180px;
    padding: 4px 0;
}

.visual-choice-menu button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px 16px;
    border: none;
    background: none;
    font-size: 13px;
    font-family: var(--font-body);
    color: var(--color-text);
    cursor: pointer;
}

.visual-choice-menu button:hover {
    background: var(--color-surface);
}

/* ===== RESPONSIVE — TABLETTE (≤ 1024px) ===== */
@media (max-width: 1024px) {
    .chat-panel.open {
        width: 260px;
    }

    .main-content {
        padding: 16px;
    }

    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .month-day {
        min-height: 80px;
    }
}

/* ===== RESPONSIVE — MOBILE (≤ 768px) ===== */
@media (max-width: 768px) {
    :root {
        --sidebar-width: 0px;
        --chat-width: 100%;
    }

    body {
        overflow: auto;
        height: auto;
        min-height: 100vh;
    }

    .app-body {
        flex-direction: column;
        min-height: calc(100vh - var(--header-height) - 56px);
    }

    /* Sidebar → bottom nav */
    .sidebar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: 56px;
        flex-direction: row;
        justify-content: space-around;
        align-items: center;
        padding: 0;
        gap: 0;
        border-right: none;
        border-top: 1px solid var(--color-border);
        z-index: 100;
        background: var(--color-surface);
    }

    .sidebar-item {
        width: 44px;
        height: 44px;
        font-size: 20px;
    }

    /* Main content — pleine largeur */
    .main-content {
        flex: 1;
        padding: 14px;
        padding-bottom: 70px; /* espace pour la bottom nav */
        overflow-y: auto;
    }

    /* Chat panel → overlay plein écran */
    .chat-panel {
        position: fixed;
        top: var(--header-height);
        right: 0;
        bottom: 56px;
        width: 100% !important;
        z-index: 150;
        border-left: none;
    }

    .chat-panel.collapsed {
        display: none;
    }

    .chat-panel.open {
        width: 100%;
    }

    /* Dashboard */
    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .card-stat {
        padding: 12px;
    }

    .card-stat-value {
        font-size: 24px;
    }

    .section-title {
        font-size: 18px;
    }

    /* Dashboard blocks → full width stack */
    .dashboard-blocks {
        grid-template-columns: 1fr !important;
    }

    /* Calendrier mois → liste simplifiée */
    .month-grid-header-day {
        font-size: 9px;
        padding: 4px 2px;
    }

    .month-day {
        min-height: 55px;
        padding: 3px;
    }

    .month-day-number {
        font-size: 11px;
    }

    .month-day .post-dot-label {
        font-size: 8px;
    }

    /* Calendrier semaine */
    .week-grid {
        grid-template-columns: 1fr !important;
    }

    /* Réglages — tabs scrollables */
    .reglages-tabs,
    div:has(> .reglages-tab) {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 4px;
    }

    .reglages-tab {
        white-space: nowrap;
        font-size: 11px;
        padding: 6px 10px;
    }

    /* Grids → empilées */
    .grid-2, .grid-3 {
        grid-template-columns: 1fr !important;
    }

    /* Modals → plein écran mobile */
    .modal-content {
        width: 100%;
        max-width: 100%;
        border-radius: 0;
        max-height: 100vh;
        height: 100vh;
    }

    .modal-overlay {
        align-items: stretch;
    }

    /* Post modal */
    .post-modal-body {
        padding: 12px;
    }

    /* Toast en bas centré */
    .toast-container {
        left: 8px;
        right: 8px;
        bottom: 64px;
    }

    /* Header compact */
    .header {
        padding: 0 12px;
    }

    .header-title {
        font-size: 13px;
    }

    /* Bouton chat visible sur mobile */
    .mobile-chat-btn {
        display: inline-flex !important;
    }

    /* Reglages tabs → petite taille */
    div[style*="display: flex"][style*="gap: 4px"] {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }
}

/* Editor + Templates responsive (≤ 768px) */
@media (max-width: 768px) {
    .tpl-grid {
        grid-template-columns: 1fr;
    }
    .tpl-filters {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
    }
    .tpl-filter-btn {
        white-space: nowrap;
        flex-shrink: 0;
    }
    .tpl-preview-modal,
    .tpl-editor-modal {
        width: 100%;
        max-width: 100%;
        height: 100vh;
        border-radius: 0;
    }

    .tpl-editor-form .grid-2 {
        grid-template-columns: 1fr;
    }

    /* Editor responsive */
    .editor-container {
        flex-direction: column;
    }
    .editor-canvas-wrap {
        flex: none;
        height: 45vh;
    }
    .editor-sidebar {
        width: 100%;
        min-width: unset;
        border-left: none;
        border-top: 1px solid var(--color-border);
        max-height: 55vh;
    }
    #editor-canvas {
        max-width: 95vw;
        max-height: 40vh;
        width: auto !important;
        height: auto !important;
    }
}

/* ===== RESPONSIVE — PETIT MOBILE (≤ 480px) ===== */
@media (max-width: 480px) {
    .dashboard-stats {
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }

    .card-stat-value {
        font-size: 20px;
    }

    .card-stat-label {
        font-size: 10px;
    }

    .month-day {
        min-height: 45px;
        padding: 2px;
    }

    .month-day-number {
        font-size: 10px;
    }

    .section-title {
        font-size: 16px;
    }

    .section-subtitle {
        font-size: 12px;
    }
}
