/* Barra in alto UNICA di HR, CRM, Mail e Ads (Lorenzo 31/10/2026: «una grafica unica in tutti gli header").
   Un solo file per tutte e quattro: crm.jbgrlglobal.com/shared/jbgrl-bar.css (nginx -> /opt/jbgrl/shared).
   Il modello e' la barra del CRM. Misure in px fisse: non dipendono dalla scala caratteri delle singole app.
   Colori dalla palette della persona (variabili --a1 --a2 --a3 messe da tema.ts / jbgrl-bar.js); se mancano, viola.
   Struttura (uguale in React e nel PHP della webmail):
     header.jb-bar
       a.jb-brand > span.jb-logo(svg) + span.jb-title
       nav.jb-nav > .jb-tab[.on] (pagine dell'app) | in CRM i loghi degli account
       div.jb-right > [extra dell'app] + div.jb-switch > .jb-sw[.on] x4 + div.jb-me > button.jb-user + div.jb-menu ; button.jb-power
     nav.jb-subnav (solo telefono: le pagine su una riga sotto la barra) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

.jb-bar, .jb-subnav, .jb-menu {
  --jb1: var(--a1, 139 92 246); --jb2: var(--a2, 99 102 241); --jb3: var(--a3, 59 130 246);
  /* tutto cio' che si eredita dalla pagina si riscrive qui: la barra e' identica in ogni app (Roundcube, Tailwind 3 e 4) */
  font-style: normal; font-weight: 400; letter-spacing: normal; word-spacing: normal; text-transform: none; text-indent: 0;
  text-align: left; text-rendering: auto; font-kerning: auto; font-feature-settings: normal; font-variation-settings: normal;
  font-optical-sizing: auto; font-synthesis: weight style; font-stretch: normal; -moz-osx-font-smoothing: grayscale;
  font-family: 'AppleEmoji', 'Inter', system-ui, 'Apple Color Emoji', 'Segoe UI Emoji', sans-serif;
  -webkit-font-smoothing: antialiased;
  box-sizing: border-box;
}
/* azzeramenti nel livello 'base' e a specificita' minima: non tolgono mai gli stili delle app dentro la barra
   (loghi account del CRM, bottoni di Ads con Tailwind 4 a livelli) */
@layer base {
:where(.jb-bar, .jb-subnav, .jb-menu) * { box-sizing: border-box; }
:where(.jb-bar, .jb-subnav, .jb-menu) button { font: inherit; margin: 0; cursor: pointer; background: none; border: 0; color: inherit; }
:where(.jb-bar, .jb-subnav, .jb-menu) a { text-decoration: none; color: inherit; }
:where(.jb-bar, .jb-subnav, .jb-menu) svg { flex-shrink: 0; display: block; }
}

/* bordi e colore uguali in ogni app anche dove non si vedono (Tailwind 3, Tailwind 4 e Roundcube li mettono diversi) */
.jb-bar, .jb-brand, .jb-logo, .jb-title, .jb-nav, .jb-right, .jb-switch, .jb-sw, .jb-user, .jb-uname, .jb-ibtn, .jb-power, .jb-tab, .jb-badge,
.jb-menu, .jb-menu-head, .jb-item, .jb-note, .jb-subnav, .jb-me, .jb-tab > span { border: 0 solid rgb(229, 231, 235); }
:where(.jb-bar, .jb-subnav, .jb-menu) svg { border: 0 solid rgb(229, 231, 235); }
.jb-brand { color: inherit; text-decoration: none; }
/* i bottoni prendono il carattere della barra anche dove la pagina lo impone ai button (Roundcube: Roboto) */
.jb-sw, .jb-user, .jb-item, .jb-power, .jb-ibtn, .jb-list button { font-family: inherit; font-style: inherit; font-weight: inherit; letter-spacing: inherit; word-spacing: inherit; text-transform: none; }
.jb-brand:hover, .jb-brand:focus { color: inherit; text-decoration: none; }

/* la barra: trasparente sopra lo sfondo della pagina (niente fascia staccata) */
.jb-bar {
  position: relative; z-index: 40;
  height: 64px; flex-shrink: 0; width: 100%;
  display: flex; align-items: center; gap: 12px; padding: 0 12px;
  font-size: 16px; line-height: 24px; font-weight: 400; color: rgba(255,255,255,.92);
  background: transparent;
}

/* logo + nome app */
.jb-brand { display: none; align-items: center; gap: 10px; padding-right: 8px; flex-shrink: 0; }
.jb-logo {
  width: 36px; height: 36px; border-radius: 12px; display: flex; align-items: center; justify-content: center; color: #fff;
  background: linear-gradient(135deg, rgb(var(--jb1)) 0%, rgb(var(--jb2)) 50%, rgb(var(--jb3)) 100%);
  box-shadow: 0 4px 20px rgb(var(--jb2) / .45);
}
.jb-title { display: none; font-size: 16px; line-height: 24px; font-weight: 600; color: rgba(255,255,255,.9); white-space: nowrap; }

/* centro: pagine dell'app a pillole (CRM: i loghi degli account) */
.jb-nav {
  flex: 1 1 0%; min-width: 0; display: flex; align-items: center; gap: 6px; overflow-x: auto; padding: 6px 8px;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 14px, #000 calc(100% - 14px), transparent);
  mask-image: linear-gradient(to right, transparent, #000 14px, #000 calc(100% - 14px), transparent);
}
.jb-nav::-webkit-scrollbar, .jb-subnav::-webkit-scrollbar { display: none; }
.jb-nav.jb-wide { visibility: hidden; } /* da telefono le pagine vanno nella riga sotto (.jb-subnav); lo spazio resta */
.jb-tab {
  position: relative; flex-shrink: 0; display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px 0 10px;
  border-radius: 12px; border: 1px solid rgba(255,255,255,.06); background: rgba(255,255,255,.03);
  font-size: 13px; line-height: 20px; color: rgba(255,255,255,.7); white-space: nowrap; cursor: pointer;
  transition: background .2s, border-color .2s, color .2s, box-shadow .2s;
}
.jb-tab:hover { background: rgba(255,255,255,.07); color: #fff; }
.jb-tab.on { background: rgba(255,255,255,.10); border-color: rgba(255,255,255,.20); color: #fff;
  box-shadow: 0 0 0 1px rgb(var(--jb1) / .35), 0 4px 20px rgb(var(--jb2) / .25); }
.jb-tab.on > svg:first-child { color: rgb(var(--jb3)); }
.jb-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 9999px; font-size: 10.5px; line-height: 20px; font-weight: 600;
  text-align: center; font-variant-numeric: tabular-nums; background: rgba(255,255,255,.10); color: rgba(255,255,255,.7); }
.jb-tab.on .jb-badge { background: rgba(255,255,255,.20); color: #fff; }
.jb-badge.alert { background: #ef4444; color: #fff; }

/* riga delle pagine sotto la barra, solo telefono */
.jb-subnav { display: flex; align-items: center; gap: 6px; overflow-x: auto; padding: 0 12px 8px; scrollbar-width: none; position: relative; z-index: 39; }
.jb-subnav .jb-tab { height: 32px; padding: 0 10px; gap: 6px; }

/* destra: extra dell'app, switch delle app, nome, esci */
.jb-right { display: flex; align-items: center; gap: 8px; padding-left: 8px; flex-shrink: 0; }
.jb-switch { display: none; gap: 4px; padding: 4px; border-radius: 12px; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.10); }
.jb-menu .jb-switch { display: flex; margin: 0 4px 4px; }
.jb-menu .jb-switch .jb-sw { flex: 1 1 0%; padding: 4px 6px; }
.jb-sw {
  display: flex; align-items: center; justify-content: center; gap: 6px; padding: 4px 12px; border-radius: 12px;
  font-size: 13px; line-height: 20px; color: rgba(255,255,255,.6); white-space: nowrap; transition: background .2s, color .2s;
}
.jb-sw:hover { color: #fff; background: rgba(255,255,255,.05); }
.jb-sw.on { color: #fff; cursor: default;
  background: linear-gradient(135deg, rgb(var(--jb1)) 0%, rgb(var(--jb2)) 50%, rgb(var(--jb3)) 100%);
  box-shadow: 0 2px 12px rgb(var(--jb2) / .4); }
.jb-sw.off, .jb-sw:disabled { opacity: .5; cursor: not-allowed; }
.jb-sw.off:hover, .jb-sw:disabled:hover { color: rgba(255,255,255,.6); background: none; }
.jb-sw.busy { animation: jb-pulse 1.2s ease-in-out infinite; color: #fff; }
@keyframes jb-pulse { 50% { opacity: .5; } }

.jb-me { position: relative; }
.jb-user {
  display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: 12px;
  border: 1px solid rgba(255,255,255,.10) !important; background: rgba(255,255,255,.04) !important;
  font-size: 13px; line-height: 20px; color: rgba(255,255,255,.7) !important; transition: all .2s;
}
.jb-user:hover, .jb-user.open { color: #fff !important; background: rgba(255,255,255,.10) !important; border-color: rgba(255,255,255,.20) !important; }
.jb-user .jb-uname { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jb-dot { width: 8px; height: 8px; border-radius: 9999px; background: rgb(var(--jb3)); }

.jb-menu {
  position: absolute; right: 0; top: 44px; z-index: 1000; width: 240px; padding: 4px; border-radius: 12px;
  background: rgba(22,21,31,.95); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,.10); box-shadow: 0 10px 40px rgba(0,0,0,.5);
  font-size: 13px; line-height: 20px; color: rgba(255,255,255,.92); text-align: left;
  animation: jb-in .18s ease-out;
}
@keyframes jb-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.jb-menu-head { padding: 8px 12px; font-size: 11.5px; line-height: 17px; color: rgba(255,255,255,.4); overflow-wrap: anywhere; }
.jb-menu-head::first-letter { text-transform: uppercase; }
.jb-item {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px; text-align: left;
  font-size: 13px; line-height: 20px; color: rgba(255,255,255,.8) !important; transition: background .2s, color .2s;
}
.jb-item:hover { background: rgba(255,255,255,.10); color: #fff !important; }
.jb-item:disabled, .jb-item.off { opacity: .5; cursor: not-allowed; }
.jb-item:disabled:hover, .jb-item.off:hover { background: none; color: rgba(255,255,255,.8) !important; }
.jb-item .jb-after { margin-left: auto; }
.jb-note { padding: 0 12px 8px 37px; font-size: 11.5px; line-height: 16px; color: rgba(255,255,255,.4); }
.jb-list { margin: 0 4px 4px; padding: 4px; border-radius: 12px; border: 1px solid rgba(255,255,255,.10); background: rgba(255,255,255,.03); max-height: 50vh; overflow-y: auto; }
.jb-list button { width: 100%; text-align: left; padding: 6px 12px; border-radius: 12px; font-size: 13px; line-height: 20px; color: rgba(255,255,255,.92); }
.jb-list button:hover { background: rgba(255,255,255,.05); }
.jb-list p { margin: 0; padding: 8px 12px; font-size: 11.5px; color: rgba(255,255,255,.4); }
.jb-sep { height: 1px; margin: 4px 8px; background: rgba(255,255,255,.08); }

.jb-power {
  display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; flex-shrink: 0; border-radius: 12px;
  border: 1px solid rgba(248,113,113,.3) !important; background: rgba(239,68,68,.08) !important; color: rgba(252,165,165,.8) !important;
  transition: all .2s;
}
.jb-power:hover { border-color: rgba(248,113,113,.6) !important; background: rgba(239,68,68,.15) !important; color: rgb(252,165,165) !important; box-shadow: 0 0 14px rgba(248,113,113,.35); }
.jb-power svg { transition: transform .2s; }
.jb-power:hover svg { transform: scale(1.1); }

/* Impostazioni: bottone a icona, stesso punto in tutte e quattro le app */
.jb-ibtn { display: inline-flex; flex-shrink: 0; cursor: pointer; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 12px;
  border: 1px solid rgba(255,255,255,.10); background: rgba(255,255,255,.04); color: rgba(255,255,255,.7); transition: all .2s; }
.jb-ibtn:hover { color: #fff; background: rgba(255,255,255,.10); }
.jb-ibtn.on { color: #fff; background: rgba(255,255,255,.10); border-color: rgba(255,255,255,.20); }

/* fascia "Stai usando l'app come ..." sotto la barra (anteprima dipendente) */
.jb-imp { margin: 0 12px 12px; display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-radius: 12px;
  border: 1px solid rgba(251,191,36,.3); background: rgba(251,191,36,.10); font-size: 14px; line-height: 20px; color: rgb(253,230,138); }
.jb-imp p { margin: 0; flex: 1; }
.jb-imp svg { color: rgb(252,211,77); }
.jb-imp button { font-weight: 500; padding: 6px 12px; border-radius: 12px; background: rgba(255,255,255,.10); color: #fff; }

/* da 640 px: logo, switch; da 1024 px: nome dell'app (come il CRM) */
@media (min-width: 640px) {
  .jb-brand { display: flex; }
  .jb-bar .jb-right > .jb-switch { display: flex; }
  .jb-menu .jb-switch, .jb-menu .jb-phone { display: none; }
  .jb-nav.jb-wide { visibility: visible; }
  .jb-subnav { display: none; }
}
@media (min-width: 1024px) { .jb-title { display: inline; } }
