/* --- RESET & TYPOGRAPHY --- */

/* Stara Premium Font */
@font-face {
    font-family: 'Stara';
    src: local('Iowan Old Style'), local('Georgia');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

.font-stara {
    font-family: 'Stara', var(--font-display), sans-serif !important;
}

:root {
    --font-display: 'Plus Jakarta Sans', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;
    --font-stara: 'Stara', 'Plus Jakarta Sans', sans-serif;
    --primary: #0d0d0d;
    --primary-dark: #0d0d0d;
    --surface-bg: #f4f4f5;
    --card-border: #0d0d0d;

    /* Neobrutalist Design Tokens */
    --ink: #0d0d0d;
    --paper: #fafafa;
    --cream: #fffdf7;
    --yellow: #ffffff;
    --muted: #78716c;
    --stone: #e5e7eb;
    --success: #16a34a;
    --error: #dc2626;
}

/* --- GOOGLE MATERIAL STYLE SPINNER (Global) --- */
.google-spinner-overlay {
    position: fixed;
    inset: 0;
    background: rgba(245, 240, 232, 0.92);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.google-spinner-overlay.active {
    opacity: 1;
    visibility: visible;
}

.google-spinner-circle {
    width: 44px;
    height: 44px;
    border: 4px solid var(--stone);
    border-top-color: var(--ink);
    border-radius: 50%;
    animation: google-spin 1.4s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes google-spin {
    0% {
        transform: rotate(0deg);
    }

    50% {
        transform: rotate(180deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

body {
    font-family: var(--font-body);
    background-color: var(--paper);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
.font-display {
    font-family: var(--font-display);
}

/* --- SIDEBAR — DARK VERCEL STYLE --- */
.sidebar-glass {
    background: #000000;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-solid {
    background: #0d0d0d;
    border-right: 3px solid #ffffff;
    box-shadow: none;
    z-index: 50;
    position: relative;
    overflow: hidden;
}

/* Logo — OpenAI-clean (flat, white glyph on dark rail) */
.neo-logo-box {
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: transparent;
}
.neo-logo-frame {
    width: 40px;
    height: 40px;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    box-shadow: none;
}
.neo-logo-img {
    width: 30px;
    height: 30px;
    object-fit: contain;
    /* Mastro logo reso bianco */
    filter: brightness(0) invert(1);
}


/* Sibill sidebar is always narrow */
#main-sidebar {
    width: 80px;
    min-width: 80px;
    display: flex;
    flex-direction: column;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                min-width 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Collapsed State - Controlled by body class for maximum CSS specificity */
body.sidebar-collapsed #main-sidebar {
    width: 80px !important;
    min-width: 80px !important;
}

body.sidebar-collapsed #main-sidebar .nav-text,
body.sidebar-collapsed #main-sidebar .section-label,
body.sidebar-collapsed #main-sidebar .user-details-box {
    opacity: 0;
    visibility: hidden;
    width: 0;
    overflow: hidden;
}

body.sidebar-collapsed #main-sidebar .logo-full {
    opacity: 0;
}

body.sidebar-collapsed #main-sidebar .logo-icon {
    opacity: 1;
}

body.sidebar-collapsed #main-sidebar .nav-item {
    justify-content: center;
    padding: 0.875rem 0;
}

body.sidebar-collapsed #main-sidebar .logo-box {
    justify-content: center;
}

/* ─────────────────────────────────────────────────────────────────
   Sidebar nav — Apple-influenced (vibrancy, hairlines, spring).
   Mono bone-on-carbone palette: nessun accent shouty, depth via
   opacity layers. Border-radius 10px morbido. Spring 250ms.
   No hard-offset shadows (Apple non li usa). Indicator pill sottile.
   ───────────────────────────────────────────────────────────────── */

#main-sidebar {
    --nav-bone: #fefdf9;
    --nav-bg: #0d0d0d;

    /* Text */
    --nav-text: rgba(254, 253, 249, 0.55);
    --nav-text-hover: rgba(254, 253, 249, 0.92);
    --nav-text-active: var(--nav-bone);

    /* Background fills (vibrancy via opacity, NOT solid color) */
    --nav-bg-hover: rgba(254, 253, 249, 0.05);
    --nav-bg-active: rgba(254, 253, 249, 0.11);

    /* Hairline borders */
    --nav-border-hover: rgba(254, 253, 249, 0.08);
    --nav-border-active: rgba(254, 253, 249, 0.18);

    /* Icon frame — depth via stacked opacity */
    --nav-icon-stroke: rgba(254, 253, 249, 0.50);
    --nav-icon-stroke-hover: rgba(254, 253, 249, 0.92);
    --nav-icon-stroke-active: var(--nav-bone);
    --nav-icon-frame: rgba(254, 253, 249, 0.06);
    --nav-icon-frame-hover: rgba(254, 253, 249, 0.14);
    --nav-icon-frame-active: rgba(254, 253, 249, 0.24);
    --nav-icon-bg-default: rgba(254, 253, 249, 0.02);
    --nav-icon-bg-hover: rgba(254, 253, 249, 0.06);
    --nav-icon-bg-active: rgba(254, 253, 249, 0.10);

    /* Indicator — bone solid pill, vertical centered */
    --nav-indicator: rgba(254, 253, 249, 0.95);

    /* Apple-style spring */
    --nav-spring: cubic-bezier(0.32, 0.72, 0, 1);
}

#main-sidebar .nav-item {
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 6px;
    width: calc(100% - 14px);
    min-height: 62px;
    padding: 9px 4px;
    font-size: 9px;
    font-weight: 600;             /* Apple: weight più contenuto */
    color: var(--nav-text);
    border-radius: 10px;          /* Apple micro-rounded */
    border: 1px solid transparent;
    text-decoration: none;
    margin: 0 auto 3px;
    position: relative;
    cursor: pointer;
    letter-spacing: 0.05em;       /* leggermente meno tracking di prima */
    text-transform: uppercase;
    text-align: center;
    line-height: 1.18;
    box-sizing: border-box;
    background: transparent;
    appearance: none;
    font-family: inherit;
    /* SF-feel font-smoothing + tabular */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition:
        color 250ms var(--nav-spring),
        background 250ms var(--nav-spring),
        border-color 250ms var(--nav-spring);
}

/* Illustrazioni nel rail.

   L'icona vettoriale sparisce solo quando l'immagine è arrivata davvero
   (classe messa dal `load`): un file mancante deve lasciare il menu com'era,
   non svuotarlo. */
#main-sidebar .nav-item .nav-fig {
    width: 26px;
    height: 26px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

#main-sidebar .nav-item.nav-illustrata > i,
#main-sidebar .nav-item.nav-illustrata > svg,
#main-sidebar .nav-item.nav-illustrata > .nav-icon-wrap {
    display: none;
}

/* Le etichette lunghe vanno a capo invece di essere tagliate.

   Il rail eredita `white-space: nowrap` dal contenitore, e con 80px di
   larghezza il risultato erano parole mozzate: DOCUME…, ANTIRICI…,
   PAGAMEN…. Un'etichetta che non si legge è peggio di una voce in meno,
   perché costringe a cliccare per sapere cosa c'è dietro. */
#main-sidebar .nav-item span.nav-text,
body:not(.sidebar-collapsed) #main-sidebar .nav-item span.nav-text {
    white-space: normal;
    overflow-wrap: anywhere;
    max-width: 100%;
    display: block;
}

/* ─────────────────────────────────────────────────────────────────
   Gruppi di navigazione.

   Ventinove voci in fila non si leggono: si scorrono. Raggrupparle non
   toglie niente a nessuno — stesse destinazioni, stessi permessi — ma
   l'occhio smette di contare voci e inizia a scegliere un reparto.

   L'etichetta sta in un rail da 80px, quindi è corta per forza: più di
   otto caratteri andrebbero a capo o verrebbero tagliati.
   ───────────────────────────────────────────────────────────────── */
#main-sidebar .nav-group {
    padding-top: 2px;
}

#main-sidebar .nav-group + .nav-group {
    margin-top: 6px;
    border-top: 1px solid var(--nav-border-hover, rgba(255, 255, 255, 0.08));
    padding-top: 8px;
}

#main-sidebar .nav-group-label {
    margin: 0 0 4px;
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-align: center;
    text-transform: uppercase;
    color: var(--nav-text, rgba(255, 255, 255, 0.45));
    opacity: 0.5;
    -webkit-font-smoothing: antialiased;
    user-select: none;
}

/* Un gruppo che ha perso tutte le voci (permessi, o stanze non ancora
   sbloccate) sparisce con la sua etichetta: un'intestazione orfana è
   peggio della lista piatta da cui siamo partiti. */
#main-sidebar .nav-group[data-vuoto="1"] {
    display: none;
}

/* ─────────────────────────────────────────────────────────────────
   Pannello «Tutto».

   Le nove cose di ogni giorno stanno nel rail; qui c'è la coda lunga,
   quella che si apre una volta al mese. Superficie chiara e calma —
   il rail è scuro, questo è una schermata, non un menu a tendina.
   ───────────────────────────────────────────────────────────────── */
#nav-tutto-pannello {
    position: fixed;
    inset: 0;
    z-index: 9998;
    display: none;
}

#nav-tutto-pannello.nt-on {
    display: block;
}

.nt-scrim {
    position: absolute;
    inset: 0;
    background: rgba(15, 15, 20, 0.45);
}

.nt-foglio {
    position: absolute;
    left: 50%;
    top: 48px;
    transform: translateX(-50%);
    width: min(920px, calc(100vw - 48px));
    max-height: calc(100vh - 96px);
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 16px;
    box-shadow: 0 18px 48px rgba(15, 15, 20, 0.22);
    overflow: hidden;
    animation: nt-entra 160ms cubic-bezier(0.2, 0.8, 0.3, 1);
}

@keyframes nt-entra {
    from { opacity: 0; transform: translateX(-50%) translateY(-6px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    .nt-foglio { animation: none; }
}

.nt-testa {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.nt-cerca {
    flex: 1;
    height: 38px;
    padding: 0 12px;
    font-size: 14px;
    font-family: inherit;
    color: #111;
    background: #f6f6f7;
    border: 1px solid transparent;
    border-radius: 10px;
    outline: none;
}

.nt-cerca:focus {
    background: #fff;
    border-color: rgba(0, 0, 0, 0.14);
}

.nt-chiudi {
    height: 30px;
    padding: 0 10px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: #6b7280;
    background: #f3f4f6;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 8px;
    cursor: pointer;
}

.nt-corpo {
    padding: 6px 12px 14px;
    overflow-y: auto;
}

.nt-sez-t {
    margin: 12px 2px 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #9ca3af;
}

/* La griglia: celle divise da filetti, non piastrelle staccate.

   È il disegno chiesto — bordi che formano una griglia continua, un lavaggio
   in sfumatura all'hover, la barretta a sinistra che cresce e il titolo che
   scivola di due pixel. Portato in CSS invece che con il componente React
   originale: quel componente porta con sé React, shadcn e una libreria di
   icone, e installarli nella shell per fare un menu sarebbe il contrario
   della semplificazione appena fatta. Il disegno però è lo stesso. */
.nt-griglia {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    border-top: 1px solid rgba(0, 0, 0, 0.07);
    border-left: 1px solid rgba(0, 0, 0, 0.07);
}

.nt-card {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 18px 18px 18px 22px;
    border-right: 1px solid rgba(0, 0, 0, 0.07);
    border-bottom: 1px solid rgba(0, 0, 0, 0.07);
    background: #fff;
    cursor: pointer;
    overflow: hidden;
}

/* Il lavaggio in sfumatura, che compare solo passandoci sopra. */
.nt-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, #f4f4f5, transparent);
    opacity: 0;
    transition: opacity 200ms ease;
    pointer-events: none;
}

.nt-card:hover::after {
    opacity: 1;
}

/* La barretta che cresce: è il segnale di dove sei, e costa un pixel. */
.nt-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 3px;
    height: 22px;
    transform: translateY(-50%);
    border-radius: 0 999px 999px 0;
    background: rgba(0, 0, 0, 0.14);
    transition: height 200ms ease, background 200ms ease;
    z-index: 1;
}

.nt-card:hover::before {
    height: 34px;
    background: #4f46e5;
}

.nt-card .nt-voce {
    all: unset;
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    margin-top: 1px;
    color: #6b7280;
    transition: color 200ms ease;
}

.nt-card:hover .nt-voce {
    color: #111827;
}

.nt-card .nt-voce .nav-text {
    display: none;
}

.nt-card-fig {
    position: relative;
    z-index: 1;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    object-fit: contain;
    margin-top: -2px;
}

/* Quando c'è l'illustrazione, l'ancora resta nel DOM — è lei che porta la
   rotta — ma sparisce del tutto. `opacity: 0` da sola non bastava: un'altra
   regola la riportava a 0.45 e il disegno riappariva gigante dietro al testo.
   Alzare la specificità è meglio di `!important`, che sposta il problema al
   prossimo che ci mette le mani. E `pointer-events: none` fa sì che il clic
   lo gestisca la card una volta sola invece di due. */
.nt-card .nav-item.nt-voce-nascosta {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
}

/* Se una voce arriva con un'immagine già addosso, resta comunque fuori:
   l'illustrazione della card è una sola, quella che mette il pannello. */
.nt-card .nav-item img {
    display: none;
}

.nt-card-testi {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.nt-card-t {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    transition: transform 200ms ease;
}

.nt-card:hover .nt-card-t {
    transform: translateX(2px);
}

.nt-card-d {
    font-size: 12.5px;
    line-height: 1.35;
    color: #6b7280;
}

/* Le voci già presenti nel rail compaiono solo quando si cerca: mostrarle
   sempre raddoppierebbe il pannello invece di semplificarlo. */
.nt-sez-rail[data-solo-ricerca="1"] {
    display: none !important;
}

.nt-nulla {
    padding: 22px 14px 26px;
    text-align: center;
    font-size: 13px;
    color: #9ca3af;
}

body.nt-aperto {
    overflow: hidden;
}

/* Finché il JavaScript non ha spostato le voci, restano nel rail: senza
   script la navigazione torna com'era invece di sparire. Quando il
   pannello esiste, il blocco nel rail non serve più. */
#main-nav .nav-secondarie:empty {
    display: none;
}

/* HOVER — vibrancy wash + hairline border, no slide (Apple stay-in-place) */
#main-sidebar .nav-item:hover {
    background: var(--nav-bg-hover);
    color: var(--nav-text-hover);
    border-color: var(--nav-border-hover);
}

/* ACTIVE — translucent bone wash (Apple "selected sidebar item" pattern).
   No solid color, no hard-offset shadow. Hairline border 1px. */
#main-sidebar .nav-item.active {
    background: var(--nav-bg-active);
    color: var(--nav-text-active);
    font-weight: 700;
    border-color: var(--nav-border-active);
}

#main-sidebar .nav-item.active:hover {
    background: var(--nav-bg-active);  /* sticks — no double-state */
}

#main-sidebar .nav-item.active svg,
#main-sidebar .nav-item.active i {
    color: var(--nav-icon-stroke-active) !important;
}

/* Indicator — Apple sidebar pill: 3px wide, 60% height, vertical centered
   bone monochrome, no shadow, gentle rounded ends. */
#main-sidebar .nav-item.active::before {
    content: '';
    position: absolute;
    left: -7px;
    top: 22%;
    bottom: 22%;
    width: 3px;
    background: var(--nav-indicator);
    border-radius: 2px;
}

#main-sidebar .nav-item .nav-text {
    display: block;
    font-size: 9px;
    font-weight: inherit;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    max-width: 62px;
    margin: 0 auto;
}

/* Icon — Apple-style: thin stroke, soft frame, vibrancy on active.
   Frame only on direct icon container (i or .nav-icon-wrap), never nested svg. */
#main-sidebar .nav-item > i,
#main-sidebar .nav-item > .nav-icon-wrap {
    display: block;
    width: 18px !important;
    height: 18px !important;
    flex-shrink: 0;
    padding: 4px;
    box-sizing: content-box;
    margin: 0 auto;
    border: 1px solid var(--nav-icon-frame);
    background: var(--nav-icon-bg-default);
    color: var(--nav-icon-stroke);
    border-radius: 7px;
    transition:
        border-color 250ms var(--nav-spring),
        background 250ms var(--nav-spring),
        color 250ms var(--nav-spring);
}

#main-sidebar .nav-item > i svg,
#main-sidebar .nav-item > .nav-icon-wrap svg,
#main-sidebar .nav-item > .nav-icon-wrap img {
    display: block;
    width: 18px !important;
    height: 18px !important;
    padding: 0;
    margin: 0;
    border: none;
    background: transparent;
    border-radius: 0;
    box-sizing: border-box;
    color: inherit;
}

#main-sidebar .nav-item:hover > i,
#main-sidebar .nav-item:hover > .nav-icon-wrap {
    border-color: var(--nav-icon-frame-hover);
    background: var(--nav-icon-bg-hover);
    color: var(--nav-icon-stroke-hover) !important;
}

#main-sidebar .nav-item.active > i,
#main-sidebar .nav-item.active > .nav-icon-wrap {
    border-color: var(--nav-icon-frame-active);
    background: var(--nav-icon-bg-active);
    color: var(--nav-icon-stroke-active) !important;
}

/* Disabled — preserve layout, dim 30%, no interaction */
#main-sidebar .nav-item[disabled],
#main-sidebar .nav-item[aria-disabled="true"] {
    opacity: 0.30 !important;
    cursor: not-allowed;
    pointer-events: none;
}

/* Hide legacy section labels */
.section-label {
    display: none !important;
}

/* UNREAD BADGE — small dot, hairline border bone, anchored top-right of icon */
#main-sidebar .nav-item .ml-auto:not(.hidden) {
    display: block;
    position: absolute;
    top: 7px;
    right: calc(50% - 18px);
    margin: 0;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    border: 2px solid var(--nav-bg);
    box-sizing: content-box;
    z-index: 2;
    /* Subtle bone halo so the badge lifts off the dark icon frame */
    box-shadow: 0 0 0 1px rgba(254, 253, 249, 0.10);
}

#main-sidebar .nav-item.active .ml-auto:not(.hidden) {
    border-color: rgba(254, 253, 249, 0.16);
    box-shadow: 0 0 0 1px rgba(254, 253, 249, 0.30);
}

/* WhatsApp numeric badge — not .ml-auto (that rule forces 7×7 dot geometry) */
#main-sidebar #nav-whatsapp #badge-whatsapp:not(.hidden) {
    display: block;
    position: absolute;
    top: 5px;
    left: 50%;
    transform: translateX(6px);
    margin: 0;
    width: auto;
    height: auto;
    min-width: 18px;
    border-radius: 3px;
    z-index: 3;
}

/* Logo — softened Apple-feel: hairline border, no hard shadow */
.neo-logo-box {
    border-bottom: 1px solid rgba(254, 253, 249, 0.10);
    background: var(--nav-bg, #0d0d0d);
}
.neo-logo-frame {
    border: 1px solid rgba(254, 253, 249, 0.18);
    box-shadow: none;
    border-radius: 10px;          /* Apple icon ratio */
    background: rgba(254, 253, 249, 0.04);
}

/* --- BUTTONS (NEOBRUTALIST) --- */

/* Bottone Primario: Neobrutalist */
.btn-solid {
    background-color: var(--ink);
    color: var(--yellow);
    padding: 0.75rem 1.5rem;
    border-radius: 0;
    font-size: 0.9rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    border: 2px solid var(--ink);
    cursor: pointer;
    box-shadow: 3px 3px 0 var(--ink);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.btn-solid:hover {
    box-shadow: 5px 5px 0 var(--ink);
    transform: translate(-2px, -2px);
}

.btn-solid:active {
    transform: translate(2px, 2px);
    box-shadow: none;
}

/* Bottone Secondario (Ghost Neobrutalist) */
.btn-ghost {
    background-color: var(--cream);
    color: var(--ink);
    padding: 0.6rem 1.2rem;
    border-radius: 0;
    font-size: 0.8rem;
    font-weight: 700;
    border: 2px solid var(--ink);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    width: 100%;
    box-shadow: 3px 3px 0 var(--ink);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.btn-ghost:hover {
    background-color: var(--yellow);
    transform: translate(-2px, -2px);
    box-shadow: 5px 5px 0 var(--ink);
}

/* =============================================
   UNIFIED INBOX WIDGET
   ============================================= */
.unified-inbox-widget {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.unified-inbox-widget:hover {
    box-shadow: 6px 6px 0 var(--ink);
    transform: translate(-2px, -2px);
}

#unified-inbox-body {
    max-height: 500px;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.2s ease, padding 0.3s ease;
}

.unified-inbox-widget.collapsed #unified-inbox-body {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
}

.unified-inbox-widget.collapsed #inbox-widget-chevron {
    transform: rotate(-90deg);
}

/* AI Category Pills in Widget */
.ai-category-pill {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid var(--ink);
    background: var(--cream);
}

.ai-category-pill:hover {
    transform: translateX(4px);
    background: var(--yellow);
}

.ai-category-pill .count {
    margin-left: auto;
    font-size: 0.65rem;
    opacity: 0.7;
}

/* --- COMPANY SELECTOR DROPDOWN --- */
#company-dropdown {
    background: var(--cream);
    border: 2px solid var(--ink);
    border-radius: 0;
    padding: 0.5rem;
    box-shadow: 4px 4px 0 var(--ink);
    min-width: 320px;
}

.company-item-solid {
    cursor: pointer;
    border-radius: 0;
}

/* Custom scrollbar for dropdown */
#company-list-container {
    scrollbar-width: thin;
    scrollbar-color: var(--stone) transparent;
}

#company-list-container::-webkit-scrollbar {
    width: 6px;
}

#company-list-container::-webkit-scrollbar-track {
    background: transparent;
}

#company-list-container::-webkit-scrollbar-thumb {
    background: var(--stone);
    border-radius: 0;
}

.input-round {
    width: 100%;
    background-color: var(--cream);
    border: 2px solid var(--ink);
    border-radius: 0;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    color: var(--ink);
    font-weight: 500;
    box-shadow: none;
    transition: border-color 0.2s;
}

.input-round:focus {
    outline: none;
    border-color: var(--ink);
    box-shadow: 3px 3px 0 var(--ink);
}

/* Filter Selects */
.select-round {
    padding: 0.75rem 1.25rem;
    background-color: var(--cream);
    border: 2px solid var(--ink);
    border-radius: 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--ink);
    box-shadow: none;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/09/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%230d0d0d' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

/* --- CLIENT CARD (NEOBRUTALIST) --- */
.client-card-soft {
    background: var(--cream);
    border: 2px solid var(--ink);
    border-radius: 0;
    padding: 1.75rem;
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    box-shadow: 4px 4px 0 var(--ink);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.client-card-soft:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 var(--ink);
    border-color: var(--ink);
}

/* Avatar */
.avatar-soft {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.25rem;
    border: 2px solid var(--ink);
}

/* Status Badges */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.8rem;
    border-radius: 0;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 2px solid var(--ink);
}

.status-ok {
    background: var(--yellow);
    color: var(--ink);
}

.status-no {
    background: #fee2e2;
    color: var(--error);
}

/* --- MODAL --- */
.modal-rounded {
    border-radius: 0;
    overflow: hidden;
    box-shadow: 6px 6px 0 var(--ink);
    border: 2px solid var(--ink);
}

/* --- INPUT E SELECT "HEAVY" (Neobrutalist) --- */

/* Base comune */
.input-heavy,
.select-heavy {
    height: 3.2rem;
    background-color: var(--cream);
    border: 2px solid var(--ink);
    border-radius: 0;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--ink);
    transition: all 0.2s ease;
    box-shadow: none;
}

/* Stato Focus */
.input-heavy:focus,
.select-heavy:focus {
    outline: none;
    background-color: var(--cream);
    border-color: var(--ink);
    box-shadow: 3px 3px 0 var(--ink);
}

/* Placeholder */
.input-heavy::placeholder {
    color: var(--muted);
    font-weight: 400;
}

/* Stili specifici per la Select */
.select-heavy {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
}

.select-heavy:hover {
    background-color: var(--yellow);
    border-color: var(--ink);
}

/* --- Container Toolbar --- */
.toolbar-container {
    background: var(--cream);
    border: 2px solid var(--ink);
    padding: 0.5rem;
    border-radius: 0;
    display: flex;
    gap: 0.5rem;
}

/* --- CUSTOM DROPDOWN ANIMATO --- */

.custom-select-wrapper {
    position: relative;
    user-select: none;
    min-width: 200px;
}

/* IL BOTTONE (TRIGGER) */
.custom-select-trigger {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 3.2rem;
    padding: 0 1rem 0 3rem;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--ink);
    background: var(--cream);
    border: 2px solid var(--ink);
    border-radius: 0;
    cursor: pointer;
    transition: all 0.2s;
}

/* Hover & Active del bottone */
.custom-select-wrapper:hover .custom-select-trigger {
    background: var(--yellow);
    border-color: var(--ink);
}

.custom-select-wrapper.open .custom-select-trigger {
    background: var(--cream);
    border-color: var(--ink);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-bottom-color: transparent;
    z-index: 20;
}

/* L'ICONA A SINISTRA (Fissa) */
.custom-select-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    pointer-events: none;
    z-index: 21;
}

/* LA LISTA DELLE OPZIONI (Menu) */
.custom-options {
    position: absolute;
    display: block;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--cream);
    border: 2px solid var(--ink);
    border-top: none;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    box-shadow: 4px 4px 0 var(--ink);
    z-index: 10;

    /* ANIMAZIONE SETTINGS */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

/* STATO APERTO */
.custom-select-wrapper.open .custom-options {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    margin-top: -1px;
    border-color: var(--ink);
}

/* LE SINGOLE OPZIONI */
.custom-option {
    padding: 0.75rem 1rem 0.75rem 3rem;
    display: block;
    cursor: pointer;
    transition: 0.2s;
    font-size: 0.9rem;
    color: var(--ink);
}

.custom-option:hover {
    background-color: var(--yellow);
    color: var(--ink);
    font-weight: 600;
}

.custom-option.selected {
    background-color: var(--yellow);
    color: var(--ink);
    font-weight: 700;
}

/* Icona freccia che ruota */
.arrow-rotate {
    transition: transform 0.3s ease;
}

.custom-select-wrapper.open .arrow-rotate {
    transform: rotate(180deg);
}

/* --- PILLOLA ANIMATA (Neobrutalist) --- */
.pilla-glass {
    position: absolute;
    left: 4px;
    right: 4px;
    height: 40px;
    border-radius: 0;
    z-index: 0;

    background: var(--yellow);
    backdrop-filter: none;

    opacity: 0;
    transform: scale(0.95);
    pointer-events: none;

    transition:
        transform 0.25s cubic-bezier(0.2, 0.9, 0.4, 1.1),
        opacity 0.2s ease,
        height 0.2s ease;
}

/* MODIFICA ALLE OPZIONI (IMPORTANTE) */
.custom-option {
    position: relative;
    z-index: 1;
    padding: 0.75rem 1rem 0.75rem 3rem;
    display: block;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--ink);
    background: transparent;
    transition: color 0.2s;
    border-radius: 0;
}

/* Hover */
.custom-option:hover {
    background-color: transparent;
    color: var(--ink);
}

/* Stato selezionato (testo) */
.custom-option.selected {
    font-weight: 700;
    color: var(--ink);
}

/* --- PILLOLA ANIMATA (Neobrutalist) --- */
.pilla-glass {
    position: absolute;
    left: 4px;
    right: 4px;
    height: 40px;
    border-radius: 0;
    z-index: 0;

    background: var(--yellow);
    backdrop-filter: none;

    opacity: 0;
    transform: scale(0.95);
    pointer-events: none;

    transition:
        transform 0.25s cubic-bezier(0.2, 0.9, 0.4, 1.1),
        opacity 0.2s ease,
        height 0.2s ease;
}

/* MODIFICA ALLE OPZIONI (IMPORTANTE) */
.custom-option {
    position: relative;
    z-index: 1;
    padding: 0.75rem 1rem 0.75rem 3rem;
    display: block;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--ink);
    background: transparent;
    transition: color 0.2s;
    border-radius: 0;
}

/* Hover */
.custom-option:hover {
    background-color: transparent;
    color: var(--ink);
}

/* Stato selezionato (testo) */
.custom-option.selected {
    font-weight: 700;
    color: var(--ink);
}

/* MODIFICA QUESTA CLASSE ESISTENTE */
.custom-option {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 0.75rem;

    padding: 0.75rem 1rem 0.75rem 1rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--ink);
    background: transparent;
    transition: color 0.2s;
    border-radius: 0;
}

/* Quando l'opzione e selezionata o in hover */
.custom-option:hover i,
.custom-option.selected i {
    opacity: 1 !important;
    color: var(--ink);
}

/* Status specifici colori (Green/Red) al passaggio mouse */
.custom-option:hover .text-green-600 {
    color: var(--success) !important;
}

.custom-option:hover .text-red-500 {
    color: var(--error) !important;
}

/* --- SCROLLABLE CONTAINER --- */
.scroll-content {
    height: 100%;
    overflow-y: auto;
    padding: 2rem 2.5rem 8rem 2.5rem;
    scrollbar-width: thin;
    scrollbar-color: var(--stone) transparent;
}

/* --- CLIENT CARD PRO (Neobrutalist) --- */
.client-card-pro {
    background: var(--cream);
    border: 2px solid var(--ink);
    border-radius: 0;
    padding: 1.5rem;
    position: relative;
    display: flex;
    flex-direction: column;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 4px 4px 0 var(--ink);
}

.client-card-pro:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 var(--ink);
    border-color: var(--ink);
}

/* Header della Card */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

/* Avatar Squircle -> Neobrutalist */
.avatar-squircle {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    position: relative;
    border: 2px solid var(--ink);
}

/* Indicatore Status */
.status-dot-container {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 0;
    border: 2px solid var(--ink);
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 0;
    display: block;
}

.status-ok {
    background: var(--yellow);
    color: var(--ink);
    border: 2px solid var(--ink);
}

.status-ok .dot {
    background: var(--success);
    box-shadow: none;
}

.status-no {
    background: #fee2e2;
    color: var(--error);
    border: 2px solid var(--ink);
}

.status-no .dot {
    background: var(--error);
    box-shadow: none;
}

/* Box Statistiche Interno */
.stats-grid {
    background-color: var(--paper);
    border: 2px solid var(--ink);
    border-radius: 0;
    padding: 1rem;
    margin-top: 1rem;
    margin-bottom: 1.5rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--ink);
}

/* Footer Bottoni */
.card-footer {
    margin-top: auto;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.75rem;
}

/* --- GO-CARD STYLE (Neobrutalist) --- */
.go-card {
    background: var(--cream);
    border: 2px solid var(--ink);
    border-radius: 0;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    height: 100%;
    box-shadow: 4px 4px 0 var(--ink);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.go-card:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 var(--ink);
    border-color: var(--ink);
}

/* --- HEADER --- */
.go-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

/* Avatar Neobrutalist */
.go-avatar {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 700;
    border: 2px solid var(--ink);
}

/* Status Badge */
.go-badge {
    padding: 6px 12px;
    border-radius: 0;
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
    border: 2px solid var(--ink);
}

.badge-soft-green {
    background: var(--yellow);
    color: var(--ink);
}

.badge-soft-red {
    background: #fee2e2;
    color: var(--error);
}

.dot-fill {
    width: 6px;
    height: 6px;
    border-radius: 0;
    background: currentColor;
}

/* --- DATA BOX --- */
.go-data-box {
    background: var(--paper);
    border-radius: 0;
    border: 2px solid var(--ink);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.go-data-col {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.go-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 5px;
}

.go-value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--ink);
}

/* --- FOOTER & BOTTONI --- */
.go-footer {
    margin-top: auto;
    display: flex;
    gap: 10px;
}

/* Bottone Outline Neobrutalist */
.btn-go-outline {
    flex: 1;
    height: 3.5rem;
    background: var(--cream);
    border: 2px solid var(--ink);
    border-radius: 0;
    color: var(--ink);
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 3px 3px 0 var(--ink);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.btn-go-outline:hover {
    background: var(--yellow);
    color: var(--ink);
    border-color: var(--ink);
    transform: translate(-2px, -2px);
    box-shadow: 5px 5px 0 var(--ink);
}

/* Bottone Circolare -> Neobrutalist quadrato */
.btn-go-circle {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 0;
    background: var(--ink);
    color: var(--yellow);
    border: 2px solid var(--ink);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    box-shadow: 3px 3px 0 var(--ink);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-go-circle:hover {
    background: var(--ink);
    transform: translate(-2px, -2px);
    box-shadow: 5px 5px 0 var(--ink);
}

/* Bottone Warning Neobrutalist */
.btn-go-warning {
    width: 100%;
    height: 3.5rem;
    background: var(--yellow);
    border: 2px solid var(--ink);
    color: var(--ink);
    border-radius: 0;
    font-weight: 700;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: 3px 3px 0 var(--ink);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.btn-go-warning:hover {
    background: var(--yellow);
    border-color: var(--ink);
    transform: translate(-2px, -2px);
    box-shadow: 5px 5px 0 var(--ink);
}

/* Card "Aggiungi" tratteggiata */
.go-card-dashed {
    border: 3px dashed var(--ink);
    border-radius: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 280px;
    background: var(--paper);
    cursor: pointer;
}

.go-card-dashed:hover {
    background: var(--yellow);
    border-color: var(--ink);
}

/* --- SIDEBAR SIBILL OVERRIDES --- */

/* Logo Header */
#main-sidebar>div:first-child>div:first-child {
    background: transparent;
    border-bottom: 1px solid #eaeaea;
    height: 64px;
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

/* Hide quick actions bar in Sibill mode */
.sidebar-quick-actions {
    display: none !important;
}

/* User Section at Bottom */
#main-sidebar>div:last-child {
    background: transparent;
    border-top: 2px solid #ffffff;
    padding: 8px 0;
}

/* Neobrutalist Bottom Section */
.neo-sidebar-bottom {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 10px 0;
    border-top: 2px solid #ffffff;
    flex-shrink: 0;
}
.neo-sidebar-help-btn {
    width: 32px;
    height: 32px;
    border: 2px solid rgba(255,255,255,.2);
    background: transparent;
    color: rgba(255,255,255,.4);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}
.neo-sidebar-help-btn:hover {
    border-color: #ffffff;
    color: #ffffff;
    background: rgba(255,255,255,.1);
}
.neo-sidebar-avatar {
    width: 36px;
    height: 36px;
    border: 2px solid #ffffff;
    background: rgba(255,255,255,.15);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 11px;
    letter-spacing: .02em;
    cursor: pointer;
}
.neo-sidebar-online-dot {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 10px;
    height: 10px;
    background: #ffffff;
    border: 2px solid #0d0d0d;
}

/* User dropdown menu — neobrutalist */
/* L'icona della categoria prende il posto del pallino. Se non carica, il
   pallino torna — l'intestazione non deve restare senza nulla a sinistra. */
.gs-category-fig {
    width: 20px;
    height: 20px;
    object-fit: contain;
    flex: 0 0 20px;
}

/* Legenda della ricerca: quattro famiglie, con il colore che si rivedrà
   nei risultati. Il colore raggruppa, l'etichetta distingue — e chi non
   separa bene i colori legge comunque le parole. */
.gs-legenda {
    display: grid;
    gap: 6px;
    margin: 16px auto 18px;
    max-width: 460px;
    text-align: left;
}

.gs-legenda-riga {
    display: flex;
    align-items: baseline;
    gap: 9px;
    font-size: 12.5px;
    line-height: 1.4;
}

/* Nella legenda stanno insieme la figura e il pallino: la figura è quella che
   si ritroverà accanto a ogni risultato, il pallino è il colore della
   famiglia. Impararli qui costa una riga e risparmia una domanda dopo. */
.gs-legenda-fig {
    width: 22px;
    height: 22px;
    object-fit: contain;
    flex: 0 0 22px;
    user-select: none;
}

.gs-legenda-punto {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    flex: 0 0 9px;
    transform: translateY(1px);
}

.gs-legenda-nome {
    font-weight: 600;
    color: #111827;
    white-space: nowrap;
}

.gs-legenda-cosa {
    color: #6b7280;
}

/* Menu del profilo.

   Era neo-brutalista: bordo nero da 2px e ombra dura spostata di 4px. Va
   contro le regole di stile che ci siamo dati — niente hard offset shadow,
   niente bordi neri spessi — ed è l'ultimo pezzo di quel linguaggio rimasto
   su una cosa che si apre tutti i giorni. Angoli morbidi, bordo capello,
   ombra diffusa, e il grassetto tolto: tre voci non hanno bisogno di urlare. */
.neo-user-menu {
    position: fixed;
    width: 190px;
    padding: 4px;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.07);
    border-radius: 12px;
    box-shadow: 0 8px 28px rgba(15, 15, 20, 0.14);
    overflow: hidden;
    z-index: 99999;
}

.neo-user-menu-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #111827;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    transition: background 140ms ease;
}

.neo-user-menu-item:hover {
    background: #f4f4f5;
}

.neo-user-menu-item:active {
    transform: scale(0.99);
}

/* Una riga sottile prima di «Esci»: separa l'azione che chiude tutto dalle
   due che non fanno danni. Senza, il bottone rosso è solo un altro colore. */
.neo-user-menu-danger {
    color: #dc2626;
    margin-top: 4px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 0 0 8px 8px;
    padding-top: 11px;
}

.neo-user-menu-danger:hover {
    background: #fef2f2;
}

/* Hide team online widget in Sibill mode */
#sidebar-team-online-widget {
    display: none !important;
}

/* Nav Item Icon wrapper — transparent */
#main-sidebar .nav-item>div:first-child {
    border: none;
    box-shadow: none;
    background: transparent !important;
    width: auto;
    height: auto;
}
#main-sidebar .nav-item:hover>div:first-child { transform: none; }
#main-sidebar .nav-item.active>div:first-child { background: transparent !important; border: none; box-shadow: none; }

/* Nav scrollbar — thin yellow */
#main-nav::-webkit-scrollbar { width: 3px; }
#main-nav::-webkit-scrollbar-track { background: transparent; }
#main-nav::-webkit-scrollbar-thumb { background: #ffffff; border-radius: 0; }

/* User Card in Sibill */
#main-sidebar .user-card-sibill {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px;
    cursor: pointer;
}

/* Hide user details in narrow sidebar */
#main-sidebar .user-details-box {
    display: none;
}

/* Hide chevron in narrow sidebar */
#user-menu-chevron {
    display: none;
}

/* App content — full height, no padding */
#app-content {
    height: calc(100vh - 5rem);
    overflow-y: auto;
    overflow-x: hidden;
}

/* Animazione Dropdown */
#company-dropdown {
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Fix Scroll */
body {
    overflow: hidden;
}

/* Custom Scrollbar Neobrutalist */
.scroll-smooth::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.scroll-smooth::-webkit-scrollbar-track {
    background: transparent;
}

.scroll-smooth::-webkit-scrollbar-thumb {
    background: var(--stone);
    border-radius: 0;
}

.scroll-smooth::-webkit-scrollbar-thumb:hover {
    background: var(--muted);
}

/* Animazione Caricamento */
@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.98) translateY(10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.animate-fade-in {
    animation: fadeInScale 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Dropdown */
#company-dropdown {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

/* Cortex Specifics */
.cortex-nav-btn {
    position: relative;
    transition: all 0.2s ease;
}

.cortex-nav-btn.active::after {
    content: '';
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    background-color: var(--yellow);
    border: 2px solid var(--ink);
    border-radius: 0;
}

/* --- SIDEBAR TRANSITIONS --- */
.sidebar-solid {
    white-space: nowrap;
    overflow: hidden;
    background: #000000;
}

/* Stato Collassato COMPLETAMENTE (0px) */
.sidebar-collapsed {
    width: 0 !important;
    min-width: 0 !important;
    padding: 0 !important;
    border-right: none !important;
    opacity: 0;
}

/* --- VOICE MODE OVERLAY --- */
#voice-overlay {
    backdrop-filter: none;
    background: rgba(13, 13, 13, 0.95);
}

.voice-orb {
    width: 120px;
    height: 120px;
    background: var(--ink);
    border-radius: 0;
    border: 4px solid var(--yellow);
    box-shadow: 6px 6px 0 var(--yellow);
    animation: breathe 3s infinite ease-in-out;
    position: relative;
    transition: all 0.3s ease;
}

.voice-orb.listening {
    animation: pulseListen 1.5s infinite ease-in-out;
    background: var(--success);
    border-color: var(--ink);
    box-shadow: 6px 6px 0 var(--ink);
    transform: scale(1.1);
}

.voice-orb.speaking {
    animation: pulseSpeak 0.5s infinite alternate;
    background: var(--error);
    border-color: var(--ink);
}

@keyframes breathe {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.8;
    }

    50% {
        transform: scale(1.05);
        opacity: 1;
    }
}

@keyframes pulseListen {
    0% {
        box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.4);
    }

    70% {
        box-shadow: 0 0 0 30px rgba(22, 163, 74, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(22, 163, 74, 0);
    }
}

@keyframes pulseSpeak {
    0% {
        transform: scale(1);
        filter: brightness(1);
    }

    100% {
        transform: scale(1.15);
        filter: brightness(1.3);
    }
}

/* --- SIDEBAR TOGGLE LOGIC --- */

/* Base Sidebar — smooth width transition */
#main-sidebar {
    width: 80px;
    min-width: 80px;
    overflow: hidden;
    white-space: nowrap;
    transition: width 0.35s cubic-bezier(0.25, 1, 0.5, 1),
        min-width 0.35s cubic-bezier(0.25, 1, 0.5, 1),
        opacity 0.2s ease;
}

/* Inner content fade for smoothness */
#main-sidebar>div {
    transition: opacity 0.2s ease;
}

/* Closed State — width collapses to 0 */
body.sidebar-closed #main-sidebar {
    width: 0px !important;
    min-width: 0px !important;
    border-right-width: 0;
    pointer-events: none;
    opacity: 0;
}

/* Hide inner content instantly when closing */
body.sidebar-closed #main-sidebar>div {
    opacity: 0;
}

/* Hide Text Elements when Closed */
body.sidebar-closed #main-sidebar .nav-text,
body.sidebar-closed #main-sidebar .section-label,
body.sidebar-closed #main-sidebar .user-details-box,
body.sidebar-closed #main-sidebar .logo-full {
    display: none;
    opacity: 0;
    pointer-events: none;
}

/* Show Icon Logo when Closed */
body.sidebar-closed #main-sidebar .logo-icon {
    opacity: 1;
    position: static;
}

/* Center Items when Closed */
body.sidebar-closed #main-sidebar .nav-item {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

body.sidebar-closed #main-sidebar .logo-box {
    justify-content: center;
}

/* --- VOICE OVERLAY --- */
#voice-overlay {
    backdrop-filter: none;
    background: rgba(13, 13, 13, 0.95);
}

.voice-orb {
    width: 100px;
    height: 100px;
    border-radius: 0;
    background: var(--ink);
    border: 4px solid var(--yellow);
    box-shadow: 6px 6px 0 var(--yellow);
    transition: all 0.3s ease;
}

.voice-orb.listening {
    background: var(--success);
    border-color: var(--ink);
    box-shadow: 6px 6px 0 var(--ink);
    transform: scale(1.1);
    animation: pulseListen 1.5s infinite;
}

.voice-orb.speaking {
    background: var(--error);
    border-color: var(--ink);
    animation: pulseSpeak 0.5s infinite alternate;
}

@keyframes pulseListen {
    0% {
        box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.4);
    }

    70% {
        box-shadow: 0 0 0 30px rgba(22, 163, 74, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(22, 163, 74, 0);
    }
}

@keyframes pulseSpeak {
    0% {
        transform: scale(1);
        filter: brightness(1);
    }

    100% {
        transform: scale(1.1);
        filter: brightness(1.2);
    }
}

/* Scrollbar Custom Neobrutalist */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: var(--stone);
    border-radius: 0;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

/* --- CORTEX VOICE MODE (Neobrutalist) --- */

#voice-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Base dell'Orbe */
.voice-orb-liquid {
    position: relative;
    width: 140px;
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 1. Il Nucleo Solido */
.liquid-core {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 0;
    background: var(--cream);
    border: 4px solid var(--ink);
    filter: none;
    opacity: 0.9;
    z-index: 2;
    animation: morph 6s linear infinite;
    box-shadow: 6px 6px 0 var(--ink);
}

/* 2. Il Bagliore Esterno */
.liquid-glow {
    position: absolute;
    width: 180%;
    height: 180%;
    border-radius: 0;
    background: none;
    filter: none;
    z-index: 1;
    opacity: 0.5;
    transition: all 0.5s ease;
}

/* 3. Anello di Ripple */
.liquid-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 0;
    border: 2px solid var(--yellow);
    opacity: 0;
    z-index: 0;
}

/* --- STATI DELL'ORBE --- */

/* STATO 1: LISTENING */
.voice-orb-liquid.listening .liquid-core {
    background: var(--cream);
    border-color: var(--ink);
    animation: morph 8s ease-in-out infinite alternate, breathe 3s ease-in-out infinite;
    box-shadow: 6px 6px 0 var(--ink);
}

.voice-orb-liquid.listening .liquid-glow {
    background: none;
}

/* STATO 2: PROCESSING */
.voice-orb-liquid.processing {
    transform: scale(0.8);
}

.voice-orb-liquid.processing .liquid-core {
    background: var(--yellow);
    border-color: var(--ink);
    border-radius: 0;
    animation: spin 1s linear infinite;
    opacity: 1;
    box-shadow: 6px 6px 0 var(--ink);
}

.voice-orb-liquid.processing .liquid-glow {
    background: none;
    transform: scale(1.5);
}

/* STATO 3: SPEAKING */
.voice-orb-liquid.speaking {
    transform: scale(1.1);
}

.voice-orb-liquid.speaking .liquid-core {
    background: var(--ink);
    border-color: var(--yellow);
    background-size: 200% 200%;
    animation: morph 3s linear infinite, aurora 3s ease infinite;
    box-shadow: 6px 6px 0 var(--yellow);
}

.voice-orb-liquid.speaking .liquid-glow {
    background: none;
    animation: pulseGlow 1.5s ease-in-out infinite;
}

.voice-orb-liquid.speaking .liquid-ring {
    animation: ripple 2s linear infinite;
}

/* --- ANIMAZIONI KEYFRAMES --- */

@keyframes morph {
    0% {
        border-radius: 0;
        transform: rotate(0deg);
    }

    33% {
        border-radius: 0;
    }

    66% {
        border-radius: 0;
    }

    100% {
        border-radius: 0;
        transform: rotate(360deg);
    }
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

@keyframes breathe {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

@keyframes aurora {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

@keyframes pulseGlow {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.5;
    }

    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }
}

@keyframes ripple {
    0% {
        transform: scale(1);
        opacity: 0.8;
        border-width: 2px;
    }

    100% {
        transform: scale(2.5);
        opacity: 0;
        border-width: 0px;
    }
}

/* --- MASTRO AI STYLES (Neobrutalist) --- */

#voice-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* LA BOLLA */
.voice-blob {
    width: 160px;
    height: 160px;
    border-radius: 0;
    position: relative;
    transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    filter: none;
    border: 4px solid var(--yellow);
    box-shadow: 6px 6px 0 var(--yellow);
}

/* STATO 1: LISTENING */
.voice-blob.listening {
    background: var(--ink);
    animation: morphBlob 6s ease-in-out infinite;
    transform: scale(1);
}

/* STATO 2: PROCESSING */
.voice-blob.processing {
    background: var(--yellow);
    border-color: var(--ink);
    border-radius: 0;
    animation: pulseThink 1.5s ease-in-out infinite;
    transform: scale(0.9);
    box-shadow: 6px 6px 0 var(--ink);
}

/* STATO 3: SPEAKING */
.voice-blob.speaking {
    background: var(--error);
    border-color: var(--ink);
    animation: morphBlobFast 3s ease-in-out infinite;
    transform: scale(1.1);
    box-shadow: 6px 6px 0 var(--ink);
}

/* ONDE CONCENTRICHE (Ripples) */
.active-ripple {
    animation: rippleEffect 2s linear infinite;
}

/* --- KEYFRAMES --- */

@keyframes morphBlob {

    0%,
    100% {
        border-radius: 0;
    }

    33% {
        border-radius: 0;
    }

    66% {
        border-radius: 0;
    }
}

@keyframes morphBlobFast {

    0%,
    100% {
        border-radius: 0;
        transform: scale(1.1) rotate(0deg);
    }

    50% {
        border-radius: 0;
        transform: scale(1.15) rotate(180deg);
    }
}

/* Pulsazione Pensiero */
@keyframes pulseThink {
    0% {
        transform: scale(0.85);
        box-shadow: 0 0 0 0 rgba(13, 13, 13, 0.4);
    }

    70% {
        transform: scale(0.95);
        box-shadow: 0 0 0 30px rgba(13, 13, 13, 0);
    }

    100% {
        transform: scale(0.85);
        box-shadow: 0 0 0 0 rgba(13, 13, 13, 0);
    }
}

/* Cerchi che si allargano */
@keyframes rippleEffect {
    0% {
        transform: scale(0.8);
        opacity: 0.8;
        border-width: 2px;
    }

    100% {
        transform: scale(2.2);
        opacity: 0;
        border-width: 0px;
    }
}

/* --- CORTEX TABS (Neobrutalist) --- */
.cortex-tab {
    position: relative;
    border: 2px solid transparent;
    border-radius: 0;
}

/* Stato Attivo */
.cortex-tab.active {
    background-color: var(--yellow);
    color: var(--ink);
    box-shadow: 3px 3px 0 var(--ink);
    border-color: var(--ink);
}

/* Transizioni fluide */
.cortex-view {
    animation: fadeInScale 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Missing List Items */
.missing-item {
    background-image: repeating-linear-gradient(-45deg,
            var(--cream),
            var(--cream) 10px,
            var(--paper) 10px,
            var(--paper) 20px);
    border: 2px solid var(--ink);
}

/* --- SIDEBAR FOLDING ANIMATION --- */
#main-sidebar {
    transition: width 0.35s cubic-bezier(0.25, 1, 0.5, 1),
        min-width 0.35s cubic-bezier(0.25, 1, 0.5, 1),
        opacity 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
}

/* Stato Chiuso (Folded) */
#main-sidebar.collapsed {
    width: 5rem !important;
}

/* Nascondi elementi testuali quando chiuso */
#main-sidebar.collapsed .nav-text,
#main-sidebar.collapsed .logo-text-box,
#main-sidebar.collapsed .section-label,
#main-sidebar.collapsed .user-details-box {
    opacity: 0;
    pointer-events: none;
    display: none;
}

/* Centra icone quando chiuso */
#main-sidebar.collapsed .nav-item {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

#main-sidebar.collapsed .nav-item i {
    margin-right: 0;
}

#main-sidebar.collapsed .logo-box {
    margin-right: 0;
}

/* Tooltip on hover per sidebar chiusa */
#main-sidebar.collapsed .nav-item:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

/* Prompt Bar Styles */
#ai-prompt-input:focus {
    outline: none;
    box-shadow: 3px 3px 0 var(--ink);
}

#ai-prompt-input {
    min-height: 44px;
}

/* Bottoni azione piccoli dentro le card chat */
.btn-action-sm {
    padding: 6px 12px;
    border-radius: 0;
    font-size: 11px;
    font-weight: 700;
    transition: all 0.2s;
    cursor: pointer;
    border: 2px solid var(--ink);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Scrollbar personalizzata per la chat */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background-color: var(--stone);
    border-radius: 0;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background-color: var(--muted);
}

/* --- SOLID COMPANY DROPDOWN (Neobrutalist) --- */

#company-dropdown {
    backdrop-filter: none !important;
    background-color: var(--cream) !important;

    border: 2px solid var(--ink);
    box-shadow: 4px 4px 0 var(--ink);

    border-radius: 0;
    padding: 6px;
    width: 300px;

    transform-origin: top right;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* HEADER DEL DROPDOWN */
.dropdown-section-label {
    padding: 12px 12px 8px 12px;
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* ITEM AZIENDA */
.company-item-solid {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: 0;
    cursor: pointer;
    transition: all 0.1s ease;
    border: 2px solid transparent;
    position: relative;
}

/* Hover State */
.company-item-solid:hover {
    background-color: var(--yellow);
    border-color: var(--ink);
}

/* Active/Selected State */
.company-item-solid.active {
    background-color: var(--yellow);
    border-color: var(--ink);
}

/* AVATAR */
.c-avatar {
    width: 40px;
    height: 40px;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    color: white;
    box-shadow: 2px 2px 0 var(--ink);
    border: 2px solid var(--ink);
    flex-shrink: 0;
}

/* TESTI */
.c-info {
    flex: 1;
    min-width: 0;
}

.c-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--ink);
    line-height: 1.2;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.c-meta {
    font-size: 0.75rem;
    color: var(--muted);
    font-weight: 500;
}

/* BADGE ONLINE / ACTIVE */
.badge-online {
    display: flex;
    align-items: center;
    gap: 4px;
    background-color: var(--yellow);
    color: var(--ink);
    font-size: 0.65rem;
    font-weight: 800;
    padding: 4px 8px;
    border-radius: 0;
    border: 2px solid var(--ink);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.dot-pulse {
    width: 6px;
    height: 6px;
    background-color: var(--success);
    border-radius: 0;
    box-shadow: none;
}

/* FOOTER (Gestisci Organizzazione) */
.dropdown-footer {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 2px solid var(--ink);
}

.btn-manage-org {
    width: 100%;
    padding: 10px;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--ink);
    background: transparent;
    transition: background 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.btn-manage-org:hover {
    background-color: var(--yellow);
}

/* --- NEWS PUBLISH ANIMATIONS --- */
@keyframes scale-in {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.animate-scale-in {
    animation: scale-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes confetti-fall {
    0% {
        transform: translateY(-50px) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: translateY(350px) rotate(720deg);
        opacity: 0;
    }
}

.animate-confetti {
    animation: confetti-fall 2s ease-out forwards;
}

/* ===== GLOBAL SEARCH — Command Palette (Neobrutalist) ===== */

.gs-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 12vh;
    background: rgba(15, 15, 15, 0.4);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.gs-overlay.gs-visible {
    opacity: 1;
}

.gs-overlay.hidden {
    display: none !important;
}

.gs-palette {
    width: 100%;
    max-width: 640px;
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid #ececec;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    transform: scale(0.98) translateY(-6px);
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
        opacity 0.16s ease;
    opacity: 0;
}

.gs-visible .gs-palette {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* --- Input area --- */
.gs-input-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
}

.gs-input-icon {
    flex-shrink: 0;
    color: #9ca3af;
}

.gs-input-wrap input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 17px;
    font-weight: 500;
    color: var(--ink);
    font-family: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;
}

.gs-input-wrap input::placeholder {
    color: var(--muted);
    font-weight: 400;
}

.gs-input-kbd {
    flex-shrink: 0;
    padding: 3px 8px;
    background: #f7f7f8;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    color: #9ca3af;
    font-family: system-ui, sans-serif;
}

/* --- Results scrollable area --- */
.gs-results {
    max-height: 420px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--stone) transparent;
}

.gs-results::-webkit-scrollbar {
    width: 5px;
}

.gs-results::-webkit-scrollbar-thumb {
    background: var(--stone);
    border-radius: 0;
}

.gs-results::-webkit-scrollbar-track {
    background: transparent;
}

/* --- Hint (empty state) --- */
.gs-hint {
    padding: 48px 24px;
    text-align: center;
}

/* La lente non è più un tratto grigio da 32px ma l'illustrazione 3D: la
   stessa famiglia di figure che si vede nel menu e nelle schede della home,
   così la ricerca non sembra un pezzo di un altro programma. */
.gs-hint-icon {
    margin-bottom: 12px;
    display: flex;
    justify-content: center;
}
.gs-hint-icon img {
    width: 64px;
    height: 64px;
    object-fit: contain;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,.06));
    user-select: none;
}

.gs-hint-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 4px;
}

.gs-hint-sub {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 20px;
}

.gs-hint-shortcuts {
    display: flex;
    justify-content: center;
    gap: 16px;
    font-size: 11px;
    color: var(--muted);
}

.gs-hint-shortcuts kbd {
    padding: 2px 6px;
    background: #f7f7f8;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 600;
    color: #6b7280;
    font-family: system-ui, sans-serif;
    margin: 0 2px;
}

/* Infobox-pitch: ricerca semantica "Chiedi a Narya" col passaporto documento */
.gs-hint-pitch {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    text-align: left;
    max-width: 460px;
    margin: 28px auto 0;
    padding: 14px 16px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.07), rgba(99, 102, 241, 0.02));
    border: 1px solid rgba(99, 102, 241, 0.18);
    border-radius: 14px;
}

/* Narya ha la sua sfera di cristallo, la stessa del menu. Il quadratino
   indaco con la stelletta dentro non voleva dire niente a chi non l'aveva
   già visto; la sfera è la faccia di Narya in tutto il prodotto. */
.gs-hint-pitch-glyph {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    object-fit: contain;
    user-select: none;
}

.gs-hint-pitch-title {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ink);
    margin: 1px 0 3px;
}

.gs-hint-pitch-title em {
    font-style: normal;
    color: #4f46e5;
}

.gs-hint-pitch-sub {
    font-size: 11.5px;
    line-height: 1.45;
    color: var(--muted);
    margin: 0;
}

/* --- Loading --- */
.gs-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 36px 24px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
}

.gs-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--stone);
    border-top-color: var(--ink);
    border-radius: 50%;
    animation: gs-spin 0.6s linear infinite;
}

@keyframes gs-spin {
    to {
        transform: rotate(360deg);
    }
}

/* --- Category groups --- */
.gs-category {
    padding: 4px 0;
}

.gs-category-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px 4px;
}

.gs-category-dot {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    flex-shrink: 0;
    border: none;
}

.gs-category-label {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}

.gs-category-count {
    font-size: 10px;
    font-weight: 600;
    color: #6b7280;
    background: #f3f4f6;
    padding: 1px 6px;
    border-radius: 999px;
    border: none;
}

/* --- Result rows --- */
.gs-result-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    margin: 0 8px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.12s ease;
    border-left: none;
}

.gs-result-row:hover,
.gs-result-row.gs-selected {
    background: #f3f4f6;
    border-left: none;
}

.gs-result-avatar {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
    letter-spacing: -0.02em;
}

.gs-result-info {
    flex: 1;
    min-width: 0;
}

.gs-result-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.gs-result-sub {
    font-size: 11px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}

.gs-result-action {
    flex-shrink: 0;
    color: var(--stone);
    transition: color 0.15s;
}

.gs-result-row:hover .gs-result-action,
.gs-result-row.gs-selected .gs-result-action {
    color: var(--ink);
}

/* --- Highlight match --- */
.gs-highlight {
    background: #fff3cd;
    color: #1a1a1a;
    border-radius: 3px;
    padding: 0 2px;
}

/* --- Empty state --- */
.gs-empty {
    padding: 48px 24px;
    text-align: center;
}

.gs-empty-icon {
    color: var(--stone);
    display: flex;
    justify-content: center;
    margin-bottom: 12px;
}

.gs-empty-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 4px;
}

.gs-empty-sub {
    font-size: 12px;
    color: var(--muted);
}

/* --- Footer --- */
.gs-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    border-top: 1px solid #f0f0f0;
    background: #fafafa;
    font-size: 11px;
    color: #9ca3af;
}

.gs-footer-shortcuts kbd {
    padding: 1px 5px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 600;
    color: #6b7280;
    font-family: system-ui, sans-serif;
    margin: 0 1px;
}

/* ===================================================
   GLOBAL SEARCH — "Chiedi a Narya" (AI mode)
   =================================================== */

/* Riga "✦ Chiedi a Narya" in cima ai risultati */
.gs-ask-narya {
    background: linear-gradient(100deg, #fbf6ee 0%, #ffffff 70%);
}
.gs-ask-narya.gs-selected,
.gs-ask-narya:hover {
    background: #fdf2e3;
}
.gs-ask-narya-featured {
    box-shadow: inset 2px 0 0 var(--ink, #0d0d0d);
}
.gs-ask-narya-glyph {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    object-fit: contain;
    user-select: none;
}
.gs-ask-narya .gs-result-sub kbd {
    padding: 0 4px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 5px;
    font-size: 10px;
    font-weight: 600;
    font-family: system-ui, sans-serif;
}

/* Pulsante secondario "✦ Dossier" sulle righe cliente */
.gs-dossier-btn {
    flex-shrink: 0;
    padding: 4px 9px;
    border-radius: 7px;
    border: 1px solid #e5e7eb;
    background: #fff;
    color: var(--ink, #0d0d0d);
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.12s ease, background 0.12s ease;
}
.gs-result-row:hover .gs-dossier-btn,
.gs-result-row.gs-selected .gs-dossier-btn {
    opacity: 1;
}
.gs-dossier-btn:hover {
    background: #fdf2e3;
    border-color: #f0d4ab;
}

/* Loader AI inline (riusa lo spinner della ricerca lessicale) */
.gs-ai-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 36px 24px;
    color: var(--muted, #6b7280);
    font-size: 13px;
    font-weight: 600;
}

.gs-ai-error {
    padding: 28px 24px;
    text-align: center;
    color: #ef4444;
    font-size: 13px;
    font-weight: 600;
}

/* Risposta AI */
.gs-ai-answer {
    padding: 16px 20px;
    font-size: 14px;
    line-height: 1.55;
    color: var(--ink, #0d0d0d);
    white-space: normal;
}

/* Dossier */
.gs-dossier {
    margin: 4px 8px 8px;
    padding: 10px 12px;
    border: 1px solid #f0e6d6;
    border-radius: 10px;
    background: #fcf8f1;
}
.gs-dossier-head {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted, #6b7280);
    margin-bottom: 6px;
}
.gs-dossier-sec {
    margin-top: 8px;
}
.gs-dossier-sec-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--ink, #0d0d0d);
    margin-bottom: 3px;
}
.gs-dossier-item {
    font-size: 12px;
    color: #4b5563;
    padding: 2px 0 2px 10px;
    border-left: 2px solid #ece2d0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Dossier strutturato v2 — anagrafica, righe sezione, chip vuoti */
.gs-anag {
    margin: 4px 0 10px;
    padding: 10px 12px;
    background: #faf7f1;
    border: 1px solid #ece2d0;
    border-radius: 10px;
}
.gs-anag-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--ink, #0d0d0d);
    display: flex;
    align-items: center;
    gap: 8px;
}
.gs-anag-tag {
    font-size: 10px;
    font-weight: 700;
    color: #0d0d0d;
    background: #fde68a;
    border-radius: 3px;
    padding: 1px 6px;
}
.gs-anag-fields {
    margin-top: 3px;
    font-size: 12px;
    color: #6b7280;
}
.gs-doss-row.gs-doss-clickable {
    cursor: pointer;
    border-radius: 8px;
}
.gs-doss-row.gs-doss-clickable:hover {
    background: #f4f4f5;
}
.gs-doc-open {
    font-size: 11px;
    font-weight: 700;
    color: #0d0d0d;
    white-space: nowrap;
}
.gs-empty-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0 2px;
}
.gs-empty-chip {
    font-size: 11px;
    color: #9ca3af;
    background: #f7f4ee;
    border: 1px solid #ece2d0;
    border-radius: 999px;
    padding: 1px 8px;
}

/* Modal anteprima documento (sopra la palette ⌘K) */
.gs-doc-modal {
    position: fixed; inset: 0; z-index: 100050;
    background: rgba(15, 23, 42, .55);
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
    animation: gsDocFade .12s ease both;
}
@keyframes gsDocFade { from { opacity: 0; } to { opacity: 1; } }
.gs-doc-card {
    width: 100%; max-width: 920px; height: 88vh;
    background: #ffffff; border-radius: 14px; overflow: hidden;
    display: flex; flex-direction: column;
    box-shadow: 0 24px 64px rgba(15, 23, 42, .35);
}
.gs-doc-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 12px 14px; border-bottom: 1px solid #ececec; background: #faf9f7;
}
.gs-doc-name {
    font-size: 13px; font-weight: 700; color: #0d0d0d;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.gs-doc-head-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.gs-doc-dl {
    font-size: 12px; font-weight: 700; color: #0d0d0d; text-decoration: none;
    background: #fde68a; border-radius: 7px; padding: 5px 10px;
}
.gs-doc-dl:hover { filter: brightness(.96); }
.gs-doc-x {
    width: 30px; height: 30px; border: 0; cursor: pointer; border-radius: 8px;
    background: #f1efea; color: #0f172a; font-size: 20px; line-height: 1;
    display: flex; align-items: center; justify-content: center;
}
.gs-doc-x:hover { background: #e7e3dc; }
.gs-doc-body { flex: 1; min-height: 0; background: #f3f4f6; }
.gs-doc-frame { width: 100%; height: 100%; border: 0; }
.gs-doc-imgwrap { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; overflow: auto; }
.gs-doc-img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* Citazioni cliccabili */
.gs-cit-list {
    padding: 4px 0 8px;
}
.gs-cit-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    background: #f3f4f6;
}

/* ===================================================
   CALENDAR SUB-SIDEBAR (Neobrutalist)
   =================================================== */

.cal-subnav-panel {
    position: fixed;
    top: 0;
    left: 80px;
    height: 100vh;
    width: 232px;
    background: var(--cream);
    border-right: 2px solid var(--ink);
    box-shadow: 4px 0 0 var(--ink);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    opacity: 0;
    pointer-events: none;
    will-change: transform, opacity;
    transition:
        transform 0.22s cubic-bezier(0.22, 1, 0.36, 1),
        opacity 0.15s ease;
    overflow-y: auto;
    scrollbar-width: none;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

.cal-subnav-panel::-webkit-scrollbar {
    display: none;
}

/* Hover bridge */
.cal-subnav-panel::before {
    content: '';
    position: absolute;
    left: -20px;
    top: 0;
    width: 20px;
    height: 100%;
}

.cal-subnav-panel.open {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}

/* Backdrop */
.cal-subnav-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10;
    background: transparent;
    pointer-events: none;
    transition: background 0.2s ease;
}

.cal-subnav-backdrop.open {
    pointer-events: auto;
    background: rgba(13, 13, 13, 0.05);
}

/* -- Page label at top -- */
.cal-subnav-header {
    padding: 22px 20px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 2px solid var(--ink);
    margin-bottom: 4px;
    flex-shrink: 0;
}

.cal-subnav-header-icon {
    width: 20px;
    height: 20px;
    color: var(--muted);
    flex-shrink: 0;
}

.cal-subnav-header-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
    letter-spacing: -0.01em;
}

/* -- Sections -- */
.cal-subnav-section {
    padding: 14px 12px 0 12px;
    margin-bottom: 0;
}

.cal-subnav-section:last-child {
    padding-bottom: 14px;
}

.cal-subnav-section+.cal-subnav-section {
    border-top: 2px solid var(--stone);
}

.cal-subnav-section-title {
    font-size: 10.5px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 4px;
    padding: 0 8px 4px;
}

/* -- Items -- */
.cal-subnav-item {
    display: block;
    width: 100%;
    padding: 8px 10px;
    border-radius: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    text-align: left;
    font-size: 13.5px;
    font-weight: 420;
    color: var(--ink);
    line-height: 1;
    position: relative;
    transition: background 0.12s ease, color 0.12s ease;
    font-family: inherit;
}

.cal-subnav-item:hover {
    background: var(--yellow);
    color: var(--ink);
}

.cal-subnav-item.active {
    font-weight: 580;
    color: var(--ink);
    background: var(--yellow);
}

.cal-subnav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 16px;
    background: var(--ink);
    border-radius: 0;
}

/* -- Entrance -- */
.cal-subnav-header,
.cal-subnav-section {
    opacity: 0;
    transform: translateX(-5px);
}

.cal-subnav-panel.open .cal-subnav-header {
    animation: calSecIn 0.22s cubic-bezier(0.22, 1, 0.36, 1) 0.03s both;
}

.cal-subnav-panel.open .cal-subnav-section:nth-child(2) {
    animation: calSecIn 0.22s cubic-bezier(0.22, 1, 0.36, 1) 0.06s both;
}

.cal-subnav-panel.open .cal-subnav-section:nth-child(3) {
    animation: calSecIn 0.22s cubic-bezier(0.22, 1, 0.36, 1) 0.09s both;
}

@keyframes calSecIn {
    from {
        opacity: 0;
        transform: translateX(-5px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Nav button — sub-open state */
#main-sidebar #nav-flows.sub-open {
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.08);
}

#main-sidebar #nav-flows.sub-open::after {
    content: '';
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 4px;
    background: rgba(255, 255, 255, 0.55);
    border-radius: 0;
}

/* ═══════════════════════════════════════════════════════════════
   FIRMA SUB-SIDEBAR — Neobrutalist
   ═══════════════════════════════════════════════════════════════ */
/* ── Panel ── */
.fsn-panel {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 220px;
    background: #0d0d0d;
    border-right: none;
    box-shadow: none;
    /* Sopra qualunque contenuto di pagina. Serve un numero alto e non uno
       qualsiasi: la console IA e l'AML si disegnano a schermo intero da 80px
       in poi (`fixed inset-y-0 right-0 left-20 z-[200]`), cioè esattamente
       dove scorre fuori questo pannello. A 15 il menu si apriva davvero, ma
       sotto: premevi Scadenze o Archivio e non vedevi niente. Questo è il
       menu di navigazione, non contenuto — deve stare sopra la pagina. */
    z-index: 210;
    display: flex;
    flex-direction: column;
    transform: translateX(-240px);
    pointer-events: none;
    visibility: hidden;
    will-change: transform;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), visibility 0s 0.4s;
    overflow-y: auto;
    scrollbar-width: none;
    font-family: 'Plus Jakarta Sans', -apple-system, sans-serif;
}
.fsn-panel::-webkit-scrollbar { display: none; }
.fsn-panel.open {
    transform: translateX(80px);
    pointer-events: auto;
    visibility: visible;
    box-shadow: 8px 0 24px rgba(0,0,0,.25);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), visibility 0s 0s;
}
/* ── Header ── */
.fsn-header {
    padding: 20px 16px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    flex-shrink: 0;
}
.fsn-header-icon {
    width: 30px;
    height: 30px;
    border: 2px solid rgba(255,255,255,.15);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #ffffff;
}
.fsn-header-title {
    font-size: 13px;
    font-weight: 800;
    color: #fff;
    letter-spacing: 0.02em;
}
.fsn-header-sub {
    font-size: 9px;
    font-weight: 500;
    color: rgba(255,255,255,.3);
    letter-spacing: 0.04em;
    margin-top: 1px;
}
/* ── Wizard Cards ── */
.fsn-wizard { padding: 12px 12px 6px; }
.fsn-card {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 14px 14px 10px;
    background: rgba(255,255,255,.05);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    margin-bottom: 8px;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}
.fsn-card::after {
    content: '';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(255,255,255,.06);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.3)' stroke-width='2.5'%3E%3Cpath d='M9 18l6-6-6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
}
.fsn-card:hover {
    background: rgba(255,255,255,.08);
    border-color: rgba(255,255,255,.25);
    transform: translateX(2px);
}
.fsn-card:hover::after {
    background-color: rgba(255,255,255,.15);
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23fef9c3' stroke-width='2.5'%3E%3Cpath d='M9 18l6-6-6-6'/%3E%3C/svg%3E");
}
.fsn-card:active { transform: translateX(4px); }
.fsn-card-icon {
    color: rgba(255,255,255,.5);
    margin-bottom: 8px;
    transition: color 0.2s ease;
}
.fsn-card:hover .fsn-card-icon { color: #ffffff; }

/* ── Figure del menu di secondo livello ──
   Le icone erano tracciati grigi identici uno all'altro: a colpo d'occhio
   «Archivio» e «Drive» erano due rettangoli. Queste sono le stesse figure
   della barra a sinistra, così passando dal rail al menu si riconosce la
   stessa cosa. Non prendono il colore del testo — hanno il loro — quindi
   non seguono lo stato di hover, e restano un po' spente finché non ci
   passi sopra. */
.fsn-figura {
    display: block;
    width: 22px;
    height: 22px;
    object-fit: contain;
    flex-shrink: 0;
    opacity: .78;
    transition: opacity .18s ease, transform .18s ease;
    -webkit-user-drag: none;
    user-select: none;
}
.fsn-figura-grande { width: 40px; height: 40px; }
.fsn-header-icon .fsn-figura { width: 20px; height: 20px; opacity: .9; }
.fsn-card:hover .fsn-figura,
.fsn-item:hover .fsn-figura { opacity: 1; transform: scale(1.06); }
.fsn-card-text { display: flex; flex-direction: column; gap: 2px; margin-bottom: 6px; }
.fsn-card-title {
    font-size: 13px;
    font-weight: 700;
    color: rgba(255,255,255,.85);
    transition: color 0.2s ease;
}
.fsn-card:hover .fsn-card-title { color: #fff; }
.fsn-card-desc {
    font-size: 11px;
    font-weight: 400;
    color: rgba(255,255,255,.35);
    line-height: 1.3;
}
.fsn-card-hint {
    font-size: 9px;
    font-weight: 500;
    color: rgba(255,255,255,.2);
    letter-spacing: 0.02em;
    padding-top: 6px;
    border-top: 1px solid rgba(255,255,255,.05);
}
/* ── Sections ── */
.fsn-section {
    padding: 12px 12px 4px;
}
.fsn-section + .fsn-section {
    border-top: 1px solid rgba(255,255,255,.06);
}
.fsn-section-label {
    font-size: 9px;
    font-weight: 700;
    color: rgba(255,255,255,.3);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 6px;
    padding: 0 10px;
}
/* ── Items ── */
.fsn-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-align: left;
    color: rgba(255,255,255,.55);
    line-height: 1;
    position: relative;
    transition: all 0.15s ease;
    font-family: inherit;
    margin-bottom: 1px;
}
.fsn-item > svg {
    flex-shrink: 0;
    opacity: .45;
    transition: opacity 0.15s ease;
}
.fsn-item-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}
.fsn-item-title {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255,255,255,.7);
    transition: color 0.15s ease;
}
.fsn-item-desc {
    font-size: 10px;
    font-weight: 400;
    color: rgba(255,255,255,.25);
    transition: color 0.15s ease;
}
.fsn-item:hover {
    background: rgba(255,255,255,.07);
}
.fsn-item:hover > svg { opacity: .8; }
.fsn-item:hover .fsn-item-title { color: #fff; }
.fsn-item:hover .fsn-item-desc { color: rgba(255,255,255,.4); }
.fsn-item.active {
    background: rgba(255,255,255,.1);
}
.fsn-item.active > svg { opacity: 1; color: #ffffff; }
.fsn-item.active .fsn-item-title { color: #ffffff; font-weight: 700; }
.fsn-item.active .fsn-item-desc { color: rgba(255,255,255,.45); }
.fsn-item.active::before {
    content: '';
    position: absolute;
    left: 0; top: 50%;
    transform: translateY(-50%);
    width: 3px; height: 18px;
    background: #ffffff;
    border-radius: 0 3px 3px 0;
}
/* Badge */
.fsn-badge {
    font-size: 10px;
    font-weight: 800;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    background: #dc2626;
    color: #fff;
    flex-shrink: 0;
}
.fsn-badge:empty { display: none; }
/* ── Footer ── */
.fsn-footer {
    margin-top: auto;
    padding: 12px 16px;
    border-top: 1px solid rgba(255,255,255,.06);
    font-size: 10px;
    color: rgba(255,255,255,.2);
    display: flex;
    align-items: center;
    gap: 6px;
}
.fsn-kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 6px;
    border: 1px solid rgba(255,255,255,.15);
    border-radius: 3px;
    font-size: 9px;
    font-weight: 600;
    color: rgba(255,255,255,.35);
    font-family: 'SF Mono', 'Consolas', monospace;
}
/* ── Backdrop ── */
.fsn-backdrop {
    position: fixed;
    top: 0; left: 80px; right: 0; bottom: 0;
    /* Un gradino sotto il pannello, sopra la pagina: è la superficie che
       chiude il menu quando clicchi fuori. Se resta sotto un overlay a
       schermo intero, il clic per chiudere non arriva mai. */
    z-index: 209;
    background: transparent;
    pointer-events: none;
    transition: background 0.35s ease;
}
.fsn-backdrop.open {
    pointer-events: auto;
    background: rgba(0,0,0,.15);
}
/* ── Stagger ── */
.fsn-panel [data-fsn-idx] {
    opacity: 0;
    transform: translateX(-6px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.fsn-panel.open [data-fsn-idx="0"] { opacity:1; transform:translateX(0); transition-delay:.08s; }
.fsn-panel.open [data-fsn-idx="1"] { opacity:1; transform:translateX(0); transition-delay:.15s; }
.fsn-panel.open [data-fsn-idx="2"] { opacity:1; transform:translateX(0); transition-delay:.25s; }
.fsn-panel.open [data-fsn-idx="3"] { opacity:1; transform:translateX(0); transition-delay:.35s; }
/* ── Nav highlight ── */
#main-sidebar #nav-cortex.sub-open {
    color: rgba(255,255,255,.9);
    background: rgba(255,255,255,.08);
}
#main-sidebar #nav-cortex.sub-open::after {
    content: '';
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 4px;
    background: rgba(255,255,255,.55);
}
#main-sidebar #nav-firma.sub-open {
    color: rgba(255,255,255,.9);
    background: rgba(255,255,255,.08);
}
#main-sidebar #nav-firma.sub-open::after {
    content: '';
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 4px;
    background: rgba(255,255,255,.55);
}

/* == Helios Flyout Drawer (Neobrutalist) == */
.cx-flyout-overlay {
    position: fixed;
    inset: 0;
    z-index: 9499;
    background: transparent;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    transition: background .28s ease;
    pointer-events: none;
}

.cx-flyout-overlay.open {
    background: rgba(13, 13, 13, 0.42);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    pointer-events: auto;
}

.cx-flyout-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: min(500px, calc(100vw - 32px));
    height: 100dvh;
    z-index: 9500;
    background: var(--cream);
    box-shadow: -4px 0 0 var(--ink);
    border-left: 2px solid var(--ink);
    transform: translateX(100%);
    transition: transform .28s cubic-bezier(.32, 0, .24, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.cx-flyout-panel.open {
    transform: translateX(0);
}

.cx-flyout-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--stone);
    z-index: 10;
    pointer-events: none;
}

.cx-flyout-header {
    flex: none;
    background: var(--cream);
    border-bottom: 2px solid var(--ink);
    box-shadow: none;
    padding: 20px 24px 16px;
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.cx-flyout-header-content {
    flex: 1;
    min-width: 0;
}

.cx-flyout-tagline {
    font-size: 10px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .1em;
    margin-bottom: 5px;
}

.cx-flyout-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cx-flyout-desc {
    font-size: 12px;
    color: var(--muted);
    margin-top: 3px;
}

.cx-flyout-dismiss {
    padding: 5px;
    background: transparent;
    border: 2px solid var(--ink);
    color: var(--muted);
    border-radius: 0;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .12s, color .12s;
}

.cx-flyout-dismiss:hover {
    background: var(--yellow);
    color: var(--ink);
}

.cx-flyout-body {
    flex: 1 1 auto;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 20px 22px;
}

.cx-flyout-footer {
    flex: none;
    border-top: 2px solid var(--ink);
    box-shadow: none;
    padding: 14px 22px;
    background: var(--paper);
    display: flex;
    gap: 8px;
    align-items: center;
}

.cx-detail-card {
    background: var(--paper);
    border-radius: 0;
    border: 2px solid var(--ink);
    padding: 14px;
    margin-bottom: 14px;
}

.cx-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid var(--stone);
    font-size: 13px;
}

.cx-detail-row:last-child {
    border-bottom: none;
}

.cx-detail-label {
    color: var(--muted);
    font-size: 12px;
}

.cx-detail-value {
    color: var(--ink);
    font-weight: 600;
    font-size: 13px;
}

/* -- Drawer Form (Neobrutalist) -- */
.drawer-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.drawer-form-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.drawer-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.drawer-form-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--ink);
    display: flex;
    align-items: center;
    gap: 4px;
}

.drawer-form-optional {
    font-weight: 400;
    color: var(--muted);
    font-size: 11px;
}

.drawer-form-input,
.drawer-form-select {
    padding: 8px 11px;
    border: 2px solid var(--ink);
    border-radius: 0;
    font-size: 13px;
    color: var(--ink);
    background: var(--cream);
    outline: none;
    transition: border .15s, box-shadow .15s;
    width: 100%;
}

.drawer-form-input:focus,
.drawer-form-select:focus {
    border-color: var(--ink);
    box-shadow: 3px 3px 0 var(--ink);
}

.drawer-form-textarea {
    padding: 8px 11px;
    border: 2px solid var(--ink);
    border-radius: 0;
    font-size: 13px;
    color: var(--ink);
    background: var(--cream);
    outline: none;
    resize: vertical;
    min-height: 70px;
    line-height: 1.5;
    transition: border .15s, box-shadow .15s;
    font-family: inherit;
    width: 100%;
}

.drawer-form-textarea:focus {
    border-color: var(--ink);
    box-shadow: 3px 3px 0 var(--ink);
}

.drawer-form-hint {
    font-size: 11px;
    color: var(--muted);
}

.drawer-form-divider {
    border: none;
    border-top: 2px solid var(--stone);
    margin: 0;
}

.drawer-summary-card {
    background: var(--paper);
    border-radius: 0;
    padding: 12px 14px;
    border: 2px solid var(--ink);
}

.dsc-supplier {
    font-size: 13px;
    font-weight: 700;
    color: var(--ink);
}

.dsc-meta {
    font-size: 12px;
    color: var(--muted);
    margin-top: 2px;
}

.cx-btn {
    padding: 8px 16px;
    border-radius: 0;
    font-size: 13px;
    font-weight: 600;
    border: 2px solid var(--ink);
    cursor: pointer;
    transition: all .15s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.cx-btn-dark {
    background: var(--ink);
    color: var(--yellow);
    box-shadow: 3px 3px 0 var(--ink);
}

.cx-btn-dark:hover:not(:disabled) {
    transform: translate(-2px, -2px);
    box-shadow: 5px 5px 0 var(--ink);
}

.cx-btn-dark:disabled {
    opacity: .4;
    cursor: not-allowed;
}

.cx-btn-outline {
    background: var(--cream);
    color: var(--ink);
    border: 2px solid var(--ink);
    box-shadow: 3px 3px 0 var(--ink);
}

.cx-btn-outline:hover {
    background: var(--yellow);
    transform: translate(-2px, -2px);
    box-shadow: 5px 5px 0 var(--ink);
}

.cx-btn-danger {
    background: #fee2e2;
    color: var(--error);
    border: 2px solid var(--ink);
    box-shadow: 3px 3px 0 var(--ink);
}

.cx-btn-danger:hover {
    background: #fecaca;
    transform: translate(-2px, -2px);
    box-shadow: 5px 5px 0 var(--ink);
}

/* ===========================================
   PANEL RESIZER
   =========================================== */
.pr-handle {
    position: absolute;
    width: 8px;
    cursor: col-resize;
    background: transparent;
    z-index: 30;
}
.pr-handle::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 3px;
    height: 32px;
    background: var(--stone);
    border-radius: 0;
    transition: background .15s, height .15s;
}
.pr-handle:hover::after,
.pr-handle.pr-active::after {
    background: var(--ink);
    height: 56px;
}
.pr-handle:hover,
.pr-active {
    background: rgba(13,13,13,.03);
}
.pr-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    cursor: col-resize;
}

/* ════════════════════════════════════════════════════════════════════
   NAVBAR + SIDEBAR — mono mode (no giallo) + rounded coerente CLAUDE.md
   ════════════════════════════════════════════════════════════════════ */

/* Sidebar nav-item icon plate: rounded-lg coerente */
#main-sidebar .nav-item > i,
#main-sidebar .nav-item > .nav-icon-wrap {
    border-radius: 8px !important;
}

/* Nav-item: rounded-lg + transition consistente */
#main-sidebar .nav-item {
    border-radius: 10px !important;
    transition: background 0.12s, color 0.12s !important;
}

/* Active indicator vertical bar — rounded ai capi */
#main-sidebar .nav-item.active::before {
    border-radius: 0 3px 3px 0 !important;
}

/* Logo frame: rounded-lg (era square brutalist) */
.neo-logo-frame {
    border-radius: 10px;
}

/* Sidebar bottom buttons: rounded-lg */
.neo-sidebar-help-btn {
    border-radius: 8px;
    transition: transform 0.1s, box-shadow 0.1s;
}
.neo-sidebar-help-btn:hover {
    transform: translate(-1px, -1px);
    box-shadow: 2px 2px 0 #ffffff;
}
.neo-sidebar-avatar {
    border-radius: 10px;
}
.neo-sidebar-online-dot {
    border-radius: 50%;
}

/* User dropdown menu rounded */
.neo-user-menu {
    border-radius: 12px;
}
.neo-user-menu-item:first-child { border-radius: 10px 10px 0 0; }
.neo-user-menu-item:last-child { border-radius: 0 0 10px 10px; }
.neo-user-menu-item:hover { background: #f4f4f5; }

/* Scrollbar nav: nascosta come prima ma mono */
#main-nav::-webkit-scrollbar-thumb { background: #ffffff; border-radius: 0; }

/* ═══════════════════════════════════════════════════════════════
   NAVBAR (top header) — OpenAI / ChatGPT clean
   Header chiaro, hairline border, niente neo-brutalismo.
   Override !important batte gli inline style/classi Tailwind del markup.
   ═══════════════════════════════════════════════════════════════ */

/* Header: superficie bianca + bordo hairline */
header.sticky.top-0[style*="border-bottom"] {
    background: #ffffff !important;
    border-bottom: 1px solid #ececec !important;
}

/* Sidebar toggle: icon button ghost */
#sidebar-toggle-btn {
    color: #6b7280 !important;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    border-radius: 8px !important;
    transition: background 0.12s, color 0.12s !important;
}
#sidebar-toggle-btn:hover {
    background: #f3f4f6 !important;
    color: #111827 !important;
    transform: none !important;
    box-shadow: none !important;
}
#sidebar-toggle-btn:active {
    transform: none !important;
    box-shadow: none !important;
    background: #ececec !important;
}

/* Search bar (apre command palette): pill grigio neutro */
header button[onclick*="GlobalSearch.open"] {
    background: #f7f7f8 !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 10px !important;
    color: #9ca3af !important;
    box-shadow: none !important;
}
header button[onclick*="GlobalSearch.open"]:hover {
    background: #f0f0f2 !important;
    border-color: #d1d5db !important;
    color: #6b7280 !important;
    transform: none !important;
    box-shadow: none !important;
}
header button[onclick*="GlobalSearch.open"]:active {
    transform: none !important;
    box-shadow: none !important;
}
header button[onclick*="GlobalSearch.open"] svg { stroke: #9ca3af !important; }
/* ⌘K chip */
header button[onclick*="GlobalSearch.open"] span:last-child {
    background: #ffffff !important;
    border: 1px solid #e5e7eb !important;
    color: #9ca3af !important;
    border-radius: 6px !important;
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif !important;
    font-weight: 600 !important;
}

/* Breadcrumb: "Mastro" muted, separatore grigio, titolo scuro */
header .text-\[\#666\] { color: #9ca3af !important; }
header .text-\[\#facc15\],
header .text-\[\#ffffff\].font-black { color: #d1d5db !important; }
#header-title {
    color: #111827 !important;
    text-transform: none !important;
    letter-spacing: -0.01em !important;
    font-weight: 600 !important;
}

/* "Nuovo": primary nero pieno, flat */
#btn-quick-actions {
    background: #0d0d0d !important;
    color: #ffffff !important;
    border: 1px solid #0d0d0d !important;
    border-radius: 10px !important;
    box-shadow: none !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    font-weight: 600 !important;
}
#btn-quick-actions:hover {
    background: #2a2a2a !important;
    transform: none !important;
    box-shadow: none !important;
}
#btn-quick-actions:active { transform: none !important; box-shadow: none !important; }

/* Icon button generici nell'header (inbox, replay tour) */
header .flex.items-center.gap-2.shrink-0 > button,
#btn-replay-onboarding,
header button[onclick="router.load('inbox')"] {
    background: transparent !important;
    border: 1px solid transparent !important;
    color: #6b7280 !important;
    box-shadow: none !important;
    border-radius: 8px !important;
}
header .flex.items-center.gap-2.shrink-0 > button:hover,
#btn-replay-onboarding:hover,
header button[onclick="router.load('inbox')"]:hover {
    background: #f3f4f6 !important;
    color: #111827 !important;
    border-color: transparent !important;
    transform: none !important;
    box-shadow: none !important;
}
/* il bottone "Nuovo" è figlio del wrapper, non applicare il reset ghost */
#quick-actions-wrapper > button { background: #0d0d0d !important; }

/* Divisori verticali: hairline grigio */
header .w-\[2px\].h-5 {
    background: #e5e7eb !important;
    width: 1px !important;
}

/* Header inbox count badge */
#header-inbox-count {
    background: #0d0d0d;
    color: #ffffff;
    border-radius: 999px;
    padding: 1px 6px;
    font-weight: 700;
}

/* Sticky notes "Altri" button */
#more-sticky-btn {
    background: #ffffff !important;
    border: 1px solid #e5e7eb !important;
    color: #374151 !important;
    border-radius: 8px !important;
    box-shadow: none !important;
}
#more-sticky-btn:hover { background: #f3f4f6 !important; }
#more-sticky-btn span:last-child {
    background: #0d0d0d !important;
    color: #ffffff !important;
    border-radius: 999px !important;
}

/* Quick actions dropdown: card morbida OpenAI */
#quick-actions-dropdown {
    border: 1px solid #ececec !important;
    border-radius: 14px !important;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12) !important;
}
#quick-actions-dropdown > div:first-child {
    background: #fafafa !important;
    border-bottom: 1px solid #f0f0f0 !important;
}
#quick-actions-dropdown > div:first-child span { text-transform: none !important; letter-spacing: 0 !important; }
#quick-actions-dropdown button > div:first-child {
    border: none !important;
    box-shadow: none !important;
    border-radius: 8px !important;
}
#quick-actions-dropdown button { border-color: #f3f4f6 !important; }
#quick-actions-dropdown button:hover { background: #f7f7f8 !important; }

/* Inbox notification dot in sidebar */
#inbox-notification-dot {
    background: #ffffff !important;
    border: 2px solid #0d0d0d !important;
    border-radius: 50% !important;
}

/* Clients notification dot — era bg-emerald-400, lascio il verde
   come segnale semantico (success), niente giallo lì */

/* Nav-text uppercase tracking — leggibilità */
#main-sidebar .nav-item .nav-text {
    letter-spacing: 0.06em;
}

/* ═══════════════════════════════════════════════════════════════
   SIDEBAR — variante chiara stile OpenAI/ChatGPT
   Rail grigio chiarissimo + testo scuro; il logo Mastro bianco resta
   visibile dentro un plate scuro (come l'icona app di ChatGPT).
   Blocco consolidato in coda: batte le regole scure sparse sopra.
   ═══════════════════════════════════════════════════════════════ */

.sidebar-solid {
    background: #f9f9f8 !important;
    border-right: 1px solid #ececec !important;
    box-shadow: none !important;
}

/* Token nav: da chiaro-su-scuro → scuro-su-chiaro */
#main-sidebar {
    --nav-bone: #0d0d0d;
    --nav-bg: #f9f9f8;
    --nav-text: rgba(13, 13, 13, 0.55);
    --nav-text-hover: rgba(13, 13, 13, 0.92);
    --nav-text-active: #0d0d0d;
    --nav-bg-hover: rgba(13, 13, 13, 0.05);
    --nav-bg-active: rgba(13, 13, 13, 0.08);
    --nav-border-hover: rgba(13, 13, 13, 0.06);
    --nav-border-active: rgba(13, 13, 13, 0.12);
    --nav-icon-stroke: rgba(13, 13, 13, 0.50);
    --nav-icon-stroke-hover: rgba(13, 13, 13, 0.92);
    --nav-icon-stroke-active: #0d0d0d;
    --nav-icon-frame: rgba(13, 13, 13, 0.06);
    --nav-icon-frame-hover: rgba(13, 13, 13, 0.12);
    --nav-icon-frame-active: rgba(13, 13, 13, 0.18);
    --nav-icon-bg-default: rgba(13, 13, 13, 0.02);
    --nav-icon-bg-hover: rgba(13, 13, 13, 0.05);
    --nav-icon-bg-active: rgba(13, 13, 13, 0.08);
    --nav-indicator: #0d0d0d;
}

/* Logo: plate scuro arrotondato con glyph bianco (icona-style) */
.neo-logo-box { border-bottom: 1px solid #ececec !important; background: transparent !important; }
.neo-logo-frame {
    width: 38px !important;
    height: 38px !important;
    background: #0d0d0d !important;
    border: none !important;
    border-radius: 10px !important;
    box-shadow: none !important;
}
.neo-logo-img { width: 24px !important; height: 24px !important; filter: brightness(0) invert(1) !important; }
#main-sidebar > div:first-child > div:first-child { border-bottom: 1px solid #ececec !important; }

/* Footer / sezioni utente: bordi hairline + colori scuri */
#main-sidebar > div:last-child,
.neo-sidebar-bottom { border-top: 1px solid #ececec !important; }

.neo-sidebar-help-btn {
    border: 1px solid rgba(13, 13, 13, 0.12) !important;
    color: rgba(13, 13, 13, 0.45) !important;
    border-radius: 8px !important;
}
.neo-sidebar-help-btn:hover {
    border-color: rgba(13, 13, 13, 0.25) !important;
    color: #0d0d0d !important;
    background: rgba(13, 13, 13, 0.04) !important;
}
.neo-sidebar-avatar {
    border: 1px solid rgba(13, 13, 13, 0.15) !important;
    background: rgba(13, 13, 13, 0.06) !important;
    color: #0d0d0d !important;
    border-radius: 9px !important;
}
.neo-sidebar-online-dot { background: #10b981 !important; border: 2px solid #f9f9f8 !important; border-radius: 50% !important; }

/* Scrollbar nav: grigio invece di bianco */
#main-nav::-webkit-scrollbar-thumb { background: rgba(13, 13, 13, 0.18) !important; }

/* Dot notifica inbox: scuro per essere visibile su rail chiaro */
#inbox-notification-dot { background: #0d0d0d !important; border: 2px solid #f9f9f8 !important; }

/* ═══════════════════════════════════════════════════════════════
   SUB-SIDEBAR (.fsn-panel) — variante chiara coordinata col rail
   Flyout Documenti / Firma / Calendario: da scuro → grigio chiaro
   con testo scuro. Blocco consolidato in coda: batte le regole scure.
   ═══════════════════════════════════════════════════════════════ */
.fsn-panel {
    background: #f9f9f8 !important;
    border-right: 1px solid #ececec !important;
}
.fsn-panel.open { box-shadow: 8px 0 24px rgba(13, 13, 13, 0.10) !important; }

/* Header */
.fsn-header { border-bottom: 1px solid rgba(13, 13, 13, 0.08) !important; }
.fsn-header-icon { border-color: rgba(13, 13, 13, 0.15) !important; color: #0d0d0d !important; }
.fsn-header-title { color: #0d0d0d !important; }
.fsn-header-sub { color: rgba(13, 13, 13, 0.45) !important; }

/* Wizard cards */
.fsn-card { background: rgba(13, 13, 13, 0.03) !important; border: 1px solid rgba(13, 13, 13, 0.10) !important; }
.fsn-card::after {
    background-color: rgba(13, 13, 13, 0.05) !important;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='rgba(13,13,13,0.35)' stroke-width='2.5'%3E%3Cpath d='M9 18l6-6-6-6'/%3E%3C/svg%3E") !important;
}
.fsn-card:hover { background: rgba(13, 13, 13, 0.06) !important; border-color: rgba(13, 13, 13, 0.22) !important; }
.fsn-card:hover::after {
    background-color: rgba(13, 13, 13, 0.10) !important;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%230d0d0d' stroke-width='2.5'%3E%3Cpath d='M9 18l6-6-6-6'/%3E%3C/svg%3E") !important;
}
.fsn-card-icon { color: rgba(13, 13, 13, 0.5) !important; }
.fsn-card:hover .fsn-card-icon { color: #0d0d0d !important; }
.fsn-card-title { color: rgba(13, 13, 13, 0.85) !important; }
.fsn-card:hover .fsn-card-title { color: #0d0d0d !important; }
.fsn-card-desc { color: rgba(13, 13, 13, 0.45) !important; }
.fsn-card-hint { color: rgba(13, 13, 13, 0.35) !important; border-top: 1px solid rgba(13, 13, 13, 0.06) !important; }

/* Sezioni */
.fsn-section + .fsn-section { border-top: 1px solid rgba(13, 13, 13, 0.06) !important; }
.fsn-section-label { color: rgba(13, 13, 13, 0.4) !important; }

/* Items */
.fsn-item { color: rgba(13, 13, 13, 0.55) !important; }
.fsn-item-title { color: rgba(13, 13, 13, 0.7) !important; }
.fsn-item-desc { color: rgba(13, 13, 13, 0.4) !important; }
.fsn-item:hover { background: rgba(13, 13, 13, 0.05) !important; }
.fsn-item:hover .fsn-item-title { color: #0d0d0d !important; }
.fsn-item:hover .fsn-item-desc { color: rgba(13, 13, 13, 0.5) !important; }
.fsn-item.active { background: rgba(13, 13, 13, 0.08) !important; }
.fsn-item.active > svg { color: #0d0d0d !important; }
.fsn-item.active .fsn-item-title { color: #0d0d0d !important; }
.fsn-item.active .fsn-item-desc { color: rgba(13, 13, 13, 0.5) !important; }
.fsn-item.active::before { background: #0d0d0d !important; }

/* Footer / kbd */
.fsn-footer { border-top: 1px solid rgba(13, 13, 13, 0.06) !important; color: rgba(13, 13, 13, 0.4) !important; }
.fsn-kbd { border: 1px solid rgba(13, 13, 13, 0.15) !important; color: rgba(13, 13, 13, 0.5) !important; }

/* ═══════════════════════════════════════════════════════════════════════════
   TELEFONO — la barra in fondo (vedi js/mobile-tabbar.js)

   Il rail di sinistra è `hidden md:flex`: sotto i 768px non c'è. Qui sotto
   c'è quello che prende il suo posto — quattro destinazioni e «Altro» — e la
   misura che tutto il resto dell'app deve conoscere per non finirci sotto:

       --optlyx-tabbar   quanto spazio si è preso la barra in fondo.
                         0 su computer, altezza + tacca dell'iPhone su telefono.

   La leggono `#main-scroll-area` (per il padding) e la console IA, che è un
   overlay `position:fixed` e quindi non può ereditare un padding dal body.
   ═════════════════════════════════════════════════════════════════════════ */

body { --optlyx-tabbar: 0px; }

#optlyx-tabbar { display: none; }

@media (max-width: 767px) {
    body.has-tabbar {
        --optlyx-tabbar: calc(56px + env(safe-area-inset-bottom, 0px));
    }

    body.has-tabbar #main-scroll-area {
        padding-bottom: var(--optlyx-tabbar);
    }

    #optlyx-tabbar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        /* Sopra la console IA (z 200) e i suoi pannelli (220): da qualunque
           schermata si deve poter uscire. */
        z-index: 300;
        display: grid;
        grid-auto-flow: column;
        grid-auto-columns: 1fr;
        align-items: stretch;
        height: var(--optlyx-tabbar);
        padding-bottom: env(safe-area-inset-bottom, 0px);
        background: rgba(255, 255, 255, 0.94);
        backdrop-filter: saturate(1.6) blur(12px);
        -webkit-backdrop-filter: saturate(1.6) blur(12px);
        border-top: 1px solid rgba(13, 13, 13, 0.08);
    }

    .otb-tab {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        border: 0;
        background: transparent;
        padding: 6px 2px;
        font: inherit;
        font-size: 10.5px;
        font-weight: 600;
        letter-spacing: -0.01em;
        color: rgba(13, 13, 13, 0.5);
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }
    .otb-tab[hidden] { display: none; }
    .otb-tab .otb-fig { opacity: 0.55; transition: opacity .15s ease, transform .15s ease; }
    .otb-tab.is-active { color: #0d0d0d; }
    .otb-tab.is-active .otb-fig { opacity: 1; transform: translateY(-1px); }
    .otb-tab:active { transform: scale(.97); }

    /* ── Il foglio «Altro» ─────────────────────────────────────────────── */

    .otb-sheet { position: fixed; inset: 0; z-index: 320; }
    .otb-sheet-scrim {
        position: absolute;
        inset: 0;
        background: rgba(13, 13, 13, 0.28);
        opacity: 0;
        transition: opacity .2s ease;
    }
    .otb-sheet.is-open .otb-sheet-scrim { opacity: 1; }

    .otb-sheet-panel {
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        max-height: 82dvh;
        display: flex;
        flex-direction: column;
        background: #ffffff;
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -8px 32px -12px rgba(13, 13, 13, 0.28);
        padding-bottom: env(safe-area-inset-bottom, 0px);
        transform: translateY(101%);
        transition: transform .24s cubic-bezier(.22, 1, .36, 1);
    }
    .otb-sheet.is-open .otb-sheet-panel { transform: translateY(0); }

    .otb-sheet-grip {
        width: 36px;
        height: 4px;
        border-radius: 999px;
        background: rgba(13, 13, 13, 0.15);
        margin: 8px auto 0;
    }
    .otb-sheet-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 10px 16px 6px;
    }
    .otb-sheet-title { font-size: 15px; font-weight: 700; color: #0d0d0d; letter-spacing: -0.01em; }
    .otb-sheet-close {
        width: 36px; height: 36px;
        display: grid; place-items: center;
        border: 0; border-radius: 999px;
        background: rgba(13, 13, 13, 0.05);
        color: rgba(13, 13, 13, 0.6);
        font-size: 14px; cursor: pointer;
    }
    .otb-sheet-body { overflow-y: auto; padding: 4px 12px 16px; -webkit-overflow-scrolling: touch; }
    .otb-sheet-group {
        font-size: 10.5px; font-weight: 700; text-transform: uppercase;
        letter-spacing: .12em; color: rgba(13, 13, 13, 0.35);
        padding: 14px 4px 6px;
    }
    .otb-sheet-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
    .otb-sheet-item {
        display: flex; align-items: center; gap: 10px;
        min-height: 52px;
        padding: 8px 10px;
        border: 1px solid rgba(13, 13, 13, 0.06);
        border-radius: 14px;
        background: #ffffff;
        font: inherit; font-size: 13.5px; font-weight: 600;
        color: rgba(13, 13, 13, 0.82);
        text-align: left;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }
    .otb-sheet-item span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .otb-sheet-item.is-active { border-color: rgba(13, 13, 13, 0.22); background: rgba(13, 13, 13, 0.04); color: #0d0d0d; }
    .otb-sheet-item:active { transform: scale(.99); }
    .otb-sheet-empty { padding: 24px 8px; text-align: center; font-size: 13px; color: rgba(13, 13, 13, 0.45); }
}

@media (max-width: 767px) and (prefers-reduced-motion: reduce) {
    .otb-sheet-panel, .otb-sheet-scrim { transition: none; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   TELEFONO — il telaio, adesso che la barra in fondo c'è davvero

   Il rail di sinistra era dichiarato `hidden md:flex` nel markup, e per anni
   abbiamo creduto che sotto i 768px sparisse. Non è mai successo: qui sopra,
   riga 139, c'è `#main-sidebar { display: flex }`. Un selettore di ID batte
   una classe, quindi `.hidden` di Tailwind non ha mai avuto voce. Risultato
   sul telefono: 80px dei ~400 disponibili se li prendeva una colonna di icone,
   e il contenuto andava a capo una parola per riga.

   Da qui in giù si toglie di mezzo tutto ciò che su uno schermo stretto non
   può stare, e si tiene fuori dai piedi della barra in fondo tutto ciò che
   vive incollato al bordo inferiore.
   ═════════════════════════════════════════════════════════════════════════ */

@media (max-width: 767px) {
    /* La navigazione adesso è la barra in fondo: la colonna può andarsene
       davvero. `!important` perché il vicino di specificità è la regola di ID
       qui sopra, e questo file lo modificano in tanti. */
    #main-sidebar { display: none !important; }

    /* Apre e chiude una colonna che non c'è più. */
    #sidebar-toggle-btn { display: none !important; }

    /* I pannelli a comparsa del rail (Scadenze, Archivio, Firma) sono colonne
       scure alte quanto lo schermo, pensate per aprirsi ACCANTO al rail. Senza
       rail, sul telefono, comparivano come una striscia sul lato: uno tocca
       «Scadenze» e gli si apre una sidebar che non ha chiesto. Le due voci che
       hanno una pagina vera adesso ci vanno dritte (vedi js/mobile-tabbar.js);
       questo qui e' per quelle che restano un menu davvero — che allora si
       comporta da menu del telefono: sale dal basso, largo quanto lo schermo,
       e si ferma sopra la barra. */
    .fsn-panel {
        top: auto !important;
        bottom: var(--optlyx-tabbar, 0px) !important;
        left: 0 !important;
        width: 100% !important;
        height: auto !important;
        max-height: 72dvh !important;
        border-radius: 18px 18px 0 0;
        transform: translateY(101%) !important;
        transition: transform .24s cubic-bezier(.22, 1, .36, 1);
    }
    .fsn-panel.open { transform: translateY(0) !important; }

    /* ── La testata ────────────────────────────────────────────────────────
       Ci stavano dentro nove cose pensate per 1400px: briciole di pane,
       streak, promemoria appuntati, campo di ricerca largo, due tondi di
       aiuto e tre separatori. Su 400px si accavallavano — nello screenshot
       il «+» finiva sopra la ricerca. Restano il titolo, la ricerca (come
       tondo), «+», la posta e le notifiche. */
    #main-scroll-area > header #onboarding-streak-container,
    #main-scroll-area > header #global-sticky-notes,
    #main-scroll-area > header #btn-replay-onboarding,
    #main-scroll-area > header #btn-context-help { display: none !important; }

    /* I separatori verticali: senza le cose che separavano, separano il nulla. */
    #main-scroll-area > header div[class*="w-[2px]"] { display: none !important; }

    /* La ricerca diventa un tondo: la scritta «Cerca...» e la scorciatoia ⌘K
       sono due promesse da tastiera. */
    #main-scroll-area > header .max-w-\[480px\] {
        flex: 0 0 auto;
        margin-left: 8px;
        margin-right: 8px;
        max-width: none;
    }
    #main-scroll-area > header .max-w-\[480px\] button {
        width: 40px;
        padding-left: 0;
        padding-right: 0;
        justify-content: center;
    }
    #main-scroll-area > header .max-w-\[480px\] button span { display: none !important; }

    /* ── Chi vive incollato al fondo ───────────────────────────────────────
       Sotto la barra in fondo non deve finire niente: né la pastiglia del
       briefing (che nello screenshot copriva «Scadenze» e «IA»), né gli
       avvisi che compaiono e spariscono. */
    body.has-tabbar #bv-pill,
    body.has-tabbar #push-soft-prompt,
    body.has-tabbar #vli-toast,
    body.has-tabbar #prisma-optimistic-toast,
    body.has-tabbar .av3-toast {
        bottom: calc(18px + var(--optlyx-tabbar, 0px)) !important;
    }
}
