/* =========================================================================
   Riflay — foglio di stile unico
   Dark-first per il feed, tema chiaro per le pagine di servizio.
   Un solo accent color (viola elettrico). Minimale e moderno.
   ========================================================================= */

/* ---- Design tokens ------------------------------------------------------ */
:root {
    /* Palette dark (feed) */
    --bg:            #0B0B0F;
    --surface:       #16161D;
    --surface-2:     #1F1F29;
    --border:        #2A2A36;
    --text:          #F4F4F6;
    --text-dim:      #A0A0AD;
    --text-faint:    #6C6C7A;

    /* Accent unico */
    --accent:        #6C5CE7;
    --accent-strong: #5847e0;
    --accent-ink:    #FFFFFF;
    --accent-soft:   rgba(108, 92, 231, 0.16);

    /* Stati */
    --like:          #FF4D6D;
    --success:       #2ecc71;
    --danger:        #ff5c5c;

    /* Tipografia */
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter",
            "Helvetica Neue", Arial, sans-serif;
    --fw-regular: 400;
    --fw-semibold: 600;

    /* Spaziatura (scala 4/8/12/16/24/32) */
    --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px; --s6: 24px; --s8: 32px;

    /* Forme */
    --radius:    14px;
    --radius-sm: 10px;
    --radius-pill: 999px;

    /* Movimento */
    --t-fast: 120ms ease;
    --t-base: 180ms ease;

    /* Layout */
    --col-max: 480px;
    --nav-h: 60px;
}

/* Tema chiaro per le pagine di servizio (login, profilo, form). */
.theme-light {
    --bg:        #F6F6F8;
    --surface:   #FFFFFF;
    --surface-2: #F0F0F4;
    --border:    #E3E3EA;
    --text:      #15151B;
    --text-dim:  #5E5E6B;
    --text-faint:#9A9AA6;
    --accent-soft: rgba(108, 92, 231, 0.10);
}

/* ---- Reset essenziale --------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: var(--font);
    font-weight: var(--fw-regular);
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    line-height: 1.45;
}
img, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ---- Shell (colonna centrata su desktop) -------------------------------- */
.app {
    width: 100%;
    max-width: var(--col-max);
    margin-inline: auto;
    min-height: 100dvh;
    position: relative;
    background: var(--bg);
}

/* ---- Bottoni ------------------------------------------------------------ */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: var(--s2);
    border: 0; border-radius: var(--radius-pill);
    padding: var(--s3) var(--s6);
    font-size: 15px; font-weight: var(--fw-semibold);
    color: var(--text); background: var(--surface-2);
    transition: transform var(--t-fast), background var(--t-fast), opacity var(--t-fast);
}
.btn:hover { background: var(--border); }
.btn:active { transform: scale(0.97); }
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { background: var(--accent-strong); }
.btn--ghost { background: transparent; color: var(--text-dim); padding-inline: var(--s3); }
.btn--ghost:hover { background: var(--surface-2); color: var(--text); }
.btn--block { width: 100%; }
.btn--sm { padding: var(--s2) var(--s4); font-size: 14px; }

/* ---- Chip / badge ------------------------------------------------------- */
.chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 10px;
    font-size: 12.5px; font-weight: var(--fw-semibold);
    border-radius: var(--radius-pill);
    background: var(--surface-2); color: var(--text-dim);
}
.chip--topic { background: var(--accent-soft); color: var(--accent); }

/* Badge "Spunto" — firma visiva del prodotto. Discreto ma riconoscibile. */
.spunto {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 11px 5px 9px;
    font-size: 13px; font-weight: var(--fw-semibold);
    color: var(--text);
    background: rgba(255, 255, 255, 0.10);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: var(--radius-pill);
    transition: background var(--t-fast);
}
.spunto:hover { background: rgba(255, 255, 255, 0.18); }
.spunto .spunto__arrow { color: var(--accent); font-weight: 700; }
.spunto strong { font-weight: var(--fw-semibold); }

/* ---- Avatar ------------------------------------------------------------- */
.avatar {
    --size: 40px;
    width: var(--size); height: var(--size);
    border-radius: 50%; flex: 0 0 auto;
    object-fit: cover;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--surface-2); color: var(--text-dim);
    font-size: calc(var(--size) * 0.38); font-weight: var(--fw-semibold);
    overflow: hidden;
}
.avatar--lg { --size: 88px; }
.avatar--sm { --size: 32px; }

/* =========================================================================
   FEED verticale a tutto schermo (scroll-snap)
   ========================================================================= */
.feed {
    height: 100dvh;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    scrollbar-width: none;
}
.feed::-webkit-scrollbar { display: none; }

.post {
    position: relative;
    height: 100dvh;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    display: flex;
    background: #000;
    overflow: hidden;
}
.post__media { position: absolute; inset: 0; }
.post__media img, .post__media video {
    width: 100%; height: 100%; object-fit: cover;
}
/* Velo per leggibilità di testo e azioni. */
.post__scrim {
    position: absolute; inset: 0;
    background: linear-gradient(to top,
        rgba(0,0,0,0.72) 0%, rgba(0,0,0,0.18) 32%,
        rgba(0,0,0,0) 55%, rgba(0,0,0,0.35) 100%);
    pointer-events: none;
}

/* Header in alto: filtro feed */
.feed__header {
    position: fixed; top: 0; left: 50%; transform: translateX(-50%);
    width: 100%; max-width: var(--col-max);
    display: flex; gap: var(--s4); justify-content: center;
    padding: var(--s4);
    z-index: 20;
}
.feed__tab {
    background: none; border: 0; color: rgba(255,255,255,0.6);
    font-size: 16px; font-weight: var(--fw-semibold);
    padding: 4px 2px; position: relative;
    text-shadow: 0 1px 8px rgba(0,0,0,0.6);
}
.feed__tab--active { color: #fff; }
.feed__tab--active::after {
    content: ""; position: absolute; left: 50%; bottom: -6px;
    width: 18px; height: 3px; border-radius: 3px; background: var(--accent);
    transform: translateX(-50%);
}

/* Colonna azioni a destra */
.post__rail {
    position: absolute; right: var(--s3); bottom: calc(var(--nav-h) + var(--s6));
    z-index: 10;
    display: flex; flex-direction: column; align-items: center; gap: var(--s6);
}
.action {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    background: none; border: 0; color: #fff;
}
.action__icon {
    width: 48px; height: 48px; border-radius: 50%;
    display: grid; place-items: center;
    background: rgba(255,255,255,0.10);
    backdrop-filter: blur(6px);
    transition: transform var(--t-fast), background var(--t-fast);
}
.action:hover .action__icon { background: rgba(255,255,255,0.18); }
.action:active .action__icon { transform: scale(0.88); }
.action__icon svg { width: 24px; height: 24px; }
.action__count { font-size: 12.5px; font-weight: var(--fw-semibold);
    text-shadow: 0 1px 6px rgba(0,0,0,0.6); }
/* Micro-feedback al like */
.action--liked .action__icon { background: rgba(255,77,109,0.18); }
.action--liked .action__icon svg { fill: var(--like); stroke: var(--like); }
.action--liked.is-bumped .action__icon { animation: like-bump 280ms ease; }
@keyframes like-bump {
    0% { transform: scale(1); }
    40% { transform: scale(1.28); }
    100% { transform: scale(1); }
}
.action--remix .action__icon { background: var(--accent-soft); }
.action--remix .action__icon svg { stroke: var(--accent); }

/* Info autore in basso a sinistra */
.post__meta {
    position: absolute; left: var(--s4); right: 80px;
    bottom: calc(var(--nav-h) + var(--s4));
    z-index: 10; color: #fff;
    display: flex; flex-direction: column; gap: var(--s2);
}
.post__author { display: inline-flex; align-items: center; gap: var(--s2); }
.post__author .avatar { --size: 34px; border: 1px solid rgba(255,255,255,0.5); }
.post__handle { font-weight: var(--fw-semibold); font-size: 15px;
    text-shadow: 0 1px 8px rgba(0,0,0,0.7); }
.post__caption {
    font-size: 14px; line-height: 1.4;
    text-shadow: 0 1px 8px rgba(0,0,0,0.7);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
}
.post__topics { display: flex; flex-wrap: wrap; gap: 6px; }
.post__topics .chip { background: rgba(255,255,255,0.12); color: #fff; }

/* Stato vuoto del feed */
.empty {
    height: 100dvh; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: var(--s4);
    text-align: center; padding: var(--s8); color: var(--text-dim);
}
.empty h2 { color: var(--text); margin: 0; }

/* =========================================================================
   Navigazione inferiore
   ========================================================================= */
.nav {
    position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
    width: 100%; max-width: var(--col-max); height: var(--nav-h);
    display: flex; align-items: center; justify-content: space-around;
    background: rgba(11,11,15,0.86);
    backdrop-filter: blur(14px);
    border-top: 1px solid rgba(255,255,255,0.08);
    z-index: 30;
}
.theme-light .nav {
    background: rgba(255,255,255,0.9);
    border-top: 1px solid var(--border);
}
.nav__item {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    color: var(--text-faint); font-size: 10.5px; font-weight: var(--fw-semibold);
    background: none; border: 0; padding: 6px 14px;
    transition: color var(--t-fast);
}
.nav__item svg { width: 26px; height: 26px; }
.nav__item.is-active { color: var(--text); }
.theme-light .nav__item { color: var(--text-faint); }
.theme-light .nav__item.is-active { color: var(--text); }
/* Pulsante "Crea" evidenziato */
.nav__create svg { width: 34px; height: 34px; }
.nav__create .nav__plus {
    width: 42px; height: 30px; border-radius: 10px;
    display: grid; place-items: center;
    background: var(--accent); color: var(--accent-ink);
}
.nav__create .nav__plus svg { width: 22px; height: 22px; }

/* =========================================================================
   Pagine di servizio (auth, profilo, dettaglio post, form)
   ========================================================================= */
.page { padding: var(--s6) var(--s4) calc(var(--nav-h) + var(--s8)); }

.topbar {
    display: flex; align-items: center; gap: var(--s3);
    padding: var(--s4); position: sticky; top: 0; z-index: 20;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(10px);
}
.topbar__title { font-size: 17px; font-weight: var(--fw-semibold); }
.topbar .btn--ghost { margin-left: auto; }

/* Auth */
.auth { min-height: 100dvh; display: flex; flex-direction: column;
    justify-content: center; padding: var(--s8) var(--s6); }
.brand { text-align: center; margin-bottom: var(--s8); }
.brand__logo {
    font-size: 30px; font-weight: var(--fw-semibold); letter-spacing: -0.5px;
}
.brand__logo b { color: var(--accent); }
.brand__img { width: 150px; height: auto; margin: 0 auto var(--s2); display: block; }
.brand__tag { color: var(--text-dim); font-size: 14px; margin-top: var(--s1); }

.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: var(--s6);
}

/* Form */
.field { margin-bottom: var(--s4); }
.field > label { display: block; font-size: 13px; color: var(--text-dim);
    margin-bottom: 6px; font-weight: var(--fw-semibold); }
.input, .textarea {
    width: 100%; padding: var(--s3) var(--s4);
    background: var(--surface-2); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-size: 15px; transition: border var(--t-fast), box-shadow var(--t-fast);
}
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }
.input:focus, .textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft); outline: none;
}
.textarea { resize: vertical; min-height: 84px; }
.field__hint { font-size: 12px; color: var(--text-faint); margin-top: 6px; }

.form__foot { margin-top: var(--s6); }
.form__alt { text-align: center; margin-top: var(--s4); color: var(--text-dim);
    font-size: 14px; }
.form__alt a { color: var(--accent); font-weight: var(--fw-semibold); }

/* Selezione topic (chips checkbox) */
.topics-pick { display: flex; flex-wrap: wrap; gap: var(--s2); }
.topics-pick input { position: absolute; opacity: 0; pointer-events: none; }
.topics-pick label {
    display: inline-block; padding: 8px 14px; border-radius: var(--radius-pill);
    background: var(--surface-2); border: 1px solid var(--border);
    color: var(--text-dim); font-size: 13.5px; font-weight: var(--fw-semibold);
    cursor: pointer; transition: all var(--t-fast); user-select: none;
}
.topics-pick input:checked + label {
    background: var(--accent-soft); border-color: var(--accent); color: var(--accent);
}

/* Flash / alert */
.flash { position: fixed; top: var(--s4); left: 50%; transform: translateX(-50%);
    width: calc(100% - var(--s8)); max-width: 440px; z-index: 60;
    display: flex; flex-direction: column; gap: var(--s2); }
.alert {
    padding: var(--s3) var(--s4); border-radius: var(--radius-sm);
    font-size: 14px; font-weight: var(--fw-semibold);
    background: var(--surface); border: 1px solid var(--border);
    box-shadow: 0 8px 30px rgba(0,0,0,0.35);
    animation: flash-in var(--t-base);
}
.alert--success { border-left: 3px solid var(--success); }
.alert--error   { border-left: 3px solid var(--danger); }
@keyframes flash-in { from { opacity: 0; transform: translateY(-8px); } }

/* =========================================================================
   Dettaglio post
   ========================================================================= */
.detail__media {
    width: 100%; aspect-ratio: 9 / 16; max-height: 70dvh;
    background: #000; border-radius: var(--radius); overflow: hidden;
    margin-bottom: var(--s4);
}
.detail__media img, .detail__media video { width: 100%; height: 100%; object-fit: cover; }

.detail__head { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s3); }
.detail__head .meta { display: flex; flex-direction: column; }
.detail__head .name { font-weight: var(--fw-semibold); }
.detail__head .sub { font-size: 13px; color: var(--text-dim); }
.detail__caption { margin: var(--s3) 0; }

.stat-row { display: flex; gap: var(--s6); padding: var(--s4) 0;
    border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
    margin: var(--s4) 0; }
.stat { display: flex; flex-direction: column; }
.stat b { font-size: 17px; }
.stat span { font-size: 12px; color: var(--text-dim); }

.actions-row { display: flex; gap: var(--s2); margin: var(--s4) 0; }
.actions-row .btn { flex: 1; }

/* Catena di paternità */
.lineage { margin: var(--s6) 0; }
.lineage h3 { font-size: 14px; color: var(--text-dim); margin: 0 0 var(--s3);
    text-transform: uppercase; letter-spacing: 0.04em; }
.chain { display: flex; flex-direction: column; gap: 0; }
.chain__node { display: flex; align-items: center; gap: var(--s3);
    padding: var(--s2) 0; }
.chain__dot { width: 10px; height: 10px; border-radius: 50%;
    background: var(--accent); flex: 0 0 auto; position: relative; }
.chain__node:not(:last-child) .chain__dot::after {
    content: ""; position: absolute; left: 50%; top: 14px;
    width: 2px; height: 24px; background: var(--border); transform: translateX(-50%); }
.chain__label { font-size: 14px; }
.chain__label b { color: var(--accent); }
.chain__node--current .chain__dot { background: var(--text); }

/* Tip composer */
.tip-form { display: flex; gap: var(--s2); align-items: center; margin-top: var(--s2); }
.tip-form .input { flex: 1; }
.tip-presets { display: flex; gap: var(--s2); margin: var(--s3) 0; }
.tip-presets button { flex: 1; }
.balance { font-size: 13px; color: var(--text-dim); }
.balance b { color: var(--accent); }

/* Commenti */
.comments { margin-top: var(--s6); }
.comment { display: flex; gap: var(--s3); padding: var(--s3) 0;
    border-top: 1px solid var(--border); }
.comment .body { flex: 1; }
.comment .head { display: flex; gap: var(--s2); align-items: baseline; }
.comment .name { font-weight: var(--fw-semibold); font-size: 14px; }
.comment .when { font-size: 12px; color: var(--text-faint); }
.comment .text { font-size: 14px; margin-top: 2px; }
.comment-form { display: flex; gap: var(--s2); margin-top: var(--s4);
    position: sticky; bottom: var(--nav-h); background: var(--bg); padding: var(--s3) 0; }
.comment-form .input { flex: 1; }

/* =========================================================================
   Profilo
   ========================================================================= */
.profile__head { display: flex; flex-direction: column; align-items: center;
    text-align: center; gap: var(--s3); padding: var(--s6) 0; }
.profile__name { font-size: 20px; font-weight: var(--fw-semibold); }
.profile__handle { color: var(--text-dim); font-size: 14px; }
.profile__bio { font-size: 14px; max-width: 36ch; color: var(--text); }
.profile__stats { display: flex; gap: var(--s8); margin: var(--s2) 0; }
.profile__stat { display: flex; flex-direction: column; align-items: center; }
.profile__stat b { font-size: 18px; }
.profile__stat span { font-size: 12px; color: var(--text-dim); }
.profile__actions { display: flex; gap: var(--s2); }

.grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px;
    margin-top: var(--s4);
}
.grid__cell { position: relative; aspect-ratio: 9 / 16; background: var(--surface-2);
    border-radius: var(--radius-sm); overflow: hidden; }
.grid__cell img { width: 100%; height: 100%; object-fit: cover; }
.grid__cell .grid__remix {
    position: absolute; top: 6px; left: 6px;
    background: rgba(0,0,0,0.5); color: #fff; backdrop-filter: blur(4px);
    border-radius: var(--radius-pill); padding: 2px 7px; font-size: 11px;
    font-weight: var(--fw-semibold); display: inline-flex; align-items: center; gap: 4px; }
.grid__cell .grid__remix svg { width: 12px; height: 12px; stroke: var(--accent); }

.section-title { font-size: 13px; color: var(--text-dim); font-weight: var(--fw-semibold);
    text-transform: uppercase; letter-spacing: 0.04em; margin: var(--s6) 0 var(--s3); }

/* Upload preview */
.uploader { margin-bottom: var(--s4); }
.uploader__drop {
    border: 1.5px dashed var(--border); border-radius: var(--radius);
    padding: var(--s8) var(--s4); text-align: center; color: var(--text-dim);
    background: var(--surface-2); transition: border var(--t-fast), background var(--t-fast);
}
.uploader__drop:hover { border-color: var(--accent); background: var(--accent-soft); }
.uploader__drop svg { width: 36px; height: 36px; stroke: var(--text-faint); margin-bottom: var(--s2); }
.uploader input[type=file] { display: none; }
.uploader__preview { margin-top: var(--s3); border-radius: var(--radius);
    overflow: hidden; aspect-ratio: 9/16; max-height: 50dvh; background: #000; display: none; }
.uploader__preview img, .uploader__preview video { width: 100%; height: 100%; object-fit: cover; }

/* Anteprima del post-spunto in pagina remix */
.remix-source {
    display: flex; gap: var(--s3); align-items: center;
    background: var(--surface); border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius); padding: var(--s3); margin-bottom: var(--s4);
}
.remix-source img { width: 54px; height: 72px; object-fit: cover; border-radius: var(--radius-sm); }
.remix-source .rs-label { font-size: 12px; color: var(--accent); font-weight: var(--fw-semibold); }
.remix-source .rs-cap { font-size: 13px; color: var(--text-dim);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* =========================================================================
   Sidebar DESKTOP (nascosta su mobile). Su schermi larghi sostituisce la
   barra di navigazione inferiore, mantenendo il feed in colonna centrata.
   ========================================================================= */
.sidebar { display: none; }
.sidebar__logo { width: 124px; height: auto; display: block; }

@media (min-width: 1000px) {
    .sidebar {
        display: flex; flex-direction: column;
        position: fixed; left: 0; top: 0; height: 100dvh; width: 244px;
        padding: var(--s6) var(--s4);
        background: var(--bg); border-right: 1px solid var(--border);
        z-index: 40;
    }
    .sidebar__brand { padding: var(--s2) var(--s3) var(--s6); }
    .sidebar__nav { display: flex; flex-direction: column; gap: var(--s1); }
    .sidebar__item {
        display: flex; align-items: center; gap: var(--s3);
        padding: var(--s3) var(--s3); border-radius: var(--radius);
        color: var(--text-dim); font-size: 16px; font-weight: var(--fw-semibold);
        transition: background var(--t-fast), color var(--t-fast);
    }
    .sidebar__item svg { flex: 0 0 auto; }
    .sidebar__item:hover { background: var(--surface-2); color: var(--text); }
    .sidebar__item.is-active { background: var(--surface-2); color: var(--text); }
    .sidebar__foot { margin-top: auto; display: flex; flex-direction: column; gap: var(--s2); }

    /* La barra inferiore lascia il posto alla sidebar. */
    .nav { display: none; }

    /* Senza barra inferiore, recuperiamo lo spazio in basso. */
    .post__rail { bottom: var(--s8); }
    .post__meta { bottom: var(--s8); }
    .page { padding-bottom: var(--s8); }
    .comment-form { bottom: 0; }
}

/* =========================================================================
   Chat con AI: tasto flottante + drawer
   ========================================================================= */
.chat-fab {
    position: fixed; right: var(--s4); bottom: calc(var(--nav-h) + var(--s4));
    width: 54px; height: 54px; border-radius: 50%; border: 0;
    display: grid; place-items: center; color: var(--accent-ink);
    background: var(--accent); box-shadow: 0 8px 24px rgba(108,92,231,0.45);
    z-index: 55; transition: transform var(--t-fast), background var(--t-fast);
}
.chat-fab:hover { background: var(--accent-strong); }
.chat-fab:active { transform: scale(0.92); }
body.chat-open .chat-fab { display: none; }

.chat-drawer {
    position: fixed; top: 0; right: 0; height: 100dvh;
    width: min(420px, 100%);
    background: var(--surface); border-left: 1px solid var(--border);
    display: flex; flex-direction: column;
    transform: translateX(100%); transition: transform var(--t-base);
    z-index: 60;
}
.chat-drawer.is-open { transform: translateX(0); box-shadow: -12px 0 40px rgba(0,0,0,0.4); }

.chat-head {
    display: flex; align-items: center; gap: var(--s2);
    padding: var(--s3) var(--s4); border-bottom: 1px solid var(--border);
}
.chat-head__title { display: flex; flex-direction: column; min-width: 0; }
.chat-head__title strong { font-size: 15px; }
.chat-head__sub { font-size: 11.5px; color: var(--text-dim); }
.chat-head__actions { display: flex; align-items: center; gap: var(--s1); margin-left: auto; }
.icon-btn {
    width: 34px; height: 34px; border-radius: 10px; border: 0;
    display: grid; place-items: center; color: var(--text-dim);
    background: var(--surface-2); transition: background var(--t-fast), color var(--t-fast);
}
.icon-btn:hover { background: var(--border); color: var(--text); }
.chat-rooms {
    max-width: 130px; padding: 6px 8px; border-radius: 8px;
    background: var(--surface-2); color: var(--text);
    border: 1px solid var(--border); font-size: 12.5px;
}

.chat-body {
    flex: 1; overflow-y: auto; padding: var(--s4);
    display: flex; flex-direction: column; gap: var(--s3);
}
.chat-empty { margin: auto; color: var(--text-faint); font-size: 14px; text-align: center; }

.chat-msg { display: flex; flex-direction: column; gap: 3px; max-width: 88%; }
.chat-msg__meta { display: flex; gap: var(--s2); align-items: baseline; }
.chat-msg__name { font-size: 12.5px; font-weight: var(--fw-semibold); color: var(--text-dim); }
.chat-msg__time { font-size: 11px; color: var(--text-faint); }
.chat-msg__body {
    padding: var(--s2) var(--s3); border-radius: 4px 14px 14px 14px;
    background: var(--surface-2); font-size: 14px; line-height: 1.4;
    word-break: break-word; white-space: pre-wrap;
}
/* Messaggi dell'AI "Riff" */
.chat-msg--ai .chat-msg__name { color: var(--accent); }
.chat-msg--ai .chat-msg__name::before { content: "✦ "; }
.chat-msg--ai .chat-msg__body {
    background: var(--accent-soft); border: 1px solid rgba(108,92,231,0.25);
}

.chat-note {
    margin: 0 var(--s4) var(--s2); padding: var(--s2) var(--s3);
    font-size: 12.5px; color: var(--text-dim);
    background: var(--surface-2); border-radius: var(--radius-sm);
}
.chat-input {
    display: flex; gap: var(--s2); padding: var(--s3) var(--s4);
    border-top: 1px solid var(--border);
}
.chat-input .input { flex: 1; }
.chat-summary {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    width: calc(100% - 2 * var(--s4)); margin: 0 var(--s4) var(--s3);
    padding: var(--s2); border: 1px solid var(--border); border-radius: var(--radius-pill);
    background: transparent; color: var(--accent); font-size: 13px; font-weight: var(--fw-semibold);
}
.chat-summary:hover { background: var(--accent-soft); }

@media (min-width: 1000px) {
    .chat-fab { bottom: var(--s6); right: var(--s6); }
}

/* Utility */
.muted { color: var(--text-dim); }
.center { text-align: center; }
.mt-4 { margin-top: var(--s4); }
.hidden { display: none !important; }
