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

html, body {
    height: 100%;
}

button {
    font-family: inherit;
    cursor: pointer;
}

input, textarea {
    font-family: inherit;
}

img {
    max-width: 100%;
}

/* ===== TOKENS LIGHT ===== */
[data-theme="light"] {
    --bg-page:        #f4f4f4;
    --bg-sidebar:     #ffffff;
    --bg-chat:        #f4f4f4;
    --bg-input:       #f8f8f8;
    --bg-msg-bot:     #ffffff;
    --bg-suggestion:  #ffffff;
    --bg-hover:       #fdf1f0;
    --bg-active:      #fdf1f0;
    --bg-search:      #f8f8f8;
    --border:         #e5e5e5;
    --text:           #333333;
    --text-muted:     #888888;
    --text-sidebar:   #555555;
    --text-active:    #CC0000;
    --text-label:     #999999;
    --shadow-msg:     0 1px 4px rgba(0,0,0,0.08);
    --red:            #CC0000;
    --red-dark:       #aa0000;
}

/* ===== TOKENS DARK ===== */
[data-theme="dark"] {
    --bg-page:        #0f1117;
    --bg-sidebar:     #16181f;
    --bg-chat:        #0f1117;
    --bg-input:       rgba(255,255,255,0.06);
    --bg-msg-bot:     rgba(255,255,255,0.06);
    --bg-suggestion:  rgba(255,255,255,0.05);
    --bg-hover:       rgba(204,0,0,0.12);
    --bg-active:      rgba(204,0,0,0.15);
    --bg-search:      rgba(255,255,255,0.06);
    --border:         rgba(255,255,255,0.07);
    --text:           #e8e8e8;
    --text-muted:     #666666;
    --text-sidebar:   #aaaaaa;
    --text-active:    #ff8a78;
    --text-label:     #555555;
    --shadow-msg:     none;
    --red:            #CC0000;
    --red-dark:       #aa0000;
}

/* ===== BODY + APP LAYOUT ===== */
body.tj-body {
    background: var(--bg-page);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    transition: background 0.25s, color 0.25s;
}

.tj-app {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.tj-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

/* ===== SIDEBAR ===== */
.tj-sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    flex-shrink: 0;
    transition: background 0.25s, border-color 0.25s;
    z-index: 10;
}

.tj-sidebar__header {
    background: var(--red);
    padding: 16px;
    color: #fff;
    flex-shrink: 0;
}

.tj-sidebar__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.tj-sidebar__logo {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}

.tj-sidebar__logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tj-sidebar__title {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    margin: 0;
}

.tj-sidebar__new-btn {
    width: 100%;
    padding: 9px 14px;
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.4);
    color: #fff;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.15s;
}

.tj-sidebar__new-btn:hover {
    background: rgba(255,255,255,0.3);
}

.tj-sidebar__search {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    transition: border-color 0.25s;
}

.tj-sidebar__search-input {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-search);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 13px;
    outline: none;
    transition: border-color 0.15s;
}

.tj-sidebar__search-input::placeholder {
    color: var(--text-muted);
}

.tj-sidebar__search-input:focus {
    border-color: var(--red);
}

.tj-sidebar__history {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.tj-sidebar__history::-webkit-scrollbar {
    width: 4px;
}

.tj-sidebar__history::-webkit-scrollbar-track {
    background: transparent;
}

.tj-sidebar__history::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.tj-history-section {
    margin-bottom: 16px;
}

.tj-history-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-label);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 4px 8px;
    margin-bottom: 4px;
    transition: color 0.25s;
}

.tj-history-item {
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-sidebar);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all 0.15s;
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
}

.tj-history-item::before {
    content: "💬 ";
    font-size: 11px;
    opacity: 0.6;
}

.tj-history-item:hover {
    background: var(--bg-hover);
    color: var(--text-active);
}

.tj-history-item.is-active {
    background: var(--bg-active);
    color: var(--text-active);
    font-weight: 500;
}

.tj-sidebar__footer {
    padding: 12px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    transition: border-color 0.25s;
}

.tj-sidebar__avatar {
    width: 34px;
    height: 34px;
    background: var(--red);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.tj-sidebar__user {
    flex: 1;
    overflow: hidden;
}

.tj-sidebar__username {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.25s;
}

.tj-sidebar__role {
    font-size: 11px;
    color: var(--text-muted);
    transition: color 0.25s;
}

.tj-theme-toggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 5px 8px;
    color: var(--text-muted);
    font-size: 16px;
    transition: all 0.15s;
    flex-shrink: 0;
}

.tj-theme-toggle:hover {
    border-color: var(--red);
    color: var(--red);
}

/* ===== ZONE CHAT + MESSAGES ===== */
.tj-topbar {
    padding: 12px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-sidebar);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    transition: background 0.25s, border-color 0.25s;
}

.tj-topbar__left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tj-topbar__title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.tj-topbar__status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

.tj-status-dot {
    width: 8px;
    height: 8px;
    background: #27ae60;
    border-radius: 50%;
}

.tj-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: var(--bg-chat);
    transition: background 0.25s;
}

/* Quand seul le welcome est visible, pas de padding parasite */
.tj-chat-messages:has(> .tj-welcome:only-child) {
    padding: 0;
}

.tj-chat-messages::-webkit-scrollbar {
    width: 4px;
}

.tj-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.tj-chat-messages::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

/* ===== WELCOME SCREEN ===== */
.tj-welcome {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 24px 16px;
}

.tj-welcome__card {
    width: 100%;
    max-width: 480px;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 16px 48px rgba(0,0,0,0.18);
}

/* Hero rouge */
.tj-welcome__hero {
    background: linear-gradient(135deg, #CC0000 0%, #990000 100%);
    padding: 40px 32px 72px;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.tj-welcome__hero::before {
    content: '';
    position: absolute;
    width: 280px; height: 280px;
    border-radius: 50%;
    background: rgba(255,255,255,0.06);
    top: -80px; right: -50px;
}
.tj-welcome__hero::after {
    content: '';
    position: absolute;
    width: 180px; height: 180px;
    border-radius: 50%;
    background: rgba(255,255,255,0.04);
    bottom: 40px; left: -30px;
}

.tj-welcome__hero-content { position: relative; z-index: 2; }

.tj-welcome__logo-circle {
    width: 80px; height: 80px;
    background: #fff;
    border-radius: 50%;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 28px rgba(0,0,0,0.25);
}
.tj-welcome__logo-circle img {
    width: 60px; height: 60px;
    object-fit: contain;
}

.tj-welcome__leo {
    font-size: 28px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.5px;
    margin-bottom: 4px;
}

.tj-welcome__tagline {
    font-size: 13px;
    color: rgba(255,255,255,0.75);
}

/* Vagues animées */
.tj-welcome__waves {
    position: absolute;
    bottom: 0; left: 0;
    width: 100%; height: 60px;
    z-index: 1;
    overflow: hidden;
}

.tj-wave-svg {
    position: absolute;
    bottom: 0; left: 0;
    width: 200%; height: 100%;
}
.tj-wave-svg--1 { animation: tj-wave-slide 3.8s linear infinite; }
.tj-wave-svg--2 { animation: tj-wave-slide 6s linear infinite reverse; opacity: 0.45; }

@keyframes tj-wave-slide {
    from { transform: translateX(0); }
    to   { transform: translateX(-50%); }
}

/* La couleur de remplissage suit le thème courant */
.tj-wave-path { fill: var(--bg-chat); }

/* Corps */
.tj-welcome__body {
    background: var(--bg-sidebar);
    padding: 32px 32px 28px;
    text-align: center;
    border-radius: 0 0 24px 24px;
    transition: background 0.25s;
}

.tj-welcome__greeting {
    font-size: 22px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 6px;
}

.tj-welcome__sub {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 24px;
}

.tj-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.tj-suggestion-btn {
    padding: 8px 16px;
    background: var(--bg-suggestion);
    border: 1px solid var(--border);
    color: var(--text-sidebar);
    border-radius: 20px;
    font-size: 13px;
    transition: all 0.15s;
}

.tj-suggestion-btn:hover {
    background: var(--bg-hover);
    border-color: var(--red);
    color: var(--red);
}

.tj-message {
    display: flex;
    gap: 10px;
    max-width: 780px;
    width: 100%;
}

.tj-message--user {
    flex-direction: row-reverse;
    margin-left: auto;
}

.tj-message__avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 2px;
}

.tj-message__avatar--bot {
    background: var(--bg-hover);
    border: 1px solid var(--border);
    color: var(--red);
}

.tj-message__avatar--user {
    background: var(--red);
    color: #fff;
}

.tj-message__bubble {
    padding: 12px 16px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.6;
    max-width: 560px;
    transition: background 0.25s;
}

.tj-message--bot .tj-message__bubble {
    background: var(--bg-msg-bot);
    color: var(--text);
    box-shadow: var(--shadow-msg);
    border: 1px solid var(--border);
    border-radius: 4px 14px 14px 14px;
}

.tj-message--user .tj-message__bubble {
    background: var(--red);
    color: #fff;
    border-radius: 14px 4px 14px 14px;
    border: none;
    box-shadow: none;
}

.tj-typing .tj-message__bubble {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 14px 16px;
}

.tj-typing-dot {
    width: 7px;
    height: 7px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: tj-bounce 1.2s infinite ease-in-out;
}

.tj-typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.tj-typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes tj-bounce {
    0%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-6px);
    }
}

.tj-input-area {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    background: var(--bg-sidebar);
    transition: background 0.25s, border-color 0.25s;
    flex-shrink: 0;
}

.tj-input-wrap {
    max-width: 780px;
    margin: 0 auto;
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.tj-input-box {
    flex: 1;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    font-size: 14px;
    outline: none;
    resize: none;
    min-height: 48px;
    max-height: 140px;
    overflow-y: auto;
    transition: border-color 0.15s, background 0.25s;
    line-height: 1.5;
}

.tj-input-box::placeholder {
    color: var(--text-muted);
}

.tj-input-box:focus {
    border-color: var(--red);
    background: var(--bg-msg-bot);
}

.tj-send-btn {
    width: 42px;
    height: 42px;
    background: var(--red);
    border: none;
    border-radius: 10px;
    color: #fff;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
}

.tj-send-btn:hover {
    background: var(--red-dark);
}

.tj-send-btn:disabled {
    background: var(--text-label);
    cursor: not-allowed;
}

/* ===== RESPONSIVE + HAMBURGER ===== */
.tj-hamburger {
    display: none;
    background: none;
    border: none;
    color: var(--text);
    font-size: 20px;
    padding: 4px 8px;
}

@media (max-width: 768px) {
    .tj-sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        height: 100vh;
        transition: left 0.25s, background 0.25s;
        box-shadow: 2px 0 16px rgba(0,0,0,0.12);
    }

    .tj-sidebar.is-open {
        left: 0;
    }

    .tj-hamburger {
        display: block;
    }

    .tj-topbar {
        gap: 10px;
    }

    .tj-sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.4);
        z-index: 9;
    }

    .tj-sidebar-overlay.is-visible {
        display: block;
    }

    .tj-chat-messages {
        padding: 16px;
    }

    .tj-input-area {
        padding: 12px 16px;
    }
}

/* ===== ADMIN BAR FIX ===== */
/* WP adds margin-top to <html> — we just need to shrink the app height */
body.admin-bar .tj-app {
    height: calc(100vh - 32px);
}
body.admin-bar .tj-sidebar {
    height: calc(100vh - 32px);
}
@media (max-width: 782px) {
    body.admin-bar .tj-app {
        height: calc(100vh - 46px);
    }
    body.admin-bar .tj-sidebar {
        top: 46px;
        height: calc(100vh - 46px);
    }
}

/* ===== BOT AVATAR LOGO ===== */
.tj-message__avatar--bot {
    overflow: hidden;
    padding: 0;
}
.tj-bot-logo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

/* ===== BOT MESSAGE BODY (logo + nom + bulle) ===== */
.tj-message--bot {
    align-items: flex-start;
}
.tj-message__body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.tj-message__sender {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    padding-left: 2px;
}

/* ===== BOUTON NOUVEAU DOSSIER ===== */
.tj-sidebar__new-folder-btn {
    width: 100%;
    padding: 7px 14px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.25);
    color: rgba(255,255,255,0.85);
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    transition: background 0.15s;
}
.tj-sidebar__new-folder-btn:hover {
    background: rgba(255,255,255,0.2);
}

/* ===== DOSSIERS ===== */
.tj-folder-section {
    margin-bottom: 8px;
    border-radius: 8px;
    overflow: hidden;
}
.tj-folder-section.is-drag-over > .tj-folder-body {
    background: var(--bg-hover);
    outline: 2px dashed var(--red);
    outline-offset: -2px;
}
.tj-folder-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2px 4px 2px 8px;
}
.tj-folder-toggle {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-label);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: left;
    padding: 4px 0;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: color 0.15s;
}
.tj-folder-toggle:hover { color: var(--text-sidebar); }
.tj-folder-arrow {
    display: inline-block;
    transition: transform 0.2s;
    font-style: normal;
}
.tj-folder-section.is-collapsed .tj-folder-arrow {
    transform: rotate(-90deg);
}
.tj-folder-section.is-collapsed .tj-folder-body {
    display: none;
}
.tj-folder-delete {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    padding: 2px 5px;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s;
}
.tj-folder-header:hover .tj-folder-delete { opacity: 1; }
.tj-folder-delete:hover { color: var(--red); }
.tj-folder-body {
    padding: 0 0 4px 0;
    transition: background 0.15s;
}
.tj-folder-empty {
    font-size: 11px;
    color: var(--text-label);
    padding: 6px 12px;
    font-style: italic;
}

/* ===== MENU ASSIGNATION DOSSIER ===== */
.tj-folder-menu {
    position: absolute;
    right: 0;
    top: 100%;
    background: var(--bg-sidebar);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    z-index: 100;
    min-width: 160px;
    overflow: hidden;
}
.tj-folder-option {
    padding: 8px 14px;
    font-size: 13px;
    color: var(--text-sidebar);
    cursor: pointer;
    transition: background 0.1s;
}
.tj-folder-option:hover { background: var(--bg-hover); color: var(--text-active); }
.tj-folder-option.is-selected { color: var(--red); font-weight: 600; }

/* ===== HISTORY ITEM — renommer ===== */
.tj-history-rename-btn {
    position: absolute;
    right: 44px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    background: none;
    border: none;
    font-size: 12px;
    padding: 2px 4px;
    border-radius: 4px;
    transition: opacity 0.15s;
    cursor: pointer;
}
.tj-history-wrap:hover .tj-history-rename-btn { opacity: 1; }

.tj-rename-input {
    flex: 1;
    padding: 5px 8px;
    background: var(--bg-input);
    border: 1px solid var(--red);
    border-radius: 6px;
    color: var(--text);
    font-size: 13px;
    outline: none;
    min-width: 0;
    width: 100%;
}

/* ===== HISTORY ITEM — bouton dossier ===== */
.tj-history-wrap {
    position: relative;
}
.tj-history-folder-btn {
    position: absolute;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    background: none;
    border: none;
    font-size: 13px;
    padding: 2px 4px;
    border-radius: 4px;
    transition: opacity 0.15s;
    cursor: pointer;
}
.tj-history-wrap:hover .tj-history-folder-btn { opacity: 1; }

/* ===== HISTORY ITEM — bouton supprimer ===== */
.tj-history-wrap {
    position: relative;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}
.tj-history-wrap .tj-history-item {
    flex: 1;
    padding-right: 28px;
}
.tj-history-delete {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    line-height: 1;
    padding: 2px 5px;
    border-radius: 4px;
    transition: opacity 0.15s, color 0.15s;
    flex-shrink: 0;
}
.tj-history-wrap:hover .tj-history-delete {
    opacity: 1;
}
.tj-history-delete:hover {
    color: var(--red);
}

/* ===== LOGOUT BUTTON ===== */
.tj-logout-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 5px 8px;
    color: var(--text-muted);
    font-size: 16px;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    flex-shrink: 0;
}
.tj-logout-btn:hover {
    border-color: var(--red);
    color: var(--red);
}

/* 404 page */
.tj-404 {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    text-align: center;
}

.tj-404 h1 {
    color: var(--red);
    font-size: 48px;
    margin-bottom: 12px;
}

/* ===== MARKDOWN RENDERING ===== */
.tj-message__bubble--md {
    line-height: 1.6;
}

.tj-md-p {
    margin: 0 0 6px;
}
.tj-md-p:last-child { margin-bottom: 0; }

.tj-md-spacer { height: 6px; }

.tj-md-h {
    font-weight: 700;
    margin: 10px 0 4px;
    line-height: 1.3;
}
h1.tj-md-h { font-size: 1.2em; }
h2.tj-md-h { font-size: 1.1em; }
h3.tj-md-h { font-size: 1em; }

.tj-md-hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 10px 0;
}

.tj-md-list {
    padding-left: 20px;
    margin: 4px 0 8px;
}
.tj-md-list li {
    margin-bottom: 3px;
}

.tj-message__bubble--md code {
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.85em;
    background: rgba(0,0,0,0.12);
    border-radius: 3px;
    padding: 1px 5px;
}
[data-theme="dark"] .tj-message__bubble--md code {
    background: rgba(255,255,255,0.1);
}

/* ===== CODE BLOCKS ===== */
.tj-code-block {
    position: relative;
    background: #1e1e1e;
    border-radius: 8px;
    margin: 8px 0;
    overflow: hidden;
}
[data-theme="light"] .tj-code-block {
    background: #282c34;
}

.tj-code-lang {
    display: block;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 11px;
    color: #888;
    padding: 6px 12px 0;
    text-transform: lowercase;
}

.tj-code-block pre {
    margin: 0;
    padding: 10px 14px 14px;
    overflow-x: auto;
}

.tj-code-block code {
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.84em;
    color: #abb2bf;
    background: transparent !important;
    padding: 0 !important;
    border-radius: 0 !important;
    white-space: pre;
    display: block;
}

.tj-copy-btn {
    position: absolute;
    top: 6px;
    right: 8px;
    background: rgba(255,255,255,0.08);
    color: #aaa;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 5px;
    font-size: 11px;
    padding: 3px 9px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    font-family: inherit;
}
.tj-copy-btn:hover {
    background: rgba(255,255,255,0.16);
    color: #fff;
}

/* ── Image upload ── */
.tj-upload-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-chat, #f5f5f5);
}

.tj-upload-preview img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid rgba(0,0,0,.12);
}

.tj-upload-preview__remove {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: #888;
    padding: 2px 6px;
    border-radius: 4px;
    line-height: 1;
}

.tj-upload-preview__remove:hover {
    background: rgba(0,0,0,.08);
    color: #333;
}

.tj-attach-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 0 6px;
    line-height: 1;
    opacity: .7;
    flex-shrink: 0;
}

.tj-attach-btn:hover {
    opacity: 1;
}

.tj-message-img {
    display: block;
    max-width: 280px;
    border-radius: 8px;
    margin-bottom: 4px;
    cursor: pointer;
}

.tj-upload-error {
    color: #c0392b;
    font-size: 12px;
    padding: 4px 12px;
    margin: 0;
}

/* ── Pages auth (connexion / inscription) ────────────────────────── */
.tj-auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary, #1a1a2e);
    padding: 24px 16px;
}
