/* ──────────────────────────────────────────────────────────────────────
   PI2C Messenger — beta · thème dark dérivé du mockup
   ──────────────────────────────────────────────────────────────────── */

:root {
    --bg: #0f172a;
    --bg-elev: #1e293b;
    --bg-elev-2: #334155;
    --text: #f1f5f9;
    --text-mute: #94a3b8;
    --text-dim: #64748b;
    --text-faint: #475569;
    --border: rgba(255, 255, 255, 0.06);
    --border-strong: rgba(255, 255, 255, 0.10);
    --primary: #6366f1;
    --primary-2: #818cf8;
    --primary-soft: rgba(99, 102, 241, 0.12);
    --accent-green: #22c55e;
    --danger: #ef4444;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    overscroll-behavior-y: none;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; }

/* ──── Auth / Login ──── */
.auth-shell {
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(800px 400px at 20% 0%, rgba(99,102,241,0.18), transparent 60%),
        radial-gradient(700px 400px at 100% 100%, rgba(34,211,238,0.10), transparent 60%),
        var(--bg);
}
.auth-card {
    width: 100%;
    max-width: 380px;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 28px 24px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.auth-brand { text-align: center; margin-bottom: 22px; }
.auth-logo {
    width: 56px; height: 56px;
    margin: 0 auto 12px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--primary), #4f46e5);
    display: flex; align-items: center; justify-content: center;
    font-size: 28px; color: #fff;
}
.auth-brand h1 { margin: 0 0 4px; font-size: 22px; }
.auth-brand p { margin: 0; color: var(--text-dim); font-size: 13px; }

.auth-form { display: grid; gap: 14px; }
.auth-field { display: grid; gap: 6px; }
.auth-field span { font-size: 12px; color: var(--text-mute); }
.auth-field input {
    background: #0b1220;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    padding: 11px 14px;
    color: var(--text);
    font-size: 14px;
    outline: none;
    transition: border-color .15s;
}
.auth-field input:focus { border-color: var(--primary); }
.auth-submit {
    margin-top: 6px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    padding: 12px 16px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background .15s;
}
.auth-submit:hover { background: #4f46e5; }
.auth-clyna-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: #fff;
    font-weight: 600;
    font-size: 15px;
    text-decoration: none;
    transition: opacity .15s, transform .1s;
    margin-bottom: 4px;
}
.auth-clyna-btn:hover { opacity: .9; }
.auth-clyna-btn:active { transform: scale(0.98); }
.auth-clyna-icon {
    width: 28px; height: 28px;
    border-radius: 8px;
    background: rgba(255,255,255,0.2);
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 15px;
}
.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0;
    color: var(--text-faint);
    font-size: 12px;
}
.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-strong);
}
.auth-footer { margin-top: 18px; font-size: 12px; color: var(--text-dim); text-align: center; }
.auth-footer a { color: var(--primary-2); }
.auth-alert {
    background: rgba(239,68,68,0.12);
    border: 1px solid rgba(239,68,68,0.35);
    color: #fecaca;
    border-radius: var(--radius-md);
    padding: 10px 12px;
    font-size: 13px;
    margin-bottom: 14px;
    display: flex; gap: 8px; align-items: center;
}

/* ──── Layout shell ──── */
.app-shell {
    height: 100dvh;
    display: flex;
    background: var(--bg);
}
@media (max-width: 900px) {
    .app-shell { flex-direction: column; }
}

.sidebar {
    width: 100%;
    max-width: 360px;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    border-right: 1px solid var(--border);
    height: 100dvh;
}
.sidebar--full { max-width: none; flex: 1; }
@media (min-width: 901px) {
    .sidebar--list { display: flex; }
}
@media (max-width: 900px) {
    .app-shell--chat .sidebar--list { display: none; }
}

.sidebar-header {
    padding: 16px 18px 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.sidebar-title h1 { margin: 0; font-size: 22px; font-weight: 700; }
.sidebar-subtitle { font-size: 12px; color: var(--text-dim); }
.sidebar-actions { display: flex; gap: 8px; }

.btn-icon {
    width: 36px; height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--bg-elev);
    color: var(--text-mute);
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    transition: background .15s;
}
.btn-icon:hover { background: var(--bg-elev-2); }
.btn-icon i { font-size: 18px; }

.search-box {
    margin: 0 18px 12px;
    display: flex; align-items: center; gap: 8px;
    background: var(--bg-elev);
    border-radius: var(--radius-md);
    padding: 0 12px;
}
.search-box i { color: var(--text-dim); }
.search-box input {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text);
    padding: 10px 0;
    font-size: 14px;
    outline: none;
}
.search-box input::placeholder { color: var(--text-faint); }
.search-box input:disabled { opacity: .6; }

.conv-list {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 90px;
}
.conv-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background .1s;
}
.conv-item:hover, .conv-item.active { background: var(--primary-soft); }
.conv-info { flex: 1; min-width: 0; }
.conv-name { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.conv-preview {
    font-size: 13px;
    color: var(--text-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.conv-preview.unread { color: var(--text-mute); }
.conv-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; min-width: 50px; }
.conv-time { font-size: 11px; color: var(--text-faint); }
.badge {
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    background: var(--primary);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
}

/* ──── Avatars ──── */
.avatar {
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
    position: relative;
}
.avatar.group { border-radius: 14px; }
.avatar.online::after {
    content: '';
    position: absolute;
    bottom: 1px; right: 1px;
    width: 11px; height: 11px;
    border-radius: 50%;
    background: var(--accent-green);
    border: 2px solid var(--bg);
}

/* ──── Contacts ──── */
.company-section { padding-bottom: 6px; }
.company-header {
    padding: 14px 18px 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.company-dot { width: 8px; height: 8px; border-radius: 50%; }
.company-name { font-size: 12px; font-weight: 700; color: var(--text-mute); text-transform: uppercase; letter-spacing: .5px; }
.company-count { font-size: 11px; color: var(--text-faint); }
.contact-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 18px;
    cursor: pointer;
    transition: background .1s;
}
.contact-item:hover { background: var(--primary-soft); }
.contact-info { flex: 1; }
.contact-name { font-size: 14px; font-weight: 500; color: var(--text); }
.contact-role { font-size: 12px; color: var(--text-dim); }
.contact-action {
    color: var(--text-faint);
    transition: color .15s;
}
.contact-item:hover .contact-action { color: var(--primary); }

/* ──── Bottom nav ──── */
.bottom-nav {
    position: sticky;
    bottom: 0;
    height: 70px;
    background: var(--bg);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    z-index: 5;
}
.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    color: var(--text-faint);
    font-size: 10px;
    text-decoration: none;
    padding: 8px 14px;
    transition: color .15s;
}
.nav-item i { font-size: 22px; }
.nav-item.active { color: var(--primary); }
.nav-item.is-disabled { opacity: .4; pointer-events: none; }

/* ──── Chat ──── */
.chat {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100dvh;
    background: var(--bg);
}
.chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}
.chat-back {
    color: var(--primary);
    font-size: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}
@media (min-width: 901px) {
    .chat-back { display: none; }
}
.chat-header-info { flex: 1; min-width: 0; }
.chat-header-info h2 { margin: 0; font-size: 16px; font-weight: 600; }
.chat-header-info span { font-size: 12px; color: var(--text-dim); }
.chat-header-actions { display: flex; gap: 6px; }

.messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

.date-separator {
    text-align: center;
    font-size: 11px;
    color: var(--text-faint);
    margin: 6px 0;
    position: relative;
}
.date-separator::before,
.date-separator::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 28%;
    height: 1px;
    background: var(--border);
}
.date-separator::before { left: 0; }
.date-separator::after { right: 0; }

.msg-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}
.msg-row.mine { flex-direction: row-reverse; }
.msg-avatar {
    width: 28px; height: 28px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700;
    flex-shrink: 0;
}
.msg-content { max-width: 72%; }
.msg-sender-name {
    font-size: 11px;
    color: var(--text-dim);
    margin-bottom: 3px;
    margin-left: 4px;
    font-weight: 600;
}
.msg-bubble {
    padding: 9px 13px;
    border-radius: var(--radius-lg);
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}
.msg-bubble.them {
    background: var(--bg-elev);
    color: #e2e8f0;
    border-bottom-left-radius: 4px;
}
.msg-bubble.mine {
    background: var(--primary);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.msg-meta {
    font-size: 10px;
    color: var(--text-faint);
    margin-top: 3px;
    display: flex;
    gap: 4px;
    align-items: center;
}
.msg-row.mine .msg-meta { justify-content: flex-end; }
.read-icon { color: var(--primary-2); font-size: 12px; }

/* ──── Composer ──── */
.composer {
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
    background: var(--bg);
    border-top: 1px solid var(--border);
}
.composer-form {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}
.composer-input-wrap {
    flex: 1;
    background: var(--bg-elev);
    border-radius: 22px;
    padding: 8px 12px;
    display: flex;
    align-items: flex-end;
    gap: 8px;
}
.composer-input-wrap textarea {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 14px;
    resize: none;
    outline: none;
    line-height: 1.4;
    max-height: 120px;
    font-family: inherit;
    padding: 4px 0;
}
.composer-input-wrap textarea::placeholder { color: var(--text-faint); }
.composer-action {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 4px;
    font-size: 18px;
}
.composer-action:disabled { opacity: .35; cursor: not-allowed; }
.composer-send {
    width: 42px; height: 42px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, transform .1s;
}
.composer-send:hover { background: #4f46e5; }
.composer-send:active { transform: scale(0.96); }
.composer-send i { font-size: 18px; }

/* ──── Empty state ──── */
.empty-state {
    padding: 48px 24px;
    text-align: center;
    color: var(--text-dim);
}
.empty-state i { font-size: 42px; color: var(--text-faint); margin-bottom: 12px; }
.empty-state p { margin: 0 0 18px; font-size: 14px; }

/* ──── Notifications toast ──── */
#notif-toasts {
    position: fixed;
    bottom: calc(64px + env(safe-area-inset-bottom, 0px));
    right: 16px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}
.notif-toast {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-elev);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    max-width: 300px;
    text-decoration: none;
    color: var(--text);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .45);
    pointer-events: auto;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity .25s ease, transform .25s ease;
    cursor: pointer;
}
.notif-toast.show {
    opacity: 1;
    transform: translateY(0);
}
.notif-toast-avatar {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary-2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 700;
}
.notif-toast-body {
    flex: 1;
    overflow: hidden;
}
.notif-toast-sender {
    font-size: 13px;
    font-weight: 600;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.notif-toast-preview {
    font-size: 12px;
    color: var(--text-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}
.notif-toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--text-faint);
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 2px 4px;
    border-radius: 4px;
    transition: color .15s;
}
.notif-toast-close:hover { color: #e2e8f0; }

/* ============================================================
   Notifications push — bouton d'activation
   ============================================================ */
.push-enable {
    position: fixed;
    left: 50%;
    bottom: 84px;
    transform: translateX(-50%);
    z-index: 900;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border: none;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
}
.push-enable:hover { background: #4f46e5; }
.push-enable i { font-size: 16px; }

/* ============================================================
   Appels WebRTC — overlay plein écran
   ============================================================ */
.call-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(8, 12, 24, 0.96);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    color: var(--text);
}
.call-overlay[hidden] { display: none; }

/* --- Appel entrant --- */
.call-incoming {
    margin: auto;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 32px;
}
.call-incoming[hidden] { display: none; }
.call-incoming-avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #4f46e5);
    display: grid;
    place-items: center;
    font-size: 42px;
    color: #fff;
    animation: call-pulse 1.6s ease-in-out infinite;
}
@keyframes call-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.5); }
    50% { box-shadow: 0 0 0 22px rgba(99, 102, 241, 0); }
}
.call-incoming-name { font-size: 22px; font-weight: 700; }
.call-incoming-sub { color: var(--text-mute); }
.call-incoming-actions { display: flex; gap: 48px; margin-top: 18px; }

/* --- Appel actif --- */
.call-active { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.call-active[hidden] { display: none; }
.call-banner {
    text-align: center;
    padding: 12px;
    color: var(--text-mute);
    font-size: 14px;
    min-height: 20px;
}
.call-banner:empty { display: none; }

.call-stage {
    flex: 1;
    min-height: 0;
    display: grid;
    gap: 8px;
    padding: 12px;
    grid-template-columns: 1fr;
    align-content: center;
}
.call-stage:has(.call-tile:nth-child(2)) { grid-template-columns: 1fr 1fr; }
.call-stage:has(.call-tile:nth-child(3)) { grid-template-columns: 1fr 1fr; }

.call-tile {
    position: relative;
    background: var(--bg-elev);
    border-radius: var(--radius-lg);
    overflow: hidden;
    aspect-ratio: 4 / 3;
    min-height: 0;
}
.call-tile video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #0b1220;
}
.call-tile.no-video video { display: none; }
.call-tile-fallback {
    position: absolute;
    inset: 0;
    display: none;
    place-items: center;
}
.call-tile.no-video .call-tile-fallback { display: grid; }
.call-tile-fallback span {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #4f46e5);
    display: grid;
    place-items: center;
    font-size: 26px;
    font-weight: 700;
    color: #fff;
}
.call-tile-name {
    position: absolute;
    left: 10px;
    bottom: 8px;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.55);
    font-size: 12px;
}
.call-tile--self {
    border: 2px solid var(--primary);
}

/* --- Contrôles --- */
.call-controls {
    display: flex;
    justify-content: center;
    gap: 18px;
    padding: 20px 12px calc(20px + env(safe-area-inset-bottom));
}
.call-btn {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    border: none;
    background: var(--bg-elev);
    color: var(--text);
    font-size: 22px;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: background 0.15s, transform 0.1s;
}
.call-btn:hover { background: var(--bg-elev-2, #334155); }
.call-btn:active { transform: scale(0.94); }
.call-btn.off { background: var(--text-faint); }
.call-btn.on { background: var(--primary); color: #fff; }
.call-btn[hidden] { display: none; }
.call-btn--accept { background: var(--accent-green); color: #fff; }
.call-btn--accept:hover { background: #16a34a; }
.call-btn--decline { background: var(--danger); color: #fff; }
.call-btn--decline:hover { background: #dc2626; }

/* ============================================================
   Page Profil
   ============================================================ */
.profile-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 16px calc(80px + env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.profile-card {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-align: center;
}
.profile-avatar-wrap {
    position: relative;
    margin-bottom: 6px;
}
.profile-company-dot {
    position: absolute;
    right: 2px;
    bottom: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid var(--bg-elev);
}
.profile-name {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
}
.profile-job {
    font-size: 13px;
    color: var(--text-mute);
}
.profile-company {
    font-size: 12px;
    color: var(--primary-2);
    background: var(--primary-soft);
    padding: 3px 10px;
    border-radius: 999px;
    margin-top: 2px;
}

.profile-section { display: flex; flex-direction: column; gap: 10px; }
.profile-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-dim);
    padding: 0 4px;
}
.profile-info-list {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}
.profile-info-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}
.profile-info-row:last-child { border-bottom: none; }
.profile-info-row > i { font-size: 18px; color: var(--primary-2); flex-shrink: 0; }
.profile-info-label { font-size: 11px; color: var(--text-dim); }
.profile-info-value { font-size: 14px; color: var(--text); margin-top: 1px; }
.profile-info-row--action { cursor: pointer; }
.profile-info-row--action:hover { background: var(--bg-elev-2); }

.profile-clyna-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
.clyna-action-card {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 8px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    transition: background .15s, border-color .15s;
}
.clyna-action-card:hover { background: var(--bg-elev-2); border-color: var(--primary); }
.clyna-action-card i { font-size: 22px; color: var(--primary-2); }
.clyna-action-card span { font-size: 12px; font-weight: 600; color: var(--text); }
.clyna-action-card small { font-size: 10px; color: var(--text-dim); text-align: center; }
.clyna-action-card--disabled { opacity: .45; pointer-events: none; }

.profile-logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 13px;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-md);
    color: var(--danger);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
}
.profile-logout-btn:hover { background: rgba(239, 68, 68, 0.15); }

/* ============================================================
   Page QR Scan
   ============================================================ */
.qr-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 16px calc(80px + env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
}
.qr-viewfinder {
    position: relative;
    width: 100%;
    max-width: 340px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: #000;
    aspect-ratio: 1;
}
.qr-viewfinder video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.qr-frame {
    position: absolute;
    inset: 20px;
    pointer-events: none;
}
.qr-corner {
    position: absolute;
    width: 24px;
    height: 24px;
    border-color: var(--primary);
    border-style: solid;
    border-width: 0;
}
.qr-corner--tl { top: 0; left: 0; border-top-width: 3px; border-left-width: 3px; border-radius: 4px 0 0 0; }
.qr-corner--tr { top: 0; right: 0; border-top-width: 3px; border-right-width: 3px; border-radius: 0 4px 0 0; }
.qr-corner--bl { bottom: 0; left: 0; border-bottom-width: 3px; border-left-width: 3px; border-radius: 0 0 0 4px; }
.qr-corner--br { bottom: 0; right: 0; border-bottom-width: 3px; border-right-width: 3px; border-radius: 0 0 4px 0; }
.qr-hint {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 10px;
    background: rgba(0,0,0,.6);
    font-size: 12px;
    color: var(--text-mute);
    text-align: center;
}

.qr-result {
    width: 100%;
    max-width: 340px;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px 20px;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
}
.qr-result-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(34, 197, 94, 0.15);
    display: grid;
    place-items: center;
    font-size: 26px;
    color: var(--accent-green);
}
.qr-result-type { font-size: 13px; color: var(--text-mute); }
.qr-result-name { font-size: 18px; font-weight: 700; color: var(--text); }
.qr-result-actions { display: flex; flex-direction: column; gap: 8px; width: 100%; margin-top: 4px; }
.qr-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-strong);
    background: var(--bg-elev-2);
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
}
.qr-action-btn--primary { background: var(--primary); border-color: transparent; color: #fff; }
.qr-action-btn--primary:hover { background: #4f46e5; }
.qr-rescan-btn {
    margin-top: 4px;
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 13px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.qr-upload-zone { width: 100%; max-width: 340px; }
.qr-upload-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-md);
    color: var(--text-mute);
    font-size: 13px;
    cursor: pointer;
    transition: border-color .15s, color .15s;
}
.qr-upload-btn:hover { border-color: var(--primary); color: var(--text); }
.qr-error {
    width: 100%;
    max-width: 340px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    font-size: 13px;
    color: var(--danger);
    text-align: center;
}

/* ============================================================
   PWA Install Banner
   ============================================================ */
.pwa-banner {
    position: fixed;
    bottom: calc(64px + env(safe-area-inset-bottom));
    left: 12px;
    right: 12px;
    z-index: 800;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--bg-elev);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    animation: slide-up .3s ease;
}
@keyframes slide-up {
    from { transform: translateY(20px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}
.pwa-banner-icon {
    font-size: 28px;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), #4f46e5);
    display: grid;
    place-items: center;
}
.pwa-banner-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.pwa-banner-text strong { font-size: 13px; color: var(--text); }
.pwa-banner-text span   { font-size: 11px; color: var(--text-mute); }
.pwa-banner-install {
    flex-shrink: 0;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
}
.pwa-banner-install:hover { background: #4f46e5; }
.pwa-banner-close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--text-faint);
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    border-radius: 4px;
}
.pwa-banner-close:hover { color: var(--text); }

/* ── QR invite ── */
.profile-qr-card { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.profile-qr-img { width: 200px; height: 200px; border-radius: var(--radius-md); background: #fff; }
.profile-qr-hint { font-size: 12px; color: var(--text-dim); text-align: center; margin: 0; }

/* ── Clyna AI floating chat ── */
.clyna-ai-wrap { position: fixed; right: 16px; bottom: calc(72px + env(safe-area-inset-bottom)); z-index: 600; display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.clyna-ai-fab { width: 52px; height: 52px; border-radius: 50%; background: linear-gradient(135deg, #7c3aed, #6366f1); border: none; color: #fff; font-size: 22px; cursor: pointer; display: grid; place-items: center; box-shadow: 0 6px 20px rgba(99,102,241,0.45); transition: transform .15s; }
.clyna-ai-fab:hover { transform: scale(1.08); }
.clyna-ai-panel { width: 320px; max-height: 480px; background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-lg); display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 16px 48px rgba(0,0,0,0.5); }
.clyna-ai-panel[hidden] { display: none; }
.clyna-ai-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--border); font-weight: 600; font-size: 14px; background: linear-gradient(135deg, rgba(124,58,237,.15), rgba(99,102,241,.15)); }
.clyna-ai-header i { color: #a78bfa; margin-right: 6px; }
.clyna-ai-messages { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.clyna-ai-msg { max-width: 85%; padding: 8px 12px; border-radius: 14px; font-size: 13px; line-height: 1.5; }
.clyna-ai-msg--user { background: var(--primary); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.clyna-ai-msg--assistant { background: var(--bg-elev-2); color: var(--text); align-self: flex-start; border-bottom-left-radius: 4px; }
.clyna-ai-msg--loading { opacity: .6; font-style: italic; }
.clyna-ai-composer { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--border); }
.clyna-ai-composer input { flex: 1; background: var(--bg); border: 1px solid var(--border-strong); border-radius: var(--radius-md); padding: 8px 12px; color: var(--text); font-size: 13px; outline: none; }
.clyna-ai-composer input:focus { border-color: var(--primary); }
.clyna-ai-send-btn { width: 36px; height: 36px; border-radius: var(--radius-sm); background: var(--primary); border: none; color: #fff; display: grid; place-items: center; cursor: pointer; flex-shrink: 0; }

/* ── Clyna IA · contact épinglé ─────────────────────────────────────────── */
.conv-avatar--bot {
    width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
    background: linear-gradient(135deg, #7c3aed, #6366f1);
    display: grid; place-items: center; color: #fff; font-size: 20px;
}
.conv-avatar--bot.conv-avatar--lg { width: 38px; height: 38px; font-size: 18px; }
.conv-item--bot { border-left: 2px solid #7c3aed; }
.conv-bot-badge {
    display: inline-block; font-size: 9px; font-weight: 700; letter-spacing: .04em;
    background: linear-gradient(135deg, #7c3aed, #6366f1); color: #fff;
    padding: 1px 5px; border-radius: 4px; vertical-align: middle; margin-left: 4px;
}

/* ── Chat IA · vue conversation ─────────────────────────────────────────── */
.chat--bot { display: flex; flex-direction: column; }
.messages-area--bot {
    flex: 1; overflow-y: auto; padding: 16px; display: flex;
    flex-direction: column; gap: 10px; min-height: 0;
}
.ai-welcome {
    text-align: center; padding: 32px 24px; color: var(--text-dim);
    max-width: 360px; margin: auto;
}
.ai-welcome i { font-size: 36px; color: #a78bfa; display: block; margin-bottom: 12px; }
.ai-welcome p { font-size: 14px; line-height: 1.7; }
.chat-composer {
    display: flex; gap: 8px; padding: 12px 16px;
    border-top: 1px solid var(--border); background: var(--bg-elev);
}
.chat-input {
    flex: 1; background: var(--bg); border: 1px solid var(--border-strong);
    border-radius: var(--radius-md); padding: 10px 14px;
    color: var(--text); font-size: 14px; outline: none;
}
.chat-input:focus { border-color: var(--primary); }
.chat-send-btn {
    width: 40px; height: 40px; border-radius: var(--radius-sm);
    background: linear-gradient(135deg, #7c3aed, #6366f1);
    border: none; color: #fff; display: grid; place-items: center;
    cursor: pointer; flex-shrink: 0; font-size: 16px;
}
.chat-send-btn:hover { opacity: .9; }
