
    .brand-modal { position: fixed; inset: 0; background: rgba(15,23,42,.55); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 1rem; }
    .brand-modal[hidden] { display: none; }
    .brand-panel { background: #fff; border-radius: 20px; width: min(560px, 94vw); max-height: 92vh; overflow-y: auto; box-shadow: 0 30px 70px rgba(0,0,0,.35); animation: brandPop .18s ease-out; }
    @keyframes brandPop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
    .brand-head { padding: 1.3rem 1.5rem .9rem; border-bottom: 1px solid #eef1f4; }
    .brand-head h3 { margin: 0; color: var(--navy); font-size: 1.05rem; letter-spacing: -.01em; }
    .brand-head p { margin: .2rem 0 0; font-size: .8rem; color: #8b9aab; }
    .brand-body { padding: 1.1rem 1.5rem 1.4rem; display: flex; flex-direction: column; gap: 1.1rem; }
    .brand-preview { border-radius: 14px; overflow: hidden; border: 1px solid #eef1f4; box-shadow: 0 4px 16px rgba(37,50,71,.06); }
    .brand-preview .pv-top { display: flex; align-items: center; gap: .65rem; padding: .7rem 1rem; color: #fff; transition: background .2s ease; }
    .brand-preview .pv-top .pv-logo { height: 26px; width: auto; border-radius: 6px; }
    .brand-preview .pv-top .pv-logo.ph { height: 26px; width: 26px; border-radius: 7px; background: rgba(255,255,255,.18); display: inline-block; }
    .brand-preview .pv-top .pv-name { font-weight: 700; font-size: .88rem; letter-spacing: -.01em; }
    .brand-preview .pv-top .pv-btn { margin-left: auto; padding: .38rem .8rem; border-radius: 999px; font-size: .75rem; font-weight: 700; color: #fff; transition: background .2s ease; }
    .brand-preview .pv-welcome { padding: .8rem 1rem; font-size: .8rem; color: #4b5563; line-height: 1.5; }
    .brand-sec h4 { margin: 0 0 .55rem; font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #aeb8be; }
    .brand-language-switch { display: flex; gap: .25rem; margin-bottom: .8rem; }
    .brand-language-option { border: 1px solid #b8c2ca; border-radius: 999px; background: #fff; color: #52606d; padding: .35rem .75rem; cursor: pointer; }
    .brand-language-option[aria-pressed="true"] { background: #253247; border-color: #253247; color: #fff; }
    .brand-panel .fld { display: flex; flex-direction: column; gap: .3rem; }
    .brand-panel .fld label { font-size: .78rem; color: #60676b; font-weight: 600; }
    .brand-panel input[type=text], .brand-panel textarea { border: 1px solid #d7dfe8; border-radius: 12px; padding: .6rem .75rem; font-size: .9rem; font-family: inherit; width: 100%; outline: none; transition: border-color .15s ease, box-shadow .15s ease; }
    .brand-panel input[type=text]:focus, .brand-panel textarea:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(37,50,71,.1); }
    .brand-panel textarea { resize: vertical; min-height: 64px; }
    .brand-panel .logo-row { display: flex; align-items: center; gap: .7rem; }
    .brand-panel .logo-row .logo-box { width: 52px; height: 52px; border-radius: 12px; border: 1px dashed #c7d2e0; display: flex; align-items: center; justify-content: center; overflow: hidden; background: #f8fafc; }
    .brand-panel .logo-row .logo-box img { max-width: 100%; max-height: 100%; object-fit: contain; }
    .brand-panel .logo-row .logo-box.ph { color: #aeb8be; font-size: .7rem; }
    .brand-panel button.lnk { border: 0; background: transparent; color: #156d85; font-weight: 600; font-size: .8rem; cursor: pointer; padding: .2rem .1rem; }
    .brand-panel button.lnk.danger { color: #b03a3a; }
    .brand-panel button.lnk:hover { text-decoration: underline; }
    .swatches { display: flex; flex-wrap: wrap; gap: .45rem; }
    .swatches button { width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
    .swatches button.on { border-color: var(--navy); transform: scale(1.12); }
    .color-fld { display: flex; align-items: center; gap: .6rem; margin-top: .45rem; }
    .brand-panel input[type=color] { width: 40px; height: 32px; border: 1px solid #d7dfe8; border-radius: 8px; padding: 2px; cursor: pointer; background: #fff; }
    .color-fld .hex { font-size: .78rem; color: #8b9aab; font-family: ui-monospace, monospace; }
    .brand-actions { display: flex; gap: .5rem; justify-content: flex-end; padding-top: .3rem; border-top: 1px solid #eef1f4; }
    .brand-panel button.act { border-radius: 999px; padding: .6rem 1.2rem; font-weight: 700; cursor: pointer; font-size: .88rem; border: 1px solid #c7d2e0; background: #fff; color: var(--navy); }
    .brand-panel button.act.primary { background: var(--navy); color: #fff; border: 0; }
    .brand-panel button.act.primary:hover { filter: brightness(1.08); }
    .brand-hint { font-size: .75rem; color: #aeb8be; }

    /* --- menu kebab (tre punti) --- */
    .topbar .menu-toggle, .topbar .sidebar-toggle { background: #fff; border: 1px solid rgba(37,50,71,.16); color: var(--navy); }
    .menu-toggle { cursor: pointer; padding: .4rem; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; }
    .menu-avatar { width: 44px; height: 44px; padding: 0; background: #0e7490 !important; border: 2px solid rgba(14,116,144,.28) !important; color: #fff !important; box-shadow: 0 0 0 3px rgba(14,116,144,.12); font-weight: 700; letter-spacing: .02em; }
    .menu-avatar:hover, .menu-avatar:focus-visible { background: #156d85 !important; box-shadow: 0 0 0 4px rgba(14,116,144,.18); }
    .menu-toggle:hover, .sidebar-toggle:hover { background: #eef1f4; }
    .menu-toggle svg { display: block; }
    .menu-dropdown {
      position: absolute; top: calc(100% + 8px); right: 0;
      background: #fff !important;
      color: var(--navy) !important;
      border: 1px solid #e1e6eb;
      border-radius: 24px;
      box-shadow: 0 14px 36px rgba(37,50,71,.16);
      min-width: 318px;
      padding: 1.75rem 1.25rem;
      z-index: 60;
      overflow: hidden;
      backdrop-filter: blur(8px);
    }
    .menu-user { padding: 0 .875rem 1rem; border-bottom: 1px solid #e0e9ec; }
    .menu-user strong, .menu-user span { display: block; }
    .menu-user strong { color: var(--navy); font-size: .98rem; }
    .menu-user span { color: var(--muted); font-size: .75rem; margin-top: .2rem; }
    .menu-section { padding: .75rem 0 0; }
    /* :not([hidden]) evita che una sezione nascosta (es. admin per i viewer) azzeri il padding della successiva */
    .menu-section:not([hidden]) + .menu-section { padding-top: 0; }
    .menu-divider { height: 1px; background: #e0e9ec; margin: .75rem 0; }
    .menu-item {
      display: flex; align-items: center; justify-content: space-between; gap: 1.25rem; width: 100%; text-align: left;
      padding: .375rem .875rem; font-size: .95rem;
      color: var(--navy) !important;
      background: none; border: 0; cursor: pointer; text-decoration: none; font-weight: 500;
    }
    .topbar .menu-item { border: 0; border-radius: 12px; }
    .menu-item svg { order: 2; width: 20px; height: 20px; margin-left: auto; flex: 0 0 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
    .menu-item:hover { background: rgba(30,133,161,.15) !important; }
    .menu-item.danger { color: var(--navy) !important; font-weight: 600; }
    .menu-item.danger:hover { background: rgba(30,133,161,.15) !important; }

    .powered-by {
      text-align: center;
      font-size: .72rem;
      color: var(--muted);
      margin-top: .45rem;
      font-weight: 500;
      letter-spacing: -.01em;
      opacity: .85;
    }
    .powered-by a {
      color: var(--navy);
      text-decoration: none;
      font-weight: 600;
    }
    .powered-by a:hover {
      text-decoration: underline;
    }

    #welcome { display: flex; flex-direction: column; align-items: flex-start; }
    #welcome h2 { margin-top: .2rem; }

    /* --- PDF export: @media print --- */
    @media print {
      .topbar, .sidebar, .sidebar-overlay, .composer-wrap, .status,
      .welcome .chips, .brand-modal, .results-toggle,
      #brandBtn, #pdfExportBtn, #logoutBtn, #adminLink, #apiLink, #orgUsersLink,
      .hide-sm, nav { display: none !important; }
      body { background: #fff !important; }
      .panel { box-shadow: none !important; border: 0 !important; max-width: 100% !important; margin: 0 !important; }
      .messages { max-height: none !important; overflow: visible !important; }
      .bubble { border: 1px solid #ccc !important; box-shadow: none !important; break-inside: avoid; }
      .results-panel { position: static !important; width: 100% !important; max-height: none !important; overflow: visible !important; border: 0 !important; }
      .results-panel.collapsed .results-body { display: block !important; }
      .person-card { break-inside: avoid; }
    }
