* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #0d1117;
    --bg2: #161b22;
    --bg3: #21262d;
    --border: #30363d;
    --text: #e6edf3;
    --muted: #8b949e;
    --accent: #7c5cff;
    --accent2: #9d7bff;
    --green: #3fb950;
    --red: #f85149;
    --code-bg: #0a0d12;
}

html, body { height: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow: hidden;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.pad { padding: 12px; }
.center { text-align: center; }

button { font: inherit; cursor: pointer; color: inherit; background: none; border: none; }
input, textarea, select { font: inherit; color: var(--text); }

.icon {
    width: 18px; height: 18px; flex-shrink: 0;
    fill: none; stroke: currentColor; stroke-width: 2;
    stroke-linecap: round; stroke-linejoin: round;
    vertical-align: -3px;
}

.logo-chip, .login-logo, .welcome-logo, .ai-avatar {
    display: inline-flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--accent), #4d8dff);
    color: #fff; border-radius: 30%;
}
.logo-chip { width: 24px; height: 24px; }
.logo-chip .icon { width: 14px; height: 14px; }

/* ---------- Login ---------- */
#login-overlay {
    position: fixed; inset: 0; z-index: 100;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg);
}
#login-form {
    display: flex; flex-direction: column; gap: 14px;
    width: min(340px, 90vw); text-align: center;
}
.login-logo { width: 74px; height: 74px; margin: 0 auto; }
.login-logo .icon { width: 40px; height: 40px; }
#login-form h1 { font-size: 22px; }
#login-form p { color: var(--muted); font-size: 14px; }
#login-form input {
    background: var(--bg2); border: 1px solid var(--border);
    border-radius: 10px; padding: 12px 14px; outline: none;
}
#login-form input:focus { border-color: var(--accent); }
#login-form button {
    background: var(--accent); border-radius: 10px; padding: 12px;
    font-weight: 600; color: #fff;
}
#login-error { color: var(--red); font-size: 13px; min-height: 18px; }

/* ---------- Layout ---------- */
#app { display: flex; height: 100dvh; }

#sidebar {
    width: 300px; flex-shrink: 0;
    background: var(--bg2); border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
}
.sidebar-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px;
}
.app-title { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; }
#sidebar-close { display: none; }

.sidebar-tabs { display: flex; padding: 0 8px; gap: 2px; }
.tab {
    flex: 1; padding: 9px 4px; border-radius: 8px 8px 0 0;
    color: var(--muted); font-weight: 600; font-size: 13px;
    border-bottom: 2px solid transparent;
    display: flex; align-items: center; justify-content: center; gap: 5px;
    position: relative;
}
.tab .icon { width: 15px; height: 15px; }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

.badge-count {
    position: absolute; top: 2px; right: 2px;
    background: var(--red); color: #fff;
    font-size: 10px; font-weight: 700; line-height: 1;
    border-radius: 20px; padding: 3px 5px; min-width: 16px;
}

.panel { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.panel-title {
    font-size: 12px; font-weight: 700; text-transform: uppercase;
    color: var(--muted); padding: 4px 6px;
    display: flex; align-items: center; gap: 8px;
}
.count-chip {
    background: var(--bg3); border: 1px solid var(--border);
    border-radius: 20px; padding: 2px 8px; font-size: 11px; color: var(--muted);
}

.sidebar-footer {
    padding: 10px; border-top: 1px solid var(--border);
    display: flex; gap: 6px;
}

.primary-btn {
    background: var(--accent); color: #fff; font-weight: 600;
    border-radius: 10px; padding: 10px 14px;
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
}
.primary-btn:hover { background: var(--accent2); }
.primary-btn:disabled { opacity: .5; cursor: default; }
.ghost-btn {
    background: var(--bg3); border: 1px solid var(--border);
    border-radius: 8px; padding: 8px 10px; font-size: 13px; flex: 1;
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.ghost-btn:hover { border-color: var(--muted); }
.ghost-btn .icon { width: 15px; height: 15px; }
.icon-btn {
    padding: 7px; border-radius: 8px; line-height: 0;
    display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: var(--bg3); }

/* ---------- Avatars ---------- */
.avatar {
    width: 36px; height: 36px; border-radius: 50%;
    object-fit: cover; flex-shrink: 0; background: var(--bg3);
}
.avatar.sm { width: 28px; height: 28px; }
.ai-avatar { width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; }
.ai-avatar .icon { width: 15px; height: 15px; }

#topbar-avatar { margin-left: 2px; border-radius: 50%; line-height: 0; }
#topbar-avatar img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border); }
#topbar-avatar:hover img { border-color: var(--accent); }

/* ---------- Chat list ---------- */
.chat-item {
    display: flex; align-items: center; gap: 6px;
    padding: 10px 12px; border-radius: 10px; cursor: pointer;
    font-size: 14px; color: var(--muted);
}
.chat-item:hover { background: var(--bg3); }
.chat-item.active { background: var(--bg3); color: var(--text); }
.chat-item .title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-item .del { opacity: 0; line-height: 0; padding: 3px; border-radius: 6px; }
.chat-item .del .icon { width: 14px; height: 14px; }
.chat-item:hover .del { opacity: .7; }
.chat-item .del:hover { opacity: 1; color: var(--red); }

/* ---------- Member list ---------- */
.member {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px; border-radius: 10px; font-size: 14px;
}
.member .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member .me-tag { font-size: 11px; color: var(--accent2); }
.member .dot { margin-left: auto; }

/* ---------- Models ---------- */
#server-status {
    display: flex; align-items: center; gap: 8px;
    font-size: 13px; color: var(--muted); padding: 4px 6px;
}
#server-status .dot { flex-shrink: 0; }
#refresh-models { margin-left: auto; }

.dot {
    width: 9px; height: 9px; border-radius: 50%; display: inline-block;
    background: var(--red); flex-shrink: 0;
}
.dot.online { background: var(--green); }
.dot.offline { background: var(--red); }

.model-card {
    background: var(--bg3); border: 1px solid var(--border);
    border-radius: 12px; padding: 12px;
    display: flex; flex-direction: column; gap: 8px;
}
.model-card.loaded { border-color: var(--green); }
.model-name { font-weight: 600; font-size: 14px; word-break: break-word; }
.model-badges { display: flex; flex-wrap: wrap; gap: 5px; }
.badge {
    font-size: 11px; background: var(--bg); border: 1px solid var(--border);
    border-radius: 20px; padding: 2px 8px; color: var(--muted);
}
.badge.vision { color: #d2a8ff; border-color: #d2a8ff44; }
.badge.loaded-badge { color: var(--green); border-color: #3fb95044; }
.model-actions { display: flex; gap: 6px; }
.model-actions button {
    flex: 1; font-size: 13px; padding: 7px; border-radius: 8px; font-weight: 600;
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.model-actions .icon { width: 14px; height: 14px; }
.btn-load { background: var(--accent); color: #fff; }
.btn-unload { background: var(--bg); border: 1px solid var(--red); color: var(--red); }

/* ---------- Main ---------- */
#main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.view { flex: 1; display: flex; flex-direction: column; min-height: 0; }

#topbar {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; border-bottom: 1px solid var(--border);
    background: var(--bg2);
}
#sidebar-open { display: none; }
#model-select {
    flex: 1; max-width: 420px;
    background: var(--bg3); border: 1px solid var(--border);
    border-radius: 8px; padding: 8px 10px; outline: none;
}
#other-topbar {
    flex: 1; display: flex; align-items: center; gap: 8px; font-weight: 600;
    min-width: 0;
}
#other-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#topbar-status { margin-left: auto; }

#messages {
    flex: 1; overflow-y: auto; padding: 20px 14px;
    display: flex; flex-direction: column; gap: 14px;
}
.readonly-banner {
    align-self: center; font-size: 12px; color: var(--muted);
    background: var(--bg2); border: 1px solid var(--border);
    border-radius: 20px; padding: 5px 14px;
}
#welcome { margin: auto; text-align: center; color: var(--muted); }
.welcome-logo { width: 84px; height: 84px; margin: 0 auto 14px; }
.welcome-logo .icon { width: 44px; height: 44px; }
#welcome h2 { color: var(--text); margin-bottom: 8px; }
#welcome p { font-size: 14px; line-height: 1.6; }

/* ---------- Messages IA ---------- */
.msg { display: flex; gap: 9px; max-width: min(820px, 100%); }
.msg.user { align-self: flex-end; flex-direction: row-reverse; }
.msg.assistant { align-self: flex-start; width: 100%; }
.msg-col { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.msg.user .msg-col { align-items: flex-end; }

.msg .bubble {
    padding: 10px 14px; border-radius: 14px; font-size: 15px;
    line-height: 1.55; word-wrap: break-word; overflow-wrap: break-word;
    max-width: 100%;
}
.msg.user .bubble { background: var(--accent); color: #fff; border-top-right-radius: 4px; white-space: pre-wrap; }
.msg.assistant .bubble { background: var(--bg2); border: 1px solid var(--border); border-top-left-radius: 4px; }
/* Message d'un autre membre dans un chat partagé */
.msg.other-author { align-self: flex-start; flex-direction: row; }
.msg.other-author .msg-col { align-items: flex-start; }
.msg.other-author .bubble {
    background: var(--bg3); color: var(--text);
    border-top-right-radius: 14px; border-top-left-radius: 4px;
}

.msg .meta { font-size: 11px; color: var(--muted); margin-top: 4px; padding: 0 4px; display: flex; gap: 10px; align-items: center; }
.msg .copy-btn { font-size: 11px; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.msg .copy-btn .icon { width: 12px; height: 12px; }
.msg .copy-btn:hover { color: var(--text); }

.msg-images { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.msg-images img { max-width: 180px; max-height: 180px; border-radius: 10px; }

/* ---------- Markdown ---------- */
.bubble p { margin: 0 0 8px; }
.bubble p:last-child { margin-bottom: 0; }
.bubble code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13px; }
.bubble :not(pre) > code { background: var(--code-bg); padding: 1px 5px; border-radius: 5px; }
.bubble ul, .bubble ol { padding-left: 22px; margin: 6px 0; }
.bubble table { border-collapse: collapse; margin: 8px 0; display: block; overflow-x: auto; }
.bubble th, .bubble td { border: 1px solid var(--border); padding: 5px 9px; font-size: 13px; }
.bubble a { color: var(--accent2); }
.bubble blockquote { border-left: 3px solid var(--border); padding-left: 10px; color: var(--muted); margin: 6px 0; }
.bubble pre {
    background: var(--code-bg); border: 1px solid var(--border); border-radius: 8px;
    padding: 10px; overflow-x: auto; margin: 8px 0; font-size: 13px;
}

/* Boîte de code façon LM Studio */
.code-box {
    border: 1px solid var(--border); border-radius: 10px;
    margin: 8px 0; overflow: hidden; background: var(--code-bg);
}
.code-head {
    display: flex; align-items: center; gap: 4px;
    background: var(--bg3); border-bottom: 1px solid var(--border);
    padding: 4px 6px 4px 12px;
}
.code-lang {
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .06em; color: var(--muted); flex: 1;
}
.code-head button {
    color: var(--muted); padding: 5px 7px; border-radius: 6px;
    font-size: 11px; display: inline-flex; align-items: center; gap: 4px;
}
.code-head button:hover { color: var(--text); background: var(--bg); }
.code-head .icon { width: 13px; height: 13px; }
.code-box pre { border: none; border-radius: 0; margin: 0; }
.code-box pre code.hljs { background: transparent; padding: 0; }

.typing-dot::after { content: "▍"; animation: blink 1s infinite; color: var(--accent2); }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Chats des membres (sidebar) ---------- */
.member-group { display: flex; flex-direction: column; gap: 2px; }
.member-group-head {
    display: flex; align-items: center; gap: 8px;
    padding: 7px 10px; font-size: 13px; font-weight: 700;
}
.member-group .chat-item { padding: 7px 10px 7px 14px; font-size: 13px; }
.chat-item .count { font-size: 11px; color: var(--muted); }

/* ---------- Salon flottant ---------- */
#salon-toggle {
    position: fixed; bottom: 22px; right: 22px; z-index: 46;
    width: 54px; height: 54px; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #4d8dff);
    color: #fff; box-shadow: 0 6px 24px rgba(0,0,0,.45);
    display: flex; align-items: center; justify-content: center;
    transition: transform .15s ease;
}
#salon-toggle:hover { transform: scale(1.08); }
#salon-toggle .icon { width: 24px; height: 24px; }
#salon-toggle .badge-count { top: -2px; right: -2px; border: 2px solid var(--bg); }

#salon-popup {
    position: fixed; bottom: 88px; right: 22px; z-index: 46;
    width: 360px; height: min(480px, 70dvh);
    background: var(--bg2); border: 1px solid var(--border);
    border-radius: 16px; overflow: hidden;
    display: flex; flex-direction: column;
    box-shadow: 0 12px 40px rgba(0,0,0,.55);
}
.salon-head {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 12px; border-bottom: 1px solid var(--border);
    background: var(--bg3); font-weight: 600; font-size: 14px;
}
.salon-head-title { flex: 1; }
#salon-messages {
    flex: 1; overflow-y: auto; padding: 12px;
    display: flex; flex-direction: column; gap: 10px;
}

/* ---------- Barre vocale ---------- */
#voice-bar {
    border-bottom: 1px solid var(--border);
    padding: 8px 10px;
    display: flex; flex-direction: column; gap: 8px;
    background: rgba(124, 92, 255, .05);
}
#voice-users { display: flex; flex-wrap: wrap; gap: 6px; }
#voice-users:empty { display: none; }
.voice-chip {
    display: flex; align-items: center; gap: 6px;
    background: var(--bg3); border: 1px solid var(--border);
    border-radius: 20px; padding: 3px 10px 3px 3px; font-size: 12px;
    cursor: pointer;
}
.voice-chip img { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }
.voice-chip.speaking img { box-shadow: 0 0 0 2px var(--green); }
.voice-chip .icon { width: 12px; height: 12px; color: var(--muted); }
.voice-chip.muted-mic .icon.mic { color: var(--red); }
.voice-chip.local-muted { opacity: .45; }
.voice-actions { display: flex; gap: 6px; }
.voice-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    border-radius: 10px; padding: 8px 10px; font-size: 13px; font-weight: 600;
    background: var(--bg3); border: 1px solid var(--border);
}
.voice-btn.join { flex: 1; background: var(--green); border: none; color: #fff; }
.voice-btn.join:hover { filter: brightness(1.1); }
.voice-btn.danger { background: var(--red); border: none; color: #fff; }
.voice-btn.muted-state { background: var(--red); border: none; color: #fff; }
#voice-hint { font-size: 12px; color: var(--muted); }
#voice-hint a { color: var(--accent2); }

/* ---------- Animation de mise à jour ---------- */
#update-overlay {
    position: fixed; inset: 0; z-index: 200;
    background: var(--bg);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 6px;
    animation: fade-in .3s ease;
}
@keyframes fade-in { from { opacity: 0; } }
.update-anim { position: relative; width: 140px; height: 140px; margin-bottom: 18px; }
.update-logo {
    position: absolute; inset: 38px;
    background: linear-gradient(135deg, var(--accent), #4d8dff);
    border-radius: 30%;
    display: flex; align-items: center; justify-content: center; color: #fff;
    animation: logo-pulse 1.2s ease-in-out infinite;
}
.update-logo .icon { width: 34px; height: 34px; }
@keyframes logo-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.12) rotate(6deg); }
}
.update-anim .ring {
    position: absolute; inset: 0;
    border: 2px solid var(--accent);
    border-radius: 50%;
    animation: ring-out 1.6s ease-out infinite;
    opacity: 0;
}
.update-anim .ring.r2 { animation-delay: .5s; }
.update-anim .ring.r3 { animation-delay: 1s; }
@keyframes ring-out {
    0% { transform: scale(.55); opacity: .8; }
    100% { transform: scale(1.25); opacity: 0; }
}
.update-text { font-size: 18px; font-weight: 700; }
.update-sub { font-size: 13px; color: var(--muted); }
#composer-salon {
    padding: 8px 10px; border-top: 1px solid var(--border);
}
#salon-input { padding: 9px 12px; border-radius: 10px; }

/* ---------- Salon ---------- */
.smsg { display: flex; gap: 10px; max-width: min(820px, 100%); }
.smsg-col { min-width: 0; }
.smsg-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 3px; }
.smsg-name { font-weight: 700; font-size: 14px; }
.smsg-name.me { color: var(--accent2); }
.smsg-time { font-size: 11px; color: var(--muted); }
.smsg .bubble {
    background: var(--bg2); border: 1px solid var(--border);
    border-radius: 12px; border-top-left-radius: 4px;
    padding: 8px 12px; font-size: 14px; line-height: 1.5;
    word-wrap: break-word; overflow-wrap: break-word;
}
.smsg img.smsg-img { max-width: 260px; max-height: 260px; border-radius: 10px; margin-top: 6px; display: block; }
.salon-day {
    text-align: center; font-size: 11px; color: var(--muted);
    margin: 6px 0;
}

/* ---------- Composer ---------- */
#composer {
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border); background: var(--bg2);
}
#attachments, #salon-attachment { display: flex; gap: 8px; flex-wrap: wrap; }
#attachments:not(:empty), #salon-attachment:not(:empty) { padding-bottom: 8px; }
.attachment { position: relative; }
.attachment img { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); }
.attachment .rm {
    position: absolute; top: -6px; right: -6px;
    background: var(--red); color: #fff; border-radius: 50%;
    width: 20px; height: 20px; line-height: 0;
    display: flex; align-items: center; justify-content: center;
}
.attachment .rm .icon { width: 11px; height: 11px; }
.composer-row { display: flex; align-items: flex-end; gap: 8px; }
#input, #salon-input {
    flex: 1; resize: none; max-height: 160px;
    background: var(--bg3); border: 1px solid var(--border);
    border-radius: 12px; padding: 11px 14px; outline: none;
}
#input:focus, #salon-input:focus { border-color: var(--accent); }
.icon-btn.send { background: var(--accent); color: #fff; border-radius: 10px; padding: 10px 12px; }
.icon-btn.send:hover { background: var(--accent2); }
.icon-btn.stop { background: var(--red); color: #fff; border-radius: 10px; padding: 10px 12px; }

/* ---------- Modals ---------- */
.modal-backdrop {
    position: fixed; inset: 0; z-index: 50;
    background: rgba(0,0,0,.6);
    display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal {
    background: var(--bg2); border: 1px solid var(--border);
    border-radius: 16px; padding: 20px;
    width: min(460px, 100%);
    display: flex; flex-direction: column; gap: 14px;
    max-height: 90dvh; overflow-y: auto;
}
.modal h3 { font-size: 16px; word-break: break-word; }
.modal h3:not(:first-child) { margin-top: 6px; border-top: 1px solid var(--border); padding-top: 16px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field label { font-size: 13px; color: var(--muted); }
.field input[type=range] { accent-color: var(--accent); }
.field input[type=number], .field textarea, .profile-row input {
    background: var(--bg3); border: 1px solid var(--border);
    border-radius: 8px; padding: 9px 11px; outline: none; resize: vertical;
}
.checkbox-field { font-size: 14px; display: flex; gap: 8px; align-items: center; }
.checkbox-field input { accent-color: var(--accent); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.modal-actions .ghost-btn { flex: 0 0 auto; }
.error-text { color: var(--red); font-size: 13px; }
.error-text:empty { display: none; }

/* Profil */
.profile-row { display: flex; align-items: center; gap: 14px; }
.profile-row input { flex: 1; }
#avatar-edit { position: relative; line-height: 0; border-radius: 50%; }
#avatar-preview { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border); }
#avatar-edit:hover #avatar-preview { border-color: var(--accent); }
.avatar-cam {
    position: absolute; bottom: -2px; right: -2px;
    background: var(--accent); color: #fff; border-radius: 50%;
    width: 24px; height: 24px;
    display: flex; align-items: center; justify-content: center;
}
.avatar-cam .icon { width: 13px; height: 13px; }
#avatar-presets { display: flex; gap: 8px; flex-wrap: wrap; }
#avatar-presets button {
    width: 34px; height: 34px; border-radius: 50%; line-height: 0;
    border: 2px solid transparent; overflow: hidden;
}
#avatar-presets button:hover { border-color: var(--accent); }
#avatar-presets img { width: 100%; height: 100%; }

.progress-track {
    background: var(--bg3); border-radius: 20px; height: 10px; overflow: hidden;
}
#load-progress-bar {
    height: 100%; width: 0%; background: var(--accent);
    transition: width .3s; border-radius: 20px;
}
#load-progress { display: flex; align-items: center; gap: 10px; }
#load-progress .progress-track { flex: 1; }
#load-progress-text { font-size: 12px; color: var(--muted); min-width: 34px; text-align: right; }

/* ---------- Mentions ---------- */
.mention {
    background: #7c5cff33; color: var(--accent2);
    border-radius: 6px; padding: 0 4px; font-weight: 600;
}
.mention.me { background: #f0b42933; color: #f0b429; }

#mention-pop {
    position: fixed; z-index: 60;
    background: var(--bg3); border: 1px solid var(--border);
    border-radius: 12px; overflow: hidden;
    box-shadow: 0 8px 30px rgba(0,0,0,.5);
    min-width: 180px;
}
#mention-pop button {
    display: flex; align-items: center; gap: 8px;
    width: 100%; padding: 8px 12px; font-size: 14px; text-align: left;
}
#mention-pop button:hover, #mention-pop button.sel { background: var(--accent); color: #fff; }

/* ---------- Toasts ---------- */
#toasts {
    position: fixed; bottom: 88px; right: 22px; z-index: 70;
    display: flex; flex-direction: column; gap: 8px; align-items: flex-end;
    pointer-events: none;
}
.toast {
    pointer-events: auto; cursor: pointer;
    background: var(--bg3); border: 1px solid var(--accent);
    border-radius: 12px; padding: 10px 14px;
    box-shadow: 0 8px 30px rgba(0,0,0,.5);
    max-width: 300px; font-size: 13px;
    display: flex; align-items: center; gap: 10px;
    animation: toast-in .25s ease;
}
.toast .toast-title { font-weight: 700; }
.toast .toast-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
@keyframes toast-in { from { transform: translateX(30px); opacity: 0; } }

/* ---------- Mobile ---------- */
#sidebar-backdrop { display: none; }
@media (max-width: 820px) {
    #sidebar {
        position: fixed; inset: 0 auto 0 0; z-index: 40;
        width: min(310px, 85vw);
        transform: translateX(-100%);
        transition: transform .25s ease;
    }
    #sidebar.open { transform: translateX(0); }
    #sidebar-backdrop.show {
        display: block; position: fixed; inset: 0; z-index: 30;
        background: rgba(0,0,0,.5);
    }
    #sidebar-close { display: flex; }
    #sidebar-open { display: flex; }
    .msg .bubble, .smsg .bubble { font-size: 14px; }
    .tab { font-size: 12px; }
    .tab .icon { display: none; }

    #salon-toggle { bottom: 86px; right: 14px; width: 48px; height: 48px; }
    #toasts { bottom: auto; top: 66px; right: 10px; }
    #salon-popup {
        right: 8px; left: 8px; bottom: 142px; width: auto;
        height: min(440px, 55dvh);
    }
    .smsg img.smsg-img { max-width: 200px; max-height: 200px; }
}
