/* Figtree in locale (OFL), nessuna richiesta a servizi esterni */
@font-face { font-family: 'Figtree'; font-style: normal; font-weight: 400; font-display: swap; src: url('assets/fonts/figtree_regular.ttf') format('truetype'); }
@font-face { font-family: 'Figtree'; font-style: normal; font-weight: 500; font-display: swap; src: url('assets/fonts/figtree_medium.ttf') format('truetype'); }
@font-face { font-family: 'Figtree'; font-style: normal; font-weight: 600; font-display: swap; src: url('assets/fonts/figtree_semibold.ttf') format('truetype'); }
@font-face { font-family: 'Figtree'; font-style: normal; font-weight: 700; font-display: swap; src: url('assets/fonts/figtree_bold.ttf') format('truetype'); }

/* ==========================================================================
   UGO — design "Compagno" 3.0
   Fedele ai mockup: telefono 390 x 844 e computer 1440 x 900.
   Tre temi: chiaro (predefinito), scuro, contrasto elevato.
   styles.css non viene più caricato da index.html: qui c'è tutto.
   ========================================================================== */

/* ---------- Colori dei tre temi (mockup «Temi») ---------- */
:root,
body.theme-light {
  --c-page: #F3F1EE;
  --c-top: #2C3E50;
  --c-on-top: #FFFFFF;
  --c-on-top-2: #C9D3DC;
  --c-top-btn: rgba(255, 255, 255, 0.08);
  --c-top-btn-strong: rgba(255, 255, 255, 0.10);
  --c-top-btn-border: transparent;
  --c-top-active: rgba(255, 255, 255, 0.14);
  --c-sheet: #FBFAF8;
  --c-surface: #FFFFFF;
  --c-border: #E7E3DD;
  --c-divider: #F0EDE8;
  --c-bw: 1px;
  --c-text: #1F1D1A;
  --c-text-2: #5A5651;
  --c-text-3: #3D3A36;
  --c-chip: #ECE9E4;
  --c-chip-border: #D9D4CC;
  --c-primary: #2C3E50;
  --c-on-primary: #FFFFFF;
  --c-primary-soft: #DDE3E9;
  --c-user: #2C3E50;
  --c-on-user: #FFFFFF;
  --c-focus: #2C3E50;
  --c-link: #2C3E50;
  --c-danger: #B42318;
  --c-danger-bg: #FEF3F2;
  --c-ok: #1F7A4D;
  --c-warn-bg: #FDF0E6;
  --c-warn-border: #F3C9AE;
  --c-warn-text: #7C2D12;
  --c-accent: #F3A57E;
  --c-duo1: #0E7490;
  --c-duo1-bg: #ECFEFF;
  --c-duo1-border: #A5F3FC;
  --c-duo1-text: #083344;
  --c-duo1-sub: #155E75;
  --c-duo2: #6D28D9;
  --c-duo2-bg: #F5F3FF;
  --c-duo2-border: #DDD6FE;
  --c-duo2-text: #2E1065;
  --c-duo2-sub: #5B21B6;
  --c-tag-work-bg: #E3E8ED; --c-tag-work: #2C3E50;
  --c-tag-idea-bg: #F6E3D8; --c-tag-idea: #9A3412;
  --c-tag-gen-bg: #ECE9E4;  --c-tag-gen: #3D3A36;
  --c-tag-pers-bg: #E2EFE6; --c-tag-pers: #1D5A35;
  --c-live: #141B22;
  --c-scrim: rgba(16, 22, 28, 0.55);
  --c-shadow: 0 10px 30px rgba(31, 29, 26, 0.12);
  --c-shadow-fab: 0 6px 18px rgba(44, 62, 80, 0.25);

  --font-ugo: 'Figtree', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: ui-monospace, 'SFMono-Regular', Menlo, monospace;
  color-scheme: light;
}

body.theme-dark {
  --c-page: #10161C;
  --c-top: #10161C;
  --c-on-top: #ECEAE6;
  --c-on-top-2: #A8B0B8;
  --c-top-btn: rgba(255, 255, 255, 0.08);
  --c-top-btn-strong: rgba(255, 255, 255, 0.10);
  --c-top-btn-border: transparent;
  --c-top-active: rgba(255, 255, 255, 0.12);
  --c-sheet: #1B2229;
  --c-surface: #232B33;
  --c-border: #323C46;
  --c-divider: #2A333C;
  --c-text: #ECEAE6;
  --c-text-2: #A8B0B8;
  --c-text-3: #C9CFD5;
  --c-chip: #2A333C;
  --c-chip-border: #3A4550;
  --c-primary: #DDE3E9;
  --c-on-primary: #10161C;
  --c-primary-soft: #34495E;
  --c-user: #34495E;
  --c-on-user: #FFFFFF;
  --c-focus: #F3A57E;
  --c-link: #DDE3E9;
  --c-danger: #FDA29B;
  --c-danger-bg: #3A1D1B;
  --c-ok: #75E0A7;
  --c-warn-bg: #3A2416;
  --c-warn-border: #6B3A1E;
  --c-warn-text: #FCD9BD;
  --c-duo1: #0E7490;
  --c-duo1-bg: #0F2C33;
  --c-duo1-border: #155E75;
  --c-duo1-text: #CFFAFE;
  --c-duo1-sub: #A5F3FC;
  --c-duo2: #6D28D9;
  --c-duo2-bg: #241A3A;
  --c-duo2-border: #4C1D95;
  --c-duo2-text: #EDE9FE;
  --c-duo2-sub: #DDD6FE;
  --c-tag-work-bg: #2B3A49; --c-tag-work: #DDE3E9;
  --c-tag-idea-bg: #45291C; --c-tag-idea: #FCD9BD;
  --c-tag-gen-bg: #2A333C;  --c-tag-gen: #ECEAE6;
  --c-tag-pers-bg: #1D3527; --c-tag-pers: #BBF0CF;
  --c-scrim: rgba(0, 0, 0, 0.62);
  --c-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  --c-shadow-fab: 0 6px 18px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}

body.theme-contrast {
  --c-page: #FFFFFF;
  --c-top: #F06522;
  --c-on-top: #000000;
  --c-on-top-2: #000000;
  --c-top-btn: #FFFFFF;
  --c-top-btn-strong: #FFFFFF;
  --c-top-btn-border: #000000;
  --c-top-active: #FFFFFF;
  --c-sheet: #FFFFFF;
  --c-surface: #FFFFFF;
  --c-border: #000000;
  --c-divider: #000000;
  --c-bw: 2px;
  --c-text: #000000;
  --c-text-2: #000000;
  --c-text-3: #000000;
  --c-chip: #FFFFFF;
  --c-chip-border: #000000;
  --c-primary: #000000;
  --c-on-primary: #FFFFFF;
  --c-primary-soft: #FFFFFF;
  --c-user: #000000;
  --c-on-user: #FFFFFF;
  --c-focus: #000000;
  --c-link: #000000;
  --c-danger: #000000;
  --c-danger-bg: #FFFFFF;
  --c-ok: #000000;
  --c-warn-bg: #FFFFFF;
  --c-warn-border: #000000;
  --c-warn-text: #000000;
  --c-accent: #000000;
  --c-duo1: #000000;
  --c-duo1-bg: #FFFFFF;
  --c-duo1-border: #000000;
  --c-duo1-text: #000000;
  --c-duo1-sub: #000000;
  --c-duo2: #000000;
  --c-duo2-bg: #FFFFFF;
  --c-duo2-border: #000000;
  --c-duo2-text: #000000;
  --c-duo2-sub: #000000;
  --c-tag-work-bg: #FFFFFF; --c-tag-work: #000000;
  --c-tag-idea-bg: #FFFFFF; --c-tag-idea: #000000;
  --c-tag-gen-bg: #FFFFFF;  --c-tag-gen: #000000;
  --c-tag-pers-bg: #FFFFFF; --c-tag-pers: #000000;
  --c-scrim: rgba(0, 0, 0, 0.72);
  --c-shadow: none;
  --c-shadow-fab: none;
  color-scheme: light;
}
body.theme-contrast a { text-decoration: underline; }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font-ugo);
  font-size: 16px;
  line-height: 1.2;
  color: var(--c-text);
  background: var(--c-page);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: 0.6; }
a { color: var(--c-link); }
h1, h2, h3, h4, p { margin: 0; }
img { max-width: 100%; }
.hidden { display: none !important; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 300;
  padding: 10px 16px; border-radius: 999px; background: var(--c-primary); color: var(--c-on-primary);
  font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 12px; }
:focus { outline: none; }
:focus-visible { outline: 3px solid var(--c-focus); outline-offset: 2px; }
.ugo-panel :focus-visible, .rail :focus-visible, .profile-card:focus-visible, .router-card :focus-visible { outline-color: var(--c-on-top); }
body.theme-light .ugo-panel :focus-visible, body.theme-light .rail :focus-visible { outline-color: #F3A57E; }
.ic {
  width: 20px; height: 20px; flex: 0 0 auto;
  fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.ic-ugo { stroke: none; fill: currentColor; }
ugo-mascot { color: currentColor; }
.desktop-only { display: none; }
.mobile-only { display: inline; }
@media (min-width: 769px) {
  .desktop-only { display: inline; }
  .mobile-only { display: none; }
}

/* ---------- Pulsanti e campi ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 999px;
  border: var(--c-bw) solid transparent; background: var(--c-chip); color: var(--c-text);
  font-size: 15px; font-weight: 600; text-decoration: none; white-space: nowrap;
}
.btn .ic { width: 18px; height: 18px; }
.btn-primary { background: var(--c-primary); color: var(--c-on-primary); border-color: var(--c-primary); }
.btn-secondary { background: var(--c-surface); border-color: var(--c-chip-border); color: var(--c-text); }
.btn-light { background: #FFFFFF; color: #1F1D1A; border-color: #FFFFFF; }
.btn-danger-outline { background: var(--c-surface); color: var(--c-danger); border-color: currentColor; }
.btn-block { width: 100%; }
.btn-tall { min-height: 52px; font-size: 16px; }
.btn-sm { min-height: 40px; padding: 0 14px; font-size: 14px; }
.btn-lg { min-height: 52px; padding: 0 24px; font-size: 16px; }
.btn-pill { min-height: 40px; }
.btn:hover:not(:disabled) { filter: brightness(0.97); }
body.theme-dark .btn:hover:not(:disabled) { filter: brightness(1.08); }

.sq-btn {
  flex: 0 0 44px; width: 44px; height: 44px; border-radius: 14px;
  border: var(--c-bw) solid var(--c-chip); background: var(--c-chip); color: var(--c-text);
  display: inline-flex; align-items: center; justify-content: center; padding: 0;
}
body.theme-contrast .sq-btn { border-color: #000; }
.sq-btn-primary { background: var(--c-primary); border-color: var(--c-primary); color: var(--c-on-primary); }
.sq-btn.is-on, .sq-btn[aria-pressed="true"] { background: var(--c-primary); border-color: var(--c-primary); color: var(--c-on-primary); }
.round-btn {
  width: 40px; height: 40px; border-radius: 50%; border: var(--c-bw) solid var(--c-chip);
  background: var(--c-chip); color: var(--c-text); display: inline-flex; align-items: center; justify-content: center; padding: 0;
}
body.theme-contrast .round-btn { border-color: #000; }
.pill-btn, .policy-pill {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border-radius: 999px;
  border: var(--c-bw) solid var(--c-chip); background: var(--c-chip); color: var(--c-text);
  font-size: 14px; font-weight: 500; white-space: nowrap;
}
body.theme-contrast .pill-btn, body.theme-contrast .policy-pill { border-color: #000; }
.policy-pill .ic { width: 16px; height: 16px; }
.pill-btn .ic { width: 17px; height: 17px; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 14px; border: 0; background: transparent; color: var(--c-text-2);
  display: inline-flex; align-items: center; justify-content: center; padding: 0;
}
.icon-btn:hover { background: var(--c-chip); color: var(--c-text); }
.icon-btn-sm { width: 36px; height: 36px; }
.link-btn {
  border: 0; background: none; padding: 6px 2px; min-height: 44px; color: var(--c-link);
  font-size: 14px; font-weight: 500; text-decoration: underline; text-underline-offset: 3px;
  display: inline-flex; align-items: center; gap: 6px;
}
.link-btn .ic { width: 18px; height: 18px; }
.link-strong { font-weight: 600; text-decoration: none; }
body.theme-contrast .link-strong { text-decoration: underline; }
.chip-btn {
  min-height: 36px; padding: 0 14px; border-radius: 999px; border: var(--c-bw) solid var(--c-chip-border);
  background: var(--c-surface); color: var(--c-text); font-size: 14px; font-weight: 600; white-space: nowrap;
}
.chip-primary { background: var(--c-primary); border-color: var(--c-primary); color: var(--c-on-primary); }
.chip-danger { color: var(--c-danger); }

.pill {
  height: 36px; padding: 0 14px; border-radius: 999px; border: var(--c-bw) solid var(--c-chip-border);
  background: var(--c-surface); color: var(--c-text); font-size: 14px; font-weight: 500; white-space: nowrap; flex: 0 0 auto;
}
.pill[aria-pressed="true"] { background: var(--c-primary); border-color: var(--c-primary); color: var(--c-on-primary); font-weight: 600; }
.filter-pills { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 3px; margin: -3px; }
.filter-pills::-webkit-scrollbar { display: none; }

.check {
  appearance: none; -webkit-appearance: none; flex: 0 0 22px; width: 22px; height: 22px; margin: 0;
  border-radius: 4px; border: 1.5px solid var(--c-text-2); background: var(--c-surface);
  display: inline-grid; place-content: center; cursor: pointer;
}
.check::after {
  content: ""; width: 12px; height: 7px; border-left: 2.5px solid var(--c-on-primary); border-bottom: 2.5px solid var(--c-on-primary);
  transform: translateY(-2px) rotate(-45deg); opacity: 0;
}
.check:checked { background: var(--c-primary); border-color: var(--c-primary); }
.check:checked::after { opacity: 1; }
body.theme-contrast .check { border: 2px solid #000; }

.field {
  width: 100%; min-height: 50px; padding: 0 16px; border-radius: 14px;
  border: var(--c-bw) solid var(--c-chip-border); background: var(--c-surface); color: var(--c-text); font-size: 16px;
}
.field-mono { font-family: var(--font-mono); font-size: 15px; }
.field::placeholder, textarea::placeholder, input::placeholder { color: var(--c-text-2); opacity: 1; }
.field-label { display: block; font-size: 14px; font-weight: 600; color: var(--c-text-3); margin: 14px 0 6px; }
.field-opt { font-weight: 400; color: var(--c-text-2); }
.select-field { appearance: auto; background: var(--c-sheet); }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; flex-wrap: wrap; }
.form-actions-spacer { flex: 1; }

.search-pill {
  display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 16px; border-radius: 999px;
  background: var(--c-surface); border: var(--c-bw) solid var(--c-border); color: var(--c-text-2);
}
.search-pill .ic { width: 18px; height: 18px; }
.search-pill input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font-size: 16px; color: var(--c-text); }
.search-pill:focus-within { outline: 3px solid var(--c-focus); outline-offset: 2px; }
.search-pill input::-webkit-search-cancel-button { -webkit-appearance: none; }

.section-label { margin: 0 4px 8px; font-size: 13px; font-weight: 600; color: var(--c-text-2); }

/* ---------- Struttura ---------- */
.app-container { display: flex; height: 100vh; height: 100dvh; background: var(--c-page); }
.main-workspace { flex: 1; min-width: 0; height: 100%; overflow-y: auto; overflow-x: hidden; position: relative; }
.workspace-view { display: none; }
.workspace-view.active { display: block; }
#view-chat.active { display: flex; height: 100%; }

/* Sezioni: barra scura sul computer */
.rail {
  flex: 0 0 96px; width: 96px; height: 100%; background: var(--c-top); color: var(--c-on-top);
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 20px 12px; z-index: 61;
}
body.theme-dark .rail { border-right: 1px solid var(--c-border); }
body.theme-contrast .rail { border-right: 2px solid #000; }
.rail-brand { display: block; width: 40px; margin-bottom: 18px; color: var(--c-on-top); line-height: 0; }
.rail-brand ugo-mascot { width: 40px; color: var(--c-on-top); }
.nav-module-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px; width: 72px; padding: 8px 0;
  border-radius: 16px; border: 0; background: transparent; color: #E2E8EE; font-size: 12px; font-weight: 500;
}
body.theme-dark .nav-module-btn { color: var(--c-on-top-2); }
body.theme-contrast .nav-module-btn { color: #000; border: 2px solid transparent; }
.nav-module-btn .nav-ic { display: flex; align-items: center; justify-content: center; height: 22px; }
.nav-module-btn .ic { width: 21px; height: 21px; stroke-width: 1.6; }
.nav-module-btn .ic-ugo { width: 15px; height: 19px; }
.nav-module-btn:hover { background: var(--c-top-btn); }
.nav-module-btn.active { background: var(--c-top-active); color: var(--c-on-top); font-weight: 600; }
body.theme-contrast .nav-module-btn.active { border-color: #000; }
.rail-spacer { flex: 1; }
.rail-account { position: relative; }
.rail-avatar {
  width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--c-sheet); color: var(--c-primary);
  display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 700; padding: 0;
}
body.theme-dark .rail-avatar { color: var(--c-text); }
body.theme-contrast .rail-avatar { background: #fff; color: #000; border: 2px solid #000; }
.rail-avatar-initials { display: flex; align-items: center; justify-content: center; }

.usso-dropdown-menu {
  position: absolute; left: 56px; bottom: 0; width: 280px; z-index: 90;
  background: var(--c-surface); color: var(--c-text); border: var(--c-bw) solid var(--c-border);
  border-radius: 20px; box-shadow: var(--c-shadow); padding: 14px; display: flex; flex-direction: column; gap: 10px;
}
.usso-dd-head { display: flex; align-items: center; gap: 12px; }
.usso-dd-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--c-primary); color: var(--c-on-primary); display: flex; align-items: center; justify-content: center; font-weight: 700; }
.usso-dd-name { font-weight: 600; }
.usso-dd-email { font-size: 13px; color: var(--c-text-2); }
.usso-dd-row { display: flex; justify-content: space-between; font-size: 14px; color: var(--c-text-2); }
.usso-dd-mono { font-family: var(--font-mono); color: var(--c-text); }
.usso-dd-links { display: flex; flex-direction: column; }
.usso-dd-links a { display: flex; align-items: center; gap: 10px; min-height: 44px; color: var(--c-text); text-decoration: none; font-size: 14px; border-radius: 10px; padding: 0 6px; }
.usso-dd-links a:hover { background: var(--c-chip); }

/* ---------- Conversazioni ---------- */
.sidebar {
  position: fixed; z-index: 58; display: none; flex-direction: column;
  background: var(--c-page); color: var(--c-text);
}
.sidebar.mobile-open { display: flex; }
.sidebar-backdrop { display: none; }
.page-head { display: flex; align-items: center; gap: 12px; padding: 20px 16px 8px; }
.page-head h1, .page-head h2 { margin: 0; font-size: 22px; font-weight: 700; }
.page-head-center { justify-content: space-between; }
.page-head-center h2 { font-size: 20px; font-weight: 600; }
.sidebar-tools { padding: 8px 16px 4px; display: flex; flex-direction: column; gap: 12px; }
.duo-start-card {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 20px; border: var(--c-bw) solid var(--c-top);
  background: var(--c-top); color: var(--c-on-top); text-align: left; width: 100%;
}
body.theme-dark .duo-start-card { background: #2C3E50; border-color: #2C3E50; color: #fff; }
body.theme-dark .duo-start-text span { color: #C9D3DC; }
body.theme-contrast .duo-start-card { border-color: #000; }
.duo-start-card .ic { width: 18px; height: 18px; }
.duo-start-text { flex: 1; display: flex; flex-direction: column; }
.duo-start-text strong { font-size: 15px; font-weight: 600; }
.duo-start-text span { font-size: 13px; color: var(--c-on-top-2); }
.duo-start-avatars, .duo-avatars { display: inline-flex; flex: 0 0 auto; }
.duo-start-avatars .av, .duo-avatars .av {
  width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #FFFFFF; border: 2px solid var(--c-top);
}
body.theme-dark .duo-start-avatars .av { border-color: #2C3E50; }
.duo-start-avatars .av + .av, .duo-avatars .av + .av { margin-left: -10px; }
.av-1 { background: var(--c-duo1); }
.av-2 { background: var(--c-duo2); }
body.theme-contrast .av-1 { background: #000; color: #fff; }
body.theme-contrast .av-2 { background: #fff; color: #000; border-color: #000 !important; }
.duo-avatars .av { border-color: var(--c-sheet); }
.duo-avatars.sm .av { width: 22px; height: 22px; font-size: 10px; border-color: var(--c-surface); }
.duo-avatars.sm .av + .av { margin-left: -8px; }

.sidebar-chats-scroll { flex: 1; overflow-y: auto; padding: 12px 16px 20px; }
.chats-list { display: flex; flex-direction: column; gap: 18px; }
.chats-group { display: flex; flex-direction: column; gap: 8px; }
.chats-group-label { margin: 0 4px; font-size: 13px; font-weight: 600; color: var(--c-text-2); }
.chat-swipe { position: relative; border-radius: 20px; }
.chat-swipe-action {
  position: absolute; top: 0; right: 0; bottom: 0; width: 96px; border: 0; border-radius: 0 20px 20px 0; background: var(--c-primary); color: var(--c-on-primary);
  display: none; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 13px; font-weight: 500;
}
.chat-swipe.swiped .chat-swipe-action, .chat-swipe.is-dragging .chat-swipe-action { display: flex; }
.chat-swipe.swiped, .chat-swipe.is-dragging { background: var(--c-primary); }
.chat-swipe.swiped .chat-item-btn { transform: none !important; margin-right: 96px; }
.chat-item-btn {
  position: relative; display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-radius: 20px;
  background: var(--c-surface); border: var(--c-bw) solid var(--c-border); color: var(--c-text);
  transition: transform 0.2s ease; cursor: pointer; touch-action: pan-y;
}
.chat-item-btn:hover { border-color: var(--c-chip-border); }
.chat-item-btn.active { border-color: var(--c-primary); box-shadow: inset 0 0 0 1px var(--c-primary); }
.chat-item-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.chat-item-title { display: inline-flex; align-items: center; gap: 8px; min-width: 0; font-size: 16px; font-weight: 600; }
.chat-item-title-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-item-time { flex: 0 0 auto; font-size: 13px; color: var(--c-text-2); }
.chat-item-preview { font-size: 14px; color: var(--c-text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item-actions {
  position: absolute; right: 8px; bottom: 6px; display: none; gap: 2px; background: var(--c-surface); border-radius: 12px;
}
.chat-action-icon { width: 36px; height: 36px; border: 0; border-radius: 10px; background: transparent; color: var(--c-text-2); display: inline-flex; align-items: center; justify-content: center; }
.chat-action-icon .ic { width: 18px; height: 18px; }
.chat-action-icon:hover { background: var(--c-chip); color: var(--c-text); }
@media (hover: hover) and (pointer: fine) {
  .chat-swipe:hover .chat-item-actions, .chat-swipe:focus-within .chat-item-actions { display: inline-flex; }
}

/* ---------- Ugo: pannello, chat, foglio ---------- */
.chat-layout { display: flex; width: 100%; height: 100%; }
.ugo-panel {
  background: var(--c-top); color: var(--c-on-top); display: flex; flex-direction: column; align-items: center;
}
.ugo-panel-top { align-self: stretch; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.panel-sq {
  width: 44px; height: 44px; border-radius: 14px; border: var(--c-bw) solid var(--c-top-btn-border);
  background: var(--c-top-btn); color: var(--c-on-top); display: inline-flex; align-items: center; justify-content: center; padding: 0; flex: 0 0 auto;
}
.panel-sq:hover { background: var(--c-top-active); }
.panel-pill {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: 999px;
  border: var(--c-bw) solid var(--c-top-btn-border); background: var(--c-top-btn); color: var(--c-on-top); font-size: 13px; font-weight: 500;
}
.panel-pill .ic { width: 15px; height: 15px; }
.ugo-panel-greeting { font-size: 14px; color: var(--c-on-top-2); }
.panel-duo-chip { display: none; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 999px; background: var(--c-top-btn); font-size: 13px; font-weight: 600; }
.panel-duo-chip .ic { width: 15px; height: 15px; }
body.theme-contrast .panel-duo-chip { background: #fff; border: 2px solid #000; }
.ugo-panel-stage { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px; width: 100%; min-height: 0; }
.ugo-panel-mascot { border: 0; padding: 24px 48px 8px; background: transparent; color: var(--c-on-top); border-radius: 32px; line-height: 0; }
.ugo-panel-mascot ugo-mascot { width: 170px; color: var(--c-on-top); }
.ugo-panel-text { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; max-width: 340px; }
.ugo-panel-title { font-size: 26px; font-weight: 600; line-height: 1.25; }
.ugo-panel-sub { font-size: 15px; color: var(--c-on-top-2); }
.ugo-wave { display: flex; align-items: center; gap: 4px; height: 48px; }
.ugo-wave span { width: 4px; height: 4px; border-radius: 2px; background: var(--c-on-top-2); transform-origin: center; transition: height 0.3s ease; }
.ugo-wave.on span:nth-child(6n+1) { height: 14px; }
.ugo-wave.on span:nth-child(6n+2) { height: 26px; animation-delay: 0.12s; }
.ugo-wave.on span:nth-child(6n+3) { height: 38px; animation-delay: 0.24s; }
.ugo-wave.on span:nth-child(6n+4) { height: 20px; animation-delay: 0.36s; }
.ugo-wave.on span:nth-child(6n+5) { height: 32px; animation-delay: 0.48s; }
.ugo-wave.on span:nth-child(6n) { height: 18px; animation-delay: 0.6s; }
.ugo-wave.on span { animation-name: ugo-wave; animation-duration: 0.9s; animation-timing-function: ease-in-out; animation-iteration-count: infinite; animation-direction: alternate; }
@keyframes ugo-wave { 0% { transform: scaleY(0.35); } 100% { transform: scaleY(1); } }

.panel-duo { display: none; align-self: stretch; flex-direction: column; gap: 8px; margin-bottom: 4px; }
.panel-duo-title { font-size: 13px; font-weight: 600; color: var(--c-on-top-2); margin: 0 4px 2px; }
.panel-duo-people { display: flex; flex-direction: column; gap: 8px; }
.panel-person { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 16px; background: var(--c-top-btn-strong); }
body.theme-contrast .panel-person { border: 2px solid #000; }
.panel-person .av { width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; border: 0; flex: 0 0 auto; }
.panel-person.is-turn .av { box-shadow: 0 0 0 2px var(--c-top), 0 0 0 4px var(--c-duo1-border); }
.panel-person.user2.is-turn .av { box-shadow: 0 0 0 2px var(--c-top), 0 0 0 4px var(--c-duo2-border); }
.panel-person-text { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.panel-person-text strong { font-size: 15px; font-weight: 600; }
.panel-person-text span { font-size: 13px; color: var(--c-on-top-2); }
.panel-person-turn { font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 999px; background: var(--c-sheet); color: var(--c-text); white-space: nowrap; }
.panel-outline-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.4); background: transparent; color: var(--c-on-top); font-size: 15px; font-weight: 600; margin-top: 4px;
}
body.theme-contrast .panel-outline-btn { border: 2px solid #000; background: #fff; }
.panel-outline-btn .ic { width: 18px; height: 18px; }

.ugo-panel-controls { display: flex; align-items: center; gap: 20px; }
.panel-round {
  width: 52px; height: 52px; border-radius: 50%; border: var(--c-bw) solid var(--c-top-btn-border);
  background: var(--c-top-btn-strong); color: var(--c-on-top); display: inline-flex; align-items: center; justify-content: center; padding: 0;
}
.panel-mic {
  width: 84px; height: 84px; border-radius: 50%; border: var(--c-bw) solid var(--c-top-btn-border); background: #FFFFFF; color: #2C3E50;
  display: inline-flex; align-items: center; justify-content: center; padding: 0;
}
body.theme-dark .panel-mic { background: #DDE3E9; color: #10161C; }
body.theme-contrast .panel-mic { background: #000; color: #fff; border-color: #000; }
.panel-mic .ic { width: 28px; height: 28px; }
.panel-mic.is-on { box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.18); }
body.theme-contrast .panel-mic.is-on { box-shadow: 0 0 0 4px #fff, 0 0 0 7px #000; }

.chat-column { display: flex; flex-direction: column; min-width: 0; background: var(--c-sheet); color: var(--c-text); }
.chat-head { display: flex; align-items: center; gap: 10px; }
.chat-head-ugo {
  flex: 0 0 40px; width: 40px; height: 40px; border-radius: 50%; background: var(--c-top); color: var(--c-on-top);
  display: none; align-items: center; justify-content: center;
}
body.theme-dark .chat-head-ugo { border: 1px solid var(--c-border); }
body.theme-contrast .chat-head-ugo { border: 2px solid #000; }
.chat-head-ugo ugo-mascot { width: 22px; color: var(--c-on-top); }
.chat-head-duo { display: none; }
.is-duo .chat-head-duo { display: inline-flex; }
.is-duo .chat-head-ugo { display: none !important; }
.chat-head-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.chat-thread-title { font-size: 18px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.3; }
.chat-head-sub { font-size: 13px; color: var(--c-text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-head-sub .sub-mobile { display: none; }
.chat-head-actions { display: flex; align-items: center; gap: 8px; }
.duo-only { display: none !important; }
#chat-voice-btn, #chat-back-btn, #duo-settings-btn { display: none; }

.offline-banner {
  margin: 0 16px 8px; padding: 12px 14px; border-radius: 16px; background: var(--c-warn-bg); border: var(--c-bw) solid var(--c-warn-border);
  color: var(--c-warn-text); display: flex; gap: 10px; font-size: 14px; line-height: 1.45;
}
.offline-banner .ic { width: 20px; height: 20px; margin-top: 1px; }

.duo-strip { display: none; }
.sheet-handle, .home-recent, .home-controls, .home-type-row { display: none; }

/* Idee di partenza */
.chat-welcome-container { flex: 1; overflow-y: auto; display: flex; flex-direction: column; justify-content: center; padding: 24px 28px; }
.welcome-list { width: 100%; max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; }
.prompt-card {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 20px; width: 100%; text-align: left;
  background: var(--c-surface); border: var(--c-bw) solid var(--c-border); color: var(--c-text);
}
.prompt-card:hover { border-color: var(--c-chip-border); }
.card-icon { flex: 0 0 40px; width: 40px; height: 40px; border-radius: 12px; background: var(--c-chip); color: var(--c-text); display: flex; align-items: center; justify-content: center; }
body.theme-contrast .card-icon { border: 2px solid #000; }
.card-icon .ic { width: 18px; height: 18px; }
.card-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.card-title { font-size: 15px; font-weight: 600; }
.card-desc { font-size: 13px; color: var(--c-text-2); }

/* Messaggi */
.chat-thread-container { flex: 1; overflow-y: auto; }
.messages-stream { display: flex; flex-direction: column; gap: 20px; }
.message-row { display: flex; align-items: flex-end; gap: 10px; }
.msg-user-row.msg-mine { justify-content: flex-end; }
.msg-body { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.msg-mine .msg-body { align-items: flex-end; max-width: 80%; }
.msg-ugo-row .msg-body { max-width: 82%; }
.msg-user-row:not(.msg-mine) .msg-body { max-width: 80%; }
.msg-meta-bar { display: none; }
.msg-duo .msg-meta-bar { display: flex; padding: 0 2px; }
.msg-sender-name { font-size: 12px; font-weight: 600; color: var(--c-text); }
.msg-user1-row .msg-sender-name { color: var(--c-duo1); }
.msg-user2-row .msg-sender-name { color: var(--c-duo2); }
body.theme-dark .msg-user1-row .msg-sender-name { color: #67E8F9; }
body.theme-dark .msg-user2-row .msg-sender-name { color: #C4B5FD; }
.msg-bubble {
  border-radius: 22px 22px 22px 8px; padding: 16px 18px; font-size: 16px; line-height: 1.65; overflow-wrap: anywhere;
  background: var(--c-surface); border: var(--c-bw) solid var(--c-border); color: var(--c-text);
}
.msg-user-row .msg-bubble { line-height: 1.55; padding: 14px 18px; }
.msg-mine .msg-bubble { background: var(--c-user); color: var(--c-on-user); border-color: var(--c-user); border-radius: 22px 22px 8px 22px; }
.msg-duo.msg-user1-row.msg-mine .msg-bubble { background: var(--c-duo1); border-color: var(--c-duo1); color: #fff; }
.msg-duo.msg-user2-row.msg-mine .msg-bubble { background: var(--c-duo2); border-color: var(--c-duo2); color: #fff; }
.msg-duo.msg-user1-row:not(.msg-mine) .msg-bubble { background: var(--c-duo1-bg); border-color: var(--c-duo1-border); color: var(--c-duo1-text); }
.msg-duo.msg-user2-row:not(.msg-mine) .msg-bubble { background: var(--c-duo2-bg); border-color: var(--c-duo2-border); color: var(--c-duo2-text); }
body.theme-contrast .msg-duo.msg-user1-row.msg-mine .msg-bubble, body.theme-contrast .msg-duo.msg-user2-row.msg-mine .msg-bubble { background: #000; color: #fff; }
.msg-avatar-badge {
  flex: 0 0 36px; width: 36px; height: 36px; border-radius: 50%; background: var(--c-top); color: var(--c-on-top);
  display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700;
}
body.theme-dark .msg-avatar-badge.ugo-avatar-badge { border: 1px solid var(--c-border); }
body.theme-contrast .msg-avatar-badge { border: 2px solid #000; }
.msg-avatar-badge .ic-ugo { width: 15px; height: 19px; }
.msg-avatar-badge ugo-mascot { width: 20px; color: var(--c-on-top); }
.user1-avatar-badge { background: var(--c-duo1); color: #fff; }
.user2-avatar-badge { background: var(--c-duo2); color: #fff; }
body.theme-contrast .user2-avatar-badge { background: #fff; color: #000; }
.msg-bubble p { margin: 0 0 10px; }
.para-gap { display: block; height: 12px; }
.msg-bubble strong { font-weight: 700; }
.msg-bubble a { color: inherit; }
.msg-bubble .md-list-item { margin-left: 18px; }
.msg-bubble .md-h2, .msg-bubble .md-h3, .msg-bubble .md-h4 { margin: 6px 0 4px; font-size: 17px; font-weight: 700; }
.msg-bubble .md-quote { border-left: 3px solid var(--c-border); padding-left: 12px; color: var(--c-text-2); }
.msg-bubble code { font-family: var(--font-mono); font-size: 13.5px; padding: 1px 6px; border-radius: 6px; background: var(--c-chip); }
.msg-mine .msg-bubble code { background: rgba(255, 255, 255, 0.15); }
.msg-bubble pre { margin: 10px 0; border-radius: 14px; overflow: hidden; background: #1B2229; color: #ECEAE6; }
body.theme-dark .msg-bubble pre { background: #10161C; border: 1px solid var(--c-border); }
body.theme-contrast .msg-bubble pre { background: #000; }
.msg-bubble pre code { display: block; padding: 14px 16px; background: transparent; overflow-x: auto; white-space: pre; font-size: 13px; line-height: 1.6; color: inherit; }
.code-header-bar { display: flex; justify-content: space-between; align-items: center; padding: 6px 8px 6px 14px; background: rgba(255, 255, 255, 0.06); font-family: var(--font-mono); font-size: 12px; color: #A8B0B8; }
.copy-code-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 10px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.25); background: transparent; color: #ECEAE6; font-size: 12px; }
.copy-code-btn .ic { width: 14px; height: 14px; }
.table-scroll-wrapper { overflow-x: auto; margin: 8px 0; }
.md-table { border-collapse: collapse; font-size: 14px; }
.md-table th, .md-table td { border: 1px solid var(--c-border); padding: 6px 10px; text-align: left; }
.slash-chip, .usso-mention-chip { font-family: var(--font-mono); font-size: 13px; padding: 2px 6px; border-radius: 6px; background: rgba(255, 255, 255, 0.15); margin-right: 4px; }
.msg-ugo-row .usso-mention-chip { background: var(--c-chip); }
.msg-media-preview img { display: block; max-width: 260px; max-height: 260px; border-radius: 14px; margin-bottom: 8px; cursor: zoom-in; }
.msg-footer-bar { display: flex; align-items: center; gap: 2px; margin-left: 4px; opacity: 0; transition: opacity 0.15s ease; }
.message-row:hover .msg-footer-bar, .message-row:focus-within .msg-footer-bar { opacity: 1; }
.msg-time-visible { font-size: 12px; color: var(--c-text-2); margin-right: 4px; }
.msg-action-btn { width: 36px; height: 36px; border: 0; border-radius: 10px; background: transparent; color: var(--c-text-2); display: inline-flex; align-items: center; justify-content: center; }
.msg-action-btn .ic { width: 17px; height: 17px; }
.msg-action-btn:hover { background: var(--c-chip); color: var(--c-text); }
.msg-inline-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.msg-inline-actions .chip-btn { min-height: 44px; padding: 0 16px; }
.msg-failed .msg-bubble { background: var(--c-surface) !important; color: var(--c-text) !important; border: 1px dashed var(--c-text-2) !important; }
body.theme-contrast .msg-failed .msg-bubble { border: 2px dashed #000 !important; }
.msg-failed-note { align-self: flex-end; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; border: 0; background: none; color: var(--c-warn-text); font-size: 13px; font-weight: 600; padding: 0 4px; }
body.theme-light .msg-failed-note { color: #9A3412; }
.msg-failed-note .ic { width: 15px; height: 15px; }

.typing-bar { display: flex; align-items: flex-end; gap: 10px; margin-top: 20px; }
.typing-body { display: inline-flex; align-items: center; padding: 16px 18px; border-radius: 22px 22px 22px 8px; background: var(--c-surface); border: var(--c-bw) solid var(--c-border); }
.typing-dots { display: inline-flex; gap: 4px; }
.typing-dots .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--c-primary); animation: ugo-dot 1.2s ease-in-out infinite; }
.typing-dots .dot:nth-child(2) { animation-delay: 0.15s; }
.typing-dots .dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes ugo-dot { 0%, 80%, 100% { opacity: 0.25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* Duo: chi scrive (solo se la Duo è sullo stesso dispositivo) */
.app-container:not(.duo-same-device) .duo-session-bar { display: none !important; }
.duo-session-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 13px; color: var(--c-text-2); }
.duo-speakers-selector { display: inline-flex; gap: 6px; }
.duo-speaker-pill {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 10px; border-radius: 999px; border: 0;
  background: transparent; color: var(--c-text); font-size: 14px; font-weight: 500;
}
.duo-speaker-pill:hover { background: var(--c-chip); }
.duo-radio { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--c-text-2); display: inline-flex; align-items: center; justify-content: center; }
.duo-speaker-pill.active { font-weight: 600; }
.duo-speaker-pill.active .duo-radio::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
#duo-pill-user1.active .duo-radio { border-color: var(--c-duo1); color: var(--c-duo1); }
#duo-pill-user2.active .duo-radio { border-color: var(--c-duo2); color: var(--c-duo2); }
body.theme-dark #duo-pill-user1.active .duo-radio { color: #67E8F9; border-color: #67E8F9; }
body.theme-dark #duo-pill-user2.active .duo-radio { color: #C4B5FD; border-color: #C4B5FD; }
.duo-speaker-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Campo di scrittura */
.input-dock-wrapper { position: relative; }
.dock-row { display: flex; align-items: center; gap: 8px; }
.input-dock {
  flex: 1; display: flex; align-items: center; gap: 4px; min-width: 0;
  background: var(--c-surface); border: var(--c-bw) solid var(--c-border); border-radius: 999px; padding: 6px 6px 6px 20px;
}
#chat-textarea::placeholder { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#chat-textarea {
  flex: 1; min-width: 0; border: 0; outline: none; background: transparent; resize: none; font-size: 16px; line-height: 1.45;
  padding: 10px 0; max-height: 140px; color: var(--c-text);
}
.input-dock:focus-within { outline: 3px solid var(--c-focus); outline-offset: 2px; }
.dock-btn { flex: 0 0 44px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent; color: var(--c-text-2); display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.dock-btn:hover { background: var(--c-chip); color: var(--c-text); }
.dock-btn.mic-active { background: var(--c-primary); color: var(--c-on-primary); }
.send-btn { background: var(--c-primary); color: var(--c-on-primary); }
.send-btn:hover { background: var(--c-primary); color: var(--c-on-primary); filter: brightness(1.1); }
.app-container[data-speaker="user1"].is-duo .send-btn { background: var(--c-duo1); color: #fff; }
.app-container[data-speaker="user2"].is-duo .send-btn { background: var(--c-duo2); color: #fff; }
body.theme-contrast .app-container.is-duo .send-btn { background: #000 !important; }
.is-duo #dock-attach-btn { display: none; }
#dock-mic-btn { display: none; }
.is-duo #dock-mic-btn { display: inline-flex; }
.dock-stop {
  display: none; align-items: center; gap: 8px; height: 52px; padding: 0 22px; border-radius: 999px; border: 0;
  background: var(--c-primary); color: var(--c-on-primary); font-size: 15px; font-weight: 600; flex: 0 0 auto;
}
.dock-stop .ic { width: 14px; height: 14px; fill: currentColor; stroke: none; }
.is-working .dock-stop { display: inline-flex; }
.is-working #dock-send-btn { display: none; }
.dock-voice { display: none; }
.dock-file-preview {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 auto 8px; max-width: 680px;
  padding: 6px 6px 6px 14px; border-radius: 14px; background: var(--c-chip); font-size: 14px;
}
.dock-file-preview span { display: inline-flex; align-items: center; gap: 8px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dock-file-preview .ic { width: 16px; height: 16px; }

.slash-palette, .mention-dropdown {
  margin: 0 auto 8px; max-width: 680px; max-height: 300px; overflow: auto; padding: 6px;
  border-radius: 20px; background: var(--c-surface); border: var(--c-bw) solid var(--c-border); box-shadow: var(--c-shadow);
}
.slash-option { width: 100%; display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 6px 10px; border: 0; border-radius: 14px; background: transparent; text-align: left; }
.slash-option[aria-selected="true"], .slash-option:hover { background: var(--c-chip); }
body.theme-contrast .slash-option[aria-selected="true"] { outline: 2px solid #000; }
.slash-cmd { flex: 0 0 104px; font-family: var(--font-mono); font-size: 14px; color: var(--c-link); }
.slash-desc { font-size: 14px; color: var(--c-text-3); }
.mention-header { display: flex; align-items: center; gap: 8px; padding: 6px 10px; font-size: 13px; color: var(--c-text-2); }
.mention-header .ic { width: 16px; height: 16px; }
.mention-item { width: 100%; display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 10px; border: 0; border-radius: 14px; background: transparent; text-align: left; }
.mention-item:hover { background: var(--c-chip); }
.mention-avatar { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 12px; font-weight: 700; }
.mention-avatar.av-1 { background: var(--c-primary); color: var(--c-on-primary); }
.mention-nick { font-weight: 600; }
.mention-tag, .mention-type { font-size: 12px; color: var(--c-text-2); }

.sensor-chips { display: flex; gap: 6px; overflow-x: auto; margin: 0 auto 8px; max-width: 680px; }
.sensor-chip {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 999px;
  border: var(--c-bw) solid var(--c-chip-border); background: var(--c-surface); color: var(--c-text); font-size: 13px; font-weight: 600;
}
.sensor-chip .ic { width: 14px; height: 14px; display: none; }
.sensor-chip.is-on { background: var(--c-primary); border-color: var(--c-primary); color: var(--c-on-primary); }
.sensor-chip.is-on .ic { display: inline; }

/* ---------- Computer: Ugo (mockup «Compagno» e «Duo») ---------- */
@media (min-width: 769px) {
  .app-container.view-is-chat .rail { display: none; }
  .app-container.view-is-chat.chats-open .rail { display: flex; position: fixed; left: 0; top: 0; bottom: 0; }
  .sidebar { left: 96px; top: 0; bottom: 0; width: 400px; border-right: var(--c-bw) solid var(--c-border); box-shadow: var(--c-shadow); }
  .sidebar-backdrop.active { display: block; position: fixed; inset: 0; z-index: 55; background: var(--c-scrim); }

  #view-chat .chat-layout { gap: 16px; padding: 16px; }
  .ugo-panel { flex: 1 1 400px; max-width: 460px; height: 100%; border-radius: 28px; padding: 28px; }
  body.theme-dark .ugo-panel { border: 1px solid var(--c-border); }
  body.theme-contrast .ugo-panel { border: 2px solid #000; }
  #panel-policy-pill, #panel-new-btn { display: none; }
  .is-duo .ugo-panel-greeting { display: none; }
  .is-duo .panel-duo-chip { display: inline-flex; }
  .is-duo .panel-duo { display: flex; }
  .is-duo .ugo-panel-controls { display: none; }
  .is-duo .ugo-panel-mascot ugo-mascot { width: 130px; }
  .is-duo .ugo-panel-text, .is-duo .ugo-wave { display: none; }
  .is-duo .ugo-panel-stage { gap: 12px; }

  .chat-column { flex: 999 1 520px; height: 100%; border-radius: 28px; overflow: hidden; }
  body.theme-dark .chat-column { border: 1px solid var(--c-border); }
  body.theme-contrast .chat-column { border: 2px solid #000; }
  .chat-head { flex-wrap: wrap; gap: 12px; padding: 20px 28px; }
  .is-duo .chat-head-actions .duo-only { display: inline-flex !important; }
  .is-duo #duo-settings-btn { display: none !important; }
  .is-duo #data-policy-pill, .is-duo #toggle-sidebar-btn { display: none; }
  .chat-head-duo .av { width: 36px; height: 36px; font-size: 14px; }
  .chat-head-duo .av + .av { margin-left: -8px; }
  .chat-thread-container { padding: 12px 28px 20px; }
  .messages-stream, .typing-bar { max-width: 680px; margin-left: auto; margin-right: auto; }
  .duo-session-bar { max-width: 700px; margin: 0 auto; width: 100%; padding: 0 28px 8px; }
  .input-dock-wrapper { padding: 0 28px 24px; }
  .dock-row { max-width: 680px; margin: 0 auto; }
  .is-duo .input-dock { border: 2px solid var(--c-text); }
  .app-container.is-duo[data-speaker="user1"] .input-dock { border-color: var(--c-duo1); }
  .app-container.is-duo[data-speaker="user2"] .input-dock { border-color: var(--c-duo2); }
  body.theme-contrast .app-container.is-duo .input-dock { border-color: #000 !important; }
  .msg-ugo-row:last-child .msg-footer-bar { opacity: 1; }
  .msg-mine .msg-body, .msg-user-row:not(.msg-mine) .msg-body { max-width: 84%; }
  .msg-ugo-row .msg-body { position: relative; }
  .msg-ugo-row:not(.msg-error-row) { margin-bottom: 26px; }
  .msg-ugo-row:last-child { margin-bottom: 40px; }
  .msg-footer-bar { position: absolute; left: 0; top: 100%; margin: 2px 0 0; }
}

/* ---------- Telefono ---------- */
@media (max-width: 768px) {
  .app-container { display: block; }

  /* Barra in basso: Ugo, Appunti, Memoria, App, Altro */
  .rail {
    position: fixed; left: 0; right: 0; bottom: 0; width: auto; height: auto; flex-direction: row; justify-content: space-around; align-items: flex-start;
    gap: 0; padding: 8px 8px calc(18px + env(safe-area-inset-bottom, 0px)); background: var(--c-sheet); color: var(--c-text-2);
    border-top: var(--c-bw) solid var(--c-border); z-index: 70; display: none;
  }
  body.theme-dark .rail { border-right: 0; }
  body.theme-contrast .rail { border-right: 0; border-top: 2px solid #000; }
  .app-container.view-is-notes .rail, .app-container.view-is-memory .rail, .app-container.view-is-apps .rail,
  .app-container.view-is-settings .rail, .app-container.view-is-gallery .rail, .app-container.chats-open .rail { display: flex; }
  .app-container.note-open .rail { display: none !important; }
  .rail-brand, .rail-spacer, .rail-account, .nav-desktop-only { display: none !important; }
  .nav-module-btn { width: auto; min-width: 64px; padding: 4px 0 0; border-radius: 0; color: var(--c-text-2); font-size: 12px; font-weight: 500; gap: 4px; }
  body.theme-dark .nav-module-btn { color: var(--c-text-2); }
  .nav-module-btn .nav-ic { width: 56px; height: 30px; border-radius: 15px; }
  .nav-module-btn:hover { background: transparent; }
  .nav-module-btn.active { background: transparent; color: var(--c-primary); font-weight: 600; }
  .nav-module-btn.active .nav-ic { background: #DDE3E9; color: #2C3E50; }
  body.theme-dark .nav-module-btn.active { color: var(--c-text); }
  body.theme-dark .nav-module-btn.active .nav-ic { background: #34495E; color: #FFFFFF; }
  body.theme-contrast .nav-module-btn { border: 0; }
  body.theme-contrast .nav-module-btn.active .nav-ic { background: #000; color: #fff; }
  .app-container.view-is-notes .main-workspace, .app-container.view-is-memory .main-workspace, .app-container.view-is-apps .main-workspace,
  .app-container.view-is-settings .main-workspace, .app-container.view-is-gallery .main-workspace { padding-bottom: 96px; }
  .rail :focus-visible { outline-color: var(--c-focus); }

  /* Conversazioni: pagina intera */
  .sidebar { inset: 0; z-index: 60; padding-bottom: 88px; }

  /* Ugo sul telefono: home a voce («Compagno-mobile») e chat a tastiera («Chat-chiaro») */
  .chat-layout { flex-direction: column; }
  .is-home .chat-layout { background: var(--c-top); }
  .ugo-panel { flex: 1 1 auto; min-height: 0; padding: 20px 16px 20px; width: 100%; }
  #panel-greeting, #panel-settings-btn, .panel-duo, .panel-duo-chip, .ugo-panel-controls { display: none !important; }
  .ugo-panel-stage { gap: 18px; padding: 8px 8px 0; }
  .ugo-panel-mascot { padding: 16px 36px 6px; }
  .ugo-panel-mascot ugo-mascot { width: 110px; }
  .ugo-panel-title { font-size: 24px; }
  .ugo-wave { height: 40px; }
  .is-empty .ugo-panel-mascot ugo-mascot { width: 120px; }
  .is-empty .ugo-panel-title { font-size: 28px; font-weight: 700; }
  .is-empty .ugo-panel-sub { font-size: 16px; line-height: 1.5; max-width: 320px; }
  .is-empty .ugo-wave { display: none; }

  .chat-column { flex: 0 0 auto; width: 100%; }
  .is-home .chat-column { border-radius: 28px 28px 0 0; padding: 12px 16px calc(20px + env(safe-area-inset-bottom, 0px)); gap: 14px; max-height: 64%; overflow-y: auto; }
  body.theme-contrast .is-home .chat-column { border-top: 2px solid #000; }
  .is-home .chat-head, .is-home .duo-strip, .is-home #chat-thread-scroll, .is-home .duo-session-bar, .is-home .input-dock-wrapper, .is-home .offline-banner { display: none !important; }
  .is-home:not(.is-empty) .sheet-handle { display: block; align-self: center; width: 40px; height: 4px; border-radius: 2px; background: var(--c-chip-border); flex: 0 0 auto; }
  .is-home:not(.is-empty) .home-recent { display: flex; flex-direction: column; gap: 14px; }
  .is-home:not(.is-empty) .home-controls { display: flex; align-items: center; justify-content: space-between; padding-top: 4px; }
  .is-home.is-empty .home-type-row { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
  .is-home.is-empty .chat-column { padding-top: 20px; gap: 10px; }
  .is-home .chat-welcome-container { padding: 0; flex: 0 0 auto; overflow: visible; }
  .is-home:not(.is-empty) .chat-welcome-container { display: none !important; }

  .home-recent-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  .home-recent-head h2 { font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .home-reply {
    background: var(--c-surface); border: var(--c-bw) solid var(--c-border); border-radius: 20px 20px 20px 8px; padding: 14px 16px;
    display: flex; flex-direction: column; gap: 8px; max-height: 220px; overflow: hidden; position: relative;
  }
  .home-reply-who { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--c-text-2); }
  .home-reply-who .ic { width: 14px; height: 14px; }
  .home-reply-text { font-size: 15px; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
  .home-reply-text pre, .home-reply-text .table-scroll-wrapper { display: none; }
  .home-round { width: 52px; height: 52px; border-radius: 50%; border: var(--c-bw) solid var(--c-chip); background: var(--c-chip); color: var(--c-text); display: inline-flex; align-items: center; justify-content: center; padding: 0; }
  body.theme-contrast .home-round { border-color: #000; }
  .home-mic { width: 76px; height: 76px; border-radius: 50%; border: var(--c-bw) solid var(--c-primary); background: var(--c-primary); color: var(--c-on-primary); display: inline-flex; align-items: center; justify-content: center; padding: 0; }
  .home-mic .ic { width: 26px; height: 26px; }
  .home-mic.is-on, .home-mic-sm.is-on { box-shadow: 0 0 0 5px var(--c-primary-soft); }
  body.theme-contrast .home-mic.is-on, body.theme-contrast .home-mic-sm.is-on { box-shadow: 0 0 0 3px #fff, 0 0 0 6px #000; }
  .home-type {
    flex: 1; min-width: 0; height: 52px; padding: 0 18px; border-radius: 999px; border: var(--c-bw) solid var(--c-chip-border);
    background: var(--c-surface); color: var(--c-text-2); font-size: 16px; text-align: left;
  }
  .home-mic-sm { flex: 0 0 56px; width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--c-primary); color: var(--c-on-primary); display: inline-flex; align-items: center; justify-content: center; padding: 0; }

  /* Modo chat a tastiera */
  .is-chat .ugo-panel { display: none; }
  .is-chat .chat-column { flex: 1 1 auto; height: 100%; }
  .is-chat .chat-head { padding: 20px 16px 12px; border-bottom: var(--c-bw) solid var(--c-border); flex: 0 0 auto; }
  .is-chat #chat-back-btn { display: inline-flex; }
  .is-chat .chat-head-ugo { display: inline-flex; }
  .is-chat:not(.is-duo) #chat-voice-btn { display: inline-flex; }
  .is-chat.is-duo #duo-settings-btn { display: inline-flex !important; }
  #data-policy-pill, #toggle-sidebar-btn { display: none; }
  .chat-thread-title { font-size: 16px; }
  .chat-head-sub { font-size: 12px; }
  .chat-head-sub .sub-desktop { display: none; }
  .chat-head-sub .sub-mobile { display: inline; }
  .chat-head-duo .av { width: 30px; height: 30px; }
  .is-chat .offline-banner { margin-top: 12px; }
  .is-chat.is-duo .duo-strip {
    display: flex; align-items: center; gap: 10px; margin: 12px 16px 0; padding: 10px 14px 10px 8px; border-radius: 20px; background: var(--c-top); color: var(--c-on-top);
  }
  body.theme-contrast .is-chat.is-duo .duo-strip { border: 2px solid #000; }
  body.theme-dark .is-chat.is-duo .duo-strip { border: 1px solid var(--c-border); }
  .duo-strip-ugo { flex: 0 0 56px; display: flex; justify-content: center; }
  .duo-strip-ugo ugo-mascot { width: 40px; color: var(--c-on-top); }
  .duo-strip-text { display: flex; flex-direction: column; }
  .duo-strip-text strong { font-size: 15px; font-weight: 600; }
  .duo-strip-text span { font-size: 13px; color: var(--c-on-top-2); }
  .is-chat .chat-welcome-container { justify-content: flex-start; padding: 16px; }
  .chat-thread-container { padding: 16px; }
  .messages-stream { gap: 14px; }
  .message-row { gap: 8px; }
  .msg-bubble { font-size: 15px; line-height: 1.55; padding: 14px; border-radius: 20px 20px 20px 8px; }
  .msg-user-row .msg-bubble { padding: 12px 14px; line-height: 1.5; }
  .msg-mine .msg-bubble { border-radius: 20px 20px 8px 20px; }
  .msg-ugo-row .msg-body { max-width: 84%; }
  .msg-avatar-badge { flex-basis: 30px; width: 30px; height: 30px; font-size: 12px; }
  .app-container:not(.is-duo) .msg-ugo-row .msg-avatar-badge, .app-container:not(.is-duo) .typing-bar .msg-avatar-badge { display: none; }
  .msg-footer-bar { display: none; }
  .msg-avatar-badge .ic-ugo { width: 12px; height: 15px; }
  .msg-avatar-badge ugo-mascot { width: 16px; }
  .typing-bar { margin-top: 14px; }
  .is-chat .duo-session-bar { padding: 6px 16px 0; }
  .is-chat .input-dock-wrapper { padding: 8px 12px calc(20px + env(safe-area-inset-bottom, 0px)); border-top: var(--c-bw) solid var(--c-border); }
  .input-dock { min-height: 52px; padding: 4px 4px 4px 16px; border: 2px solid var(--c-primary); }
  .input-dock:focus-within { outline-offset: 1px; }
  .app-container.is-duo[data-speaker="user1"] .input-dock { border-color: var(--c-duo1); }
  .app-container.is-duo[data-speaker="user2"] .input-dock { border-color: var(--c-duo2); }
  body.theme-contrast .app-container.is-duo .input-dock { border-color: #000 !important; }
  .dock-btn { flex-basis: 40px; width: 40px; height: 40px; }
  #dock-attach-btn, #dock-mic-btn, .is-duo #dock-mic-btn { display: none; }
  .dock-voice { display: none; flex: 0 0 52px; width: 52px; height: 52px; border-radius: 50%; border: var(--c-bw) solid var(--c-chip); background: var(--c-chip); color: var(--c-text); align-items: center; justify-content: center; padding: 0; }
  body.theme-contrast .dock-voice { border-color: #000; }
  .is-duo .dock-voice { display: inline-flex; background: var(--c-primary); color: var(--c-on-primary); border-color: var(--c-primary); }
  .is-working .dock-voice { display: none; }
  .dock-voice.is-on { background: var(--c-primary); color: var(--c-on-primary); }
  .slash-palette, .mention-dropdown, .sensor-chips, .dock-file-preview { margin-left: 0; margin-right: 0; }
}

/* ---------- Live Vision ---------- */
#view-live.active { height: 100%; background: var(--c-live); color: #FFFFFF; }
.live-layout { display: flex; height: 100%; }
.live-stage { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 20px; gap: 16px; }
.live-viewport-box {
  position: relative; flex: 1; min-height: 0; border-radius: 24px; overflow: hidden;
  background: linear-gradient(to bottom, #1E2A35 0, #1E2A35 58%, #26343F 58%, #26343F 100%);
}
#live-video-stream, .live-hud-canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.live-hud-canvas { pointer-events: none; }
.live-shutter-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; transition: opacity 0.2s ease; }
.live-shutter-flash.flash, .live-shutter-flash.active { opacity: 0.7; }
.hud-scanner-line { position: absolute; left: 24px; right: 24px; top: 26%; height: 1px; background: rgba(201, 211, 220, 0.35); }
.live-placeholder-screen {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; padding: 24px;
}
.live-ph-icon { width: 64px; height: 64px; border-radius: 50%; background: rgba(255, 255, 255, 0.1); display: flex; align-items: center; justify-content: center; }
.live-ph-icon .ic { width: 28px; height: 28px; }
.live-placeholder-screen h2 { font-size: 22px; font-weight: 600; }
.live-placeholder-screen p { max-width: 340px; color: #C9D3DC; font-size: 15px; }
.live-placeholder-screen .btn { margin-top: 8px; }
.hud-top-bar { position: absolute; left: 0; right: 0; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 20px 16px; pointer-events: none; }
.hud-top-bar > * { pointer-events: auto; }
.hud-icon-btn {
  width: 44px; height: 44px; border-radius: 14px; border: 0; background: rgba(20, 27, 34, 0.6); color: #FFFFFF;
  display: inline-flex; align-items: center; justify-content: center; padding: 0;
}
.hud-status-chip { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 999px; background: rgba(20, 27, 34, 0.6); font-size: 14px; font-weight: 600; max-width: 60%; }
.hud-status-chip #hud-status-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hud-dot { flex: 0 0 8px; width: 8px; height: 8px; border-radius: 50%; background: #F3A57E; }
.hud-status-chip i { display: none; }
.hud-quick-tools { display: flex; gap: 8px; }
.hud-say { position: absolute; left: 16px; right: 16px; bottom: 16px; display: none; align-items: flex-end; gap: 10px; }
.hud-mascot-observer { flex: 0 0 52px; width: 52px; height: 52px; border-radius: 50%; background: #2C3E50; display: flex; align-items: center; justify-content: center; }
.hud-mascot-observer ugo-mascot { width: 24px; color: #FFFFFF; }
.hud-say-text { padding: 14px 16px; border-radius: 22px 22px 22px 8px; background: #FBFAF8; color: #1F1D1A; font-size: 16px; line-height: 1.5; }
.live-actions-bar { display: flex; align-items: center; justify-content: center; gap: 16px; }
.live-round { width: 56px; height: 56px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.1); color: #FFFFFF; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.live-round:hover { background: rgba(255, 255, 255, 0.16); }
.live-main { height: 56px; padding: 0 28px; border-radius: 999px; border: 0; background: #FFFFFF; color: #1F1D1A; font-size: 16px; font-weight: 600; }
#view-live :focus-visible { outline-color: #F3A57E; }
.live-side { flex: 0 0 400px; background: var(--c-sheet); color: var(--c-text); padding: 28px; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; }
body.theme-contrast .live-side { border-left: 2px solid #000; }
.live-side-ugo { display: flex; align-items: center; gap: 16px; padding: 20px 24px; border-radius: 24px; background: var(--c-top); color: var(--c-on-top); font-size: 15px; font-weight: 600; }
body.theme-dark .live-side-ugo { border: 1px solid var(--c-border); }
body.theme-contrast .live-side-ugo { border: 2px solid #000; }
.live-side-ugo ugo-mascot { width: 52px; color: var(--c-on-top); flex: 0 0 auto; }
.live-detected-label { font-size: 14px; font-weight: 600; color: var(--c-text-2); margin-top: 8px; }
.live-detected-strip { display: flex; flex-wrap: wrap; gap: 6px; }
.detected-object-badge { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 999px; background: var(--c-surface); border: var(--c-bw) solid var(--c-border); font-size: 13px; }
.detected-object-badge i { display: none; }
.badge-confidence { color: var(--c-text-2); }
.detected-placeholder-text, .live-side-empty { font-size: 14px; color: var(--c-text-2); }
.live-side-foot { margin-top: auto; font-size: 13px; color: var(--c-text-2); }
.live-analysis-panel { display: flex; flex-direction: column; gap: 10px; }
.analysis-result-card, .analysis-loading-state, .analysis-error-state { background: var(--c-surface); border: var(--c-bw) solid var(--c-border); border-radius: 20px; padding: 14px; color: var(--c-text); }
.analysis-loading-state, .analysis-error-state { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.analysis-loading-state ugo-mascot { width: 56px; color: var(--c-primary); }
.analysis-loading-state h4, .analysis-error-state h4 { font-size: 15px; }
.analysis-loading-state p, .analysis-error-state p { font-size: 14px; color: var(--c-text-2); }
.analysis-card-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.analysis-title { font-size: 13px; font-weight: 600; color: var(--c-text-2); }
.icon-btn-ghost { width: 40px; height: 40px; border-radius: 12px; border: 0; background: transparent; color: var(--c-text-2); display: inline-flex; align-items: center; justify-content: center; }
.analysis-card-body { display: flex; flex-direction: column; gap: 10px; }
.analysis-snapshot-img { width: 100%; border-radius: 14px; display: block; }
.snapshot-badge-footer { font-size: 12px; color: var(--c-text-2); margin-top: 4px; }
.analysis-markdown-content { font-size: 15px; line-height: 1.6; }
.analysis-card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.analysis-card-actions .btn { min-height: 40px; font-size: 14px; padding: 0 14px; }
.analysis-card-actions i, .analysis-error-state i { display: none; }

@media (max-width: 768px) {
  #view-live.active { position: fixed; inset: 0; z-index: 80; }
  .live-layout { display: block; height: 100%; }
  .live-stage { position: absolute; inset: 0; padding: 0; gap: 0; }
  .live-viewport-box { border-radius: 0; flex: 1; }
  .hud-say { display: flex; bottom: 20px; }
  .live-actions-bar { padding: 20px 16px calc(32px + env(safe-area-inset-bottom, 0px)); background: var(--c-live); gap: 24px; }
  .live-side { position: absolute; left: 12px; right: 12px; bottom: 124px; max-height: 50%; padding: 0; background: transparent; display: none; }
  .live-has-analysis .live-side { display: flex; }
  .live-has-analysis .hud-say { display: none; }
  .live-side > :not(.live-analysis-panel) { display: none !important; }
}
@media (min-width: 769px) {
  .hud-say { display: none; }
  #live-close-btn { display: none; }
  .hud-top-bar { padding: 20px; }
}

/* ---------- Pagine con titolo (App, Galleria, Dove lavora Ugo) ---------- */
.page-narrow { max-width: 760px; margin: 0 auto; padding: 0 0 32px; display: flex; flex-direction: column; gap: 16px; }
.page-narrow > *:not(.page-head) { margin-left: 16px; margin-right: 16px; }
.page-narrow > .page-head { padding-bottom: 0; }
.page-title-block { padding: 24px 4px 0; display: flex; flex-direction: column; gap: 4px; }
.page-title-block h1 { font-size: 28px; font-weight: 700; }
.page-title-block p, .page-intro { font-size: 15px; color: var(--c-text-2); }
.page-intro { margin-top: -8px; padding: 0 4px; }
.list-section { display: flex; flex-direction: column; }
.list-card { border-radius: 22px; background: var(--c-surface); border: var(--c-bw) solid var(--c-border); overflow: hidden; }
.list-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-bottom: var(--c-bw) solid var(--c-divider); }
.list-row:last-child { border-bottom: 0; }
.list-row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.list-row-text strong { font-size: 16px; font-weight: 600; }
.list-row-text span { font-size: 13px; color: var(--c-text-2); overflow-wrap: anywhere; }
.mono-text { font-family: var(--font-mono); font-size: 12px !important; }
.list-empty { padding: 16px; font-size: 14px; color: var(--c-text-2); }
.app-mono { flex: 0 0 44px; width: 44px; height: 44px; border-radius: 14px; background: var(--c-top); color: var(--c-on-top); display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 700; }
body.theme-dark .app-mono { background: #2C3E50; color: #fff; }
body.theme-contrast .app-mono { border: 2px solid #000; }
.app-mono-light { flex-basis: 40px; width: 40px; height: 40px; border-radius: 12px; background: var(--c-chip) !important; color: var(--c-text-3) !important; font-size: 15px; }
.app-state { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; color: var(--c-link); }
.app-state .ic { width: 16px; height: 16px; }
.apps-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.app-tile { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 20px; background: var(--c-surface); border: var(--c-bw) solid var(--c-border); }
.app-tile-text { display: flex; flex-direction: column; gap: 2px; }
.app-tile-text strong { font-size: 15px; font-weight: 600; }
.app-tile-text span { font-size: 13px; line-height: 1.35; color: var(--c-text-2); }
.dashed-card {
  display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 20px; border: 1px dashed #B8B1A6; background: transparent; color: var(--c-text); text-align: left;
}
body.theme-dark .dashed-card { border-color: #5B6773; }
body.theme-contrast .dashed-card { border: 2px dashed #000; }
.dashed-card > span:last-child { display: flex; flex-direction: column; gap: 2px; }
.dashed-card strong { font-size: 15px; font-weight: 600; }
.dashed-card span span { font-size: 13px; color: var(--c-text-2); }
.dashed-card-ic { flex: 0 0 40px; width: 40px; height: 40px; border-radius: 12px; background: var(--c-chip); display: flex; align-items: center; justify-content: center; }

.gallery-group { display: flex; flex-direction: column; margin-bottom: 18px; }
.gallery-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.gallery-tile { aspect-ratio: 1; border-radius: 16px; overflow: hidden; border: var(--c-bw) solid var(--c-border); padding: 0; background: var(--c-primary-soft); }
.gallery-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }

.router-card { padding: 16px; border-radius: 20px; background: var(--c-top); color: var(--c-on-top); display: flex; flex-direction: column; gap: 6px; }
body.theme-dark .router-card { border: 1px solid var(--c-border); }
body.theme-contrast .router-card { border: 2px solid #000; }
.router-card-title { display: inline-flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 600; }
.router-card-title .ic { width: 18px; height: 18px; }
.router-card p { font-size: 14px; line-height: 1.5; color: var(--c-on-top-2); }
.policy-options { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.policy-options legend { padding: 0; }
.policy-option {
  display: flex; align-items: flex-start; gap: 14px; padding: 14px 16px; border-radius: 20px; background: var(--c-surface);
  border: var(--c-bw) solid var(--c-border); cursor: pointer;
}
.policy-option.is-checked { border: 2px solid var(--c-primary); padding: 13px 15px; }
body.theme-contrast .policy-option.is-checked { border-width: 4px; padding: 12px 14px; }
.policy-option input { accent-color: var(--c-primary); width: 20px; height: 20px; margin: 2px 0 0; flex: 0 0 auto; }
.policy-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.policy-text strong { font-size: 16px; font-weight: 600; }
.policy-text span { font-size: 13px; line-height: 1.4; color: var(--c-text-2); }
.policy-badge { font-size: 12px; font-weight: 600; color: var(--c-tag-work); padding: 3px 8px; border-radius: 999px; background: var(--c-tag-work-bg); white-space: nowrap; }
body.theme-contrast .policy-badge { border: 2px solid #000; }
.field-card { padding: 16px; border-radius: 20px; background: var(--c-surface); border: var(--c-bw) solid var(--c-border); display: flex; flex-direction: column; gap: 8px; }
.field-card-title { font-size: 15px; font-weight: 600; }
.field-card .select-field { min-height: 48px; padding: 0 12px; font-size: 15px; }
.field-hint { font-size: 13px; color: var(--c-text-2); }
.link-card { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 20px; background: var(--c-surface); border: var(--c-bw) solid var(--c-border); color: var(--c-text) !important; text-decoration: none !important; }
.link-card-ic { flex: 0 0 40px; width: 40px; height: 40px; border-radius: 12px; background: var(--c-top); color: var(--c-on-top); display: flex; align-items: center; justify-content: center; }
body.theme-dark .link-card-ic { background: #2C3E50; color: #fff; }
.link-card-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.link-card-text strong { font-size: 15px; font-weight: 600; }
.link-card-text span { font-size: 13px; color: var(--c-text-2); }
@media (min-width: 769px) {
  .page-narrow { padding: 28px 32px 40px; max-width: 840px; }
  .page-narrow > *:not(.page-head) { margin-left: 0; margin-right: 0; }
  .page-head { padding: 0; }
  .page-title-block { padding: 0; }
  .apps-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
}

/* ---------- Memoria ---------- */
.memory-layout { display: flex; flex-direction: column; gap: 12px; padding: 16px; }
.memory-hero { padding: 20px; border-radius: 24px; background: var(--c-top); color: var(--c-on-top); display: flex; gap: 16px; align-items: center; }
body.theme-dark .memory-hero { border: 1px solid var(--c-border); }
body.theme-contrast .memory-hero { border: 2px solid #000; }
.memory-hero-mascot { flex: 0 0 48px; width: 48px; color: var(--c-on-top); }
.memory-hero-text { display: flex; flex-direction: column; gap: 4px; }
.memory-hero h1 { font-size: 22px; font-weight: 700; }
.memory-hero p { font-size: 14px; line-height: 1.45; color: var(--c-on-top-2); }
.link-on-dark { color: var(--c-on-top); font-weight: 600; align-self: flex-start; display: none; }
.memory-card-panel { display: flex; flex-direction: column; gap: 10px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 0 4px; }
.panel-head h2 { font-size: 13px; font-weight: 600; color: var(--c-text-2); }
.memory-add-form, .mem-edit-form { padding: 6px 16px 16px; border-radius: 20px; background: var(--c-surface); border: 2px solid var(--c-primary); }
.memory-table-head { display: none; }
.memory-items-container { display: flex; flex-direction: column; gap: 10px; }
.memory-item-row { display: grid; grid-template-columns: 1fr 44px; align-items: center; column-gap: 12px; padding: 14px 8px 14px 16px; border-radius: 20px; background: var(--c-surface); border: var(--c-bw) solid var(--c-border); }
.memory-item-row.is-editing { padding: 0; border: 0; background: transparent; display: block; }
.mem-topic { grid-column: 1; grid-row: 1; font-size: 13px; color: var(--c-text-2); }
.mem-topic-none { display: none; }
.mem-text { grid-column: 1; grid-row: 2; font-size: 16px; font-weight: 500; overflow-wrap: anywhere; }
.mem-topic-none + .mem-text { grid-row: 1 / span 2; }
.mem-source, .mem-when { display: none; }
.mem-actions { grid-column: 2; grid-row: 1 / span 2; display: flex; justify-content: flex-end; }
.mem-actions .icon-btn .ic { width: 18px; height: 18px; }
.mem-actions .delete-mem-btn { display: none; }
@media (min-width: 769px) {
  .memory-layout { flex-direction: row; align-items: flex-start; gap: 20px; padding: 28px 32px; }
  .memory-hero { flex: 0 1 340px; flex-direction: column; align-items: flex-start; padding: 24px; gap: 14px; }
  .memory-hero-mascot { width: 84px; flex-basis: auto; margin: 18px 0 0 8px; }
  .memory-hero-text { gap: 14px; }
  .memory-hero h1 { font-size: 26px; }
  .memory-hero p { font-size: 15px; line-height: 1.55; }
  .link-on-dark { display: inline-flex; padding: 0; min-height: 32px; font-size: 14px; }
  .memory-card-panel { flex: 1 1 560px; min-width: 0; border-radius: 20px; background: var(--c-surface); border: var(--c-bw) solid var(--c-border); padding: 8px 8px 4px; gap: 0; }
  .panel-head { padding: 10px 12px; }
  .panel-head h2 { font-size: 16px; color: var(--c-text); }
  .memory-add-form { margin: 0 4px 10px; }
  .memory-table-head, .memory-item-row { display: grid; grid-template-columns: 1.1fr 1.6fr 1.4fr 0.8fr 92px; grid-template-rows: auto; align-items: center; gap: 0; }
  .memory-table-head { padding: 8px 0; font-size: 13px; font-weight: 600; color: var(--c-text-2); }
  .memory-table-head span, .mem-cell { padding: 0 12px; }
  .memory-items-container { gap: 0; }
  .memory-item-row { border: 0; border-top: var(--c-bw) solid var(--c-divider); border-radius: 0; padding: 14px 0; background: transparent; }
  .memory-item-row.is-editing { padding: 10px 4px; }
  .mem-topic, .mem-text, .mem-source, .mem-when, .mem-actions { grid-row: 1 !important; grid-column: auto; }
  .mem-topic { font-size: 14px; font-weight: 500; color: var(--c-text-2); }
  .mem-topic-none { display: block; }
  .mem-text { font-size: 15px; font-weight: 600; }
  .mem-source, .mem-when { display: block; font-size: 14px; color: var(--c-text-2); }
  .mem-actions { padding-right: 4px; }
  .mem-actions .delete-mem-btn { display: inline-flex; }
  .mem-actions .icon-btn { width: 36px; height: 36px; border-radius: 10px; }
  .memory-item-row { padding: 9px 0; min-height: 53px; }
}

/* ---------- Appunti ---------- */
.notes-layout { display: flex; min-height: 100%; }
.notes-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 12px; padding: 24px 16px 96px; }
.notes-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 0 4px; }
.notes-head h1 { font-size: 28px; font-weight: 700; flex: 1; }
.notes-count { font-size: 14px; color: var(--c-text-2); }
.notes-search { flex: 1 1 100%; order: 3; margin: 4px -4px 0; }
.notes-dictate { display: none; }
.notes-new {
  position: fixed; right: 16px; bottom: 96px; z-index: 65; height: 56px; padding: 0 20px; box-shadow: var(--c-shadow-fab);
}
.notes-grid-display { columns: 2; column-gap: 10px; }
.notes-grid-display > .empty-state { column-span: all; }
.note-card {
  break-inside: avoid; width: 100%; margin: 0 0 10px; display: flex; flex-direction: column; align-items: flex-start; gap: 8px;
  padding: 16px; border-radius: 20px; background: var(--c-surface); border: var(--c-bw) solid var(--c-border); color: var(--c-text); text-align: left;
}
.note-card:hover { border-color: var(--c-chip-border); }
.note-card.is-voice { background: #2C3E50; border-color: #2C3E50; color: #FFFFFF; }
body.theme-contrast .note-card.is-voice { background: #000; border-color: #000; }
.note-card.is-selected { border: 2px solid var(--c-primary); padding: 15px; }
body.theme-dark .note-card.is-voice.is-selected { border-color: var(--c-primary); }
.note-tag-chip { padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
body.theme-contrast .note-tag-chip { border: 2px solid #000; }
.tag-lavoro { background: var(--c-tag-work-bg); color: var(--c-tag-work); }
.tag-idee { background: var(--c-tag-idea-bg); color: var(--c-tag-idea); }
.tag-generale { background: var(--c-tag-gen-bg); color: var(--c-tag-gen); }
.tag-personale { background: var(--c-tag-pers-bg); color: var(--c-tag-pers); }
.note-badge-voice { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: #C9D3DC; }
body.theme-contrast .note-badge-voice { color: #fff; }
.note-badge-voice .ic { width: 14px; height: 14px; }
.note-card-title { font-size: 16px; font-weight: 600; line-height: 1.3; }
.note-card-body { font-size: 14px; line-height: 1.45; color: var(--c-text-2); display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.note-card.is-voice .note-card-body, .note-card.is-voice .note-card-date { color: #C9D3DC; }
body.theme-contrast .note-card.is-voice .note-card-body, body.theme-contrast .note-card.is-voice .note-card-date { color: #fff; }
.note-card-date { font-size: 12px; color: var(--c-text-2); }

.note-editor { display: none; flex-direction: column; gap: 16px; background: var(--c-sheet); color: var(--c-text); }
.note-editor-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.note-tags { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.note-tag { min-height: 32px; padding: 0 10px; border-radius: 999px; border: 2px solid transparent; font-size: 12px; font-weight: 600; opacity: 0.75; }
.note-tag[aria-checked="true"] { opacity: 1; border-color: currentColor; }
body.theme-contrast .note-tag { opacity: 1; border: 1px solid #000; }
body.theme-contrast .note-tag[aria-checked="true"] { border-width: 3px; }
.note-modified { font-size: 13px; color: var(--c-text-2); order: 5; flex: 1 0 100%; }
.note-title-input { border: 0; outline: none; background: transparent; font-size: 24px; font-weight: 700; color: var(--c-text); padding: 0; width: 100%; }
.note-body-input { flex: 1; min-height: 200px; resize: none; border: 0; outline: none; background: transparent; font-size: 16px; line-height: 1.65; color: var(--c-text); padding: 0; }
.note-title-input:focus-visible, .note-body-input:focus-visible { outline: 3px solid var(--c-focus); outline-offset: 4px; border-radius: 6px; }
.note-ask { margin-top: auto; padding: 16px; border-radius: 20px; background: var(--c-surface); border: var(--c-bw) solid var(--c-border); display: flex; flex-direction: column; gap: 10px; }
.note-ask-head { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 600; }
.note-ask-ugo { width: 36px; height: 36px; border-radius: 50%; background: var(--c-top); display: flex; align-items: center; justify-content: center; }
body.theme-dark .note-ask-ugo { background: #2C3E50; }
.note-ask-ugo ugo-mascot { width: 18px; color: var(--c-on-top); }
body.theme-dark .note-ask-ugo ugo-mascot { color: #fff; }
.note-ask-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.note-ask-actions .chip-btn { min-height: 40px; }
.note-editor-empty { display: none; color: var(--c-text-2); font-size: 15px; }
.note-editor.is-empty > :not(.note-editor-empty) { display: none; }
.note-editor.is-empty .note-editor-empty { display: block; margin: auto 0; text-align: center; }
#note-editor-back { display: none; }
@media (max-width: 768px) {
  .app-container.note-open .note-editor {
    display: flex; position: fixed; inset: 0; z-index: 75; padding: 20px 16px calc(20px + env(safe-area-inset-bottom, 0px)); overflow-y: auto;
  }
  #note-editor-back { display: inline-flex; }
  .note-tags { order: 3; flex: 1 0 100%; }
  .note-editor-top { justify-content: space-between; }
  .app-container.note-open .notes-new, #view-notes.notes-empty .notes-new { display: none; }
  .empty-notes { min-height: calc(100vh - 330px); justify-content: center; }
}
@media (min-width: 769px) {
  .notes-main { padding: 28px 32px; gap: 18px; }
  .notes-head { padding: 0; }
  .notes-count { display: none; }
  .notes-search { order: 0; flex: 0 1 280px; height: 44px; margin: 0; }
  .notes-search input { font-size: 15px; }
  .notes-dictate { display: inline-flex; }
  .notes-dictate.is-on { background: var(--c-primary); color: var(--c-on-primary); border-color: var(--c-primary); }
  .notes-new { position: static; height: 44px; box-shadow: none; }
  .notes-grid-display { columns: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; align-items: stretch; }
  .notes-grid-display > .empty-state { grid-column: 1 / -1; }
  .note-card { margin: 0; }
  .note-editor { display: flex; flex: 0 0 420px; position: sticky; top: 0; align-self: flex-start; height: 100vh; border-left: var(--c-bw) solid var(--c-border); padding: 28px; overflow-y: auto; }
  .note-tags { flex: 1; }
}

/* ---------- Altro e impostazioni ---------- */
.settings-layout { display: flex; min-height: 100%; }
.settings-subnav { display: none; }
.settings-workspace-list { flex: 1; min-width: 0; padding: 24px 16px 20px; display: flex; flex-direction: column; gap: 18px; }
.settings-mobile-title { font-size: 28px; font-weight: 700; margin: 0 4px; }
.settings-group { display: flex; flex-direction: column; gap: 8px; scroll-margin-top: 24px; }
.settings-group-title { margin: 0 4px; font-size: 13px; font-weight: 600; color: var(--c-text-2); }
.profile-card { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 22px; background: var(--c-top); color: var(--c-on-top); border: var(--c-bw) solid var(--c-top); width: 100%; text-align: left; }
body.theme-dark .profile-card { background: #2C3E50; border-color: #2C3E50; color: #fff; }
body.theme-dark .profile-hero-badge, body.theme-dark .profile-hero-email { color: #C9D3DC !important; }
body.theme-contrast .profile-card { border-color: #000; }
.profile-hero-avatar { flex: 0 0 48px; width: 48px; height: 48px; border-radius: 50%; background: #FBFAF8; color: #2C3E50; display: flex; align-items: center; justify-content: center; font-size: 17px; font-weight: 700; }
body.theme-contrast .profile-hero-avatar { background: #fff; border: 2px solid #000; color: #000; }
.profile-hero-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.profile-hero-name { font-size: 17px; font-weight: 600; }
.profile-hero-badge { font-size: 13px; color: var(--c-on-top-2); }
.profile-hero-email { display: none; font-size: 13px; color: var(--c-on-top-2); }
.tool-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tool-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 16px; border-radius: 20px; background: var(--c-surface); border: var(--c-bw) solid var(--c-border); color: var(--c-text); font-size: 15px; font-weight: 600; text-align: left; }
.tool-tile:hover { border-color: var(--c-chip-border); }
.theme-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding: 6px; border-radius: 18px; background: var(--c-chip); }
body.theme-contrast .theme-tiles { border: 2px solid #000; }
.theme-tile { min-height: 44px; border-radius: 13px; border: 0; background: transparent; color: var(--c-text); display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 500; padding: 0 6px; }
.theme-tile[aria-checked="true"] { background: var(--c-surface); font-weight: 600; }
body.theme-contrast .theme-tile[aria-checked="true"] { outline: 2px solid #000; outline-offset: -2px; }
.theme-preview { display: none; }
.theme-name { display: inline-flex; align-items: center; gap: 6px; }
.theme-radio { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--c-text-2); display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.theme-tile[aria-checked="true"] .theme-radio { border-color: var(--c-primary); }
.theme-tile[aria-checked="true"] .theme-radio::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c-primary); }
.tn-long { display: none; }
.settings-rows { border-radius: 22px; background: var(--c-surface); border: var(--c-bw) solid var(--c-border); overflow: hidden; }
.theme-tiles + .settings-rows { margin-top: 8px; }
.settings-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 56px; padding: 10px 16px;
  border: 0; border-bottom: var(--c-bw) solid var(--c-divider); background: transparent; color: var(--c-text) !important; text-align: left; text-decoration: none !important; font-size: 15px; cursor: default;
}
.settings-row:last-child { border-bottom: 0; }
label.settings-row, button.settings-row, a.settings-row { cursor: pointer; }
button.settings-row:hover, a.settings-row:hover { background: var(--c-page); }
.settings-row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.settings-item-title { font-size: 15px; }
.settings-item-subtitle { font-size: 13px; color: var(--c-text-2); }
.settings-row-wrap { flex-wrap: wrap; }
.row-value { display: inline-flex; align-items: center; gap: 6px; color: var(--c-text-2); font-size: 14px; white-space: nowrap; }
.row-value .ic { width: 16px; height: 16px; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.row-select { position: relative; display: inline-flex; align-items: center; gap: 6px; color: var(--c-text-2); font-size: 14px; }
.row-select select { appearance: none; -webkit-appearance: none; border: 0; background: transparent; color: var(--c-text-2); font-size: 14px; text-align: right; padding: 12px 0; min-height: 44px; max-width: 180px; cursor: pointer; }
.row-select select:focus-visible { outline: 3px solid var(--c-focus); border-radius: 6px; }
.row-select select option { color: #1F1D1A; background: #fff; }
.row-select .ic { width: 16px; height: 16px; pointer-events: none; }
.badge-status-online, .badge-status-offline { font-size: 13px; color: var(--c-text-2); }
.settings-version { font-size: 13px; color: var(--c-text-2); text-align: center; margin-top: 4px; }
@media (min-width: 769px) {
  .settings-subnav {
    display: flex; flex-direction: column; gap: 6px; flex: 0 0 260px; padding: 28px 16px; border-right: var(--c-bw) solid var(--c-border);
    position: sticky; top: 0; height: 100vh;
  }
  .settings-subnav h1 { font-size: 28px; font-weight: 700; margin: 0 14px 14px; }
  .subnav-link { display: flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 12px; color: var(--c-text) !important; text-decoration: none !important; font-size: 15px; }
  .subnav-link:hover { background: var(--c-chip); }
  .subnav-link[aria-current="true"] { background: var(--c-surface); font-weight: 600; box-shadow: inset 0 0 0 var(--c-bw) var(--c-border); }
  .settings-subnav .settings-version { margin-top: auto; text-align: left; padding: 0 14px; }
  .settings-mobile-title, .tool-tiles, .settings-version-mobile { display: none; }
  .settings-workspace-list { padding: 28px 40px 60px; max-width: 980px; gap: 20px; }
  .settings-group { padding: 28px 24px 8px; border-radius: 24px; background: var(--c-surface); border: var(--c-bw) solid var(--c-border); gap: 0; scroll-margin-top: 28px; }
  .settings-group-title { font-size: 18px; font-weight: 600; color: var(--c-text); margin: 0 0 16px; }
  .settings-rows { border: 0; border-radius: 0; background: transparent; }
  .settings-rows .settings-row { padding: 16px 0; border-bottom: var(--c-bw) solid var(--c-divider); }
  .settings-rows .settings-row:first-child { border-top: var(--c-bw) solid var(--c-divider); }
  .settings-group > .settings-rows .settings-row:last-child { border-bottom: 0; }
  .settings-item-title { font-weight: 600; }
  button.settings-row:hover, a.settings-row:hover { background: transparent; }
  button.settings-row:hover .settings-item-title, a.settings-row:hover .settings-item-title { text-decoration: underline; }
  #set-account { padding-bottom: 24px; order: 3; }
  #set-appearance { order: 1; }
  #set-voice { order: 2; }
  #set-privacy { order: 4; }
  #set-about { order: 5; }
  .profile-hero-email { display: block; }
  .theme-tiles { gap: 12px; padding: 0; background: transparent; border: 0 !important; margin-bottom: 16px; }
  .theme-tile { flex-direction: column; align-items: stretch; gap: 10px; padding: 12px; border-radius: 16px; border: var(--c-bw) solid var(--c-border); background: var(--c-surface); min-height: 0; }
  .theme-tile[aria-checked="true"] { border: 2px solid var(--c-primary); padding: 11px; }
  body.theme-contrast .theme-tile[aria-checked="true"] { outline: 0; border-width: 4px; padding: 9px; }
  .theme-preview { display: flex; height: 112px; border-radius: 12px; overflow: hidden; border: 1px solid var(--c-border); }
  .tp-panel { flex: 0 0 38%; display: flex; align-items: center; justify-content: center; }
  .tp-ring { width: 34px; height: 34px; border-radius: 50%; border: 5px solid; }
  .tp-body { flex: 1; display: flex; flex-direction: column; gap: 6px; padding: 14px 12px; }
  .tp-body span { height: 6px; border-radius: 3px; width: 80%; }
  .tp-body span:nth-child(2) { width: 55%; }
  .tp-body .tp-btn { margin-top: auto; height: 16px; width: 62%; border-radius: 8px; }
  .tp-light .tp-panel { background: #2C3E50; } .tp-light .tp-ring { border-color: #fff; } .tp-light .tp-body { background: #FBFAF8; }
  .tp-light .tp-body span { background: #2C3E50; } .tp-light .tp-body span:nth-child(2) { background: #A8A29E; }
  .tp-dark .tp-panel { background: #10161C; } .tp-dark .tp-ring { border-color: #ECEAE6; } .tp-dark .tp-body { background: #1B2229; }
  .tp-dark .tp-body span { background: #A8B0B8; } .tp-dark .tp-body span:nth-child(2) { background: #5B6773; } .tp-dark .tp-body .tp-btn { background: #10161C; }
  .tp-contrast { border: 2px solid #000 !important; }
  .tp-contrast .tp-panel { background: #F06522; } .tp-contrast .tp-ring { border-color: #000; } .tp-contrast .tp-body { background: #fff; }
  .tp-contrast .tp-body span { background: #000; } .tp-contrast .tp-body span:nth-child(2) { background: #555; } .tp-contrast .tp-body .tp-btn { background: #F06522; }
  .theme-name { font-size: 15px; font-weight: 600; justify-content: flex-start; }
  .tn-long { display: inline; } .tn-short { display: none; }
}

/* ---------- Stati vuoti ---------- */
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 48px 16px; }
.empty-state-sm { padding: 24px 16px; }
.empty-ugo { width: 120px; height: 120px; border-radius: 50%; background: var(--c-chip); color: var(--c-primary); display: flex; align-items: center; justify-content: center; margin-bottom: 12px; }
body.theme-contrast .empty-ugo { border: 2px solid #000; }
.empty-state-sm .empty-ugo { width: 80px; height: 80px; }
.empty-ugo ugo-mascot { width: 56px; color: var(--c-primary); }
.empty-state-sm .empty-ugo ugo-mascot { width: 40px; }
.empty-title { font-size: 20px; font-weight: 700; }
.empty-sub { font-size: 15px; color: var(--c-text-2); max-width: 320px; line-height: 1.5; }
.empty-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 10px; }

/* ---------- Finestre ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 100; background: var(--c-scrim); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-box { background: var(--c-sheet); color: var(--c-text); border-radius: 28px; box-shadow: var(--c-shadow); width: 100%; max-width: 480px; max-height: calc(100vh - 32px); overflow-y: auto; }
body.theme-contrast .modal-box, body.theme-contrast .sheet, body.theme-contrast .duo-modal-card { border: 2px solid #000; }

/* Accesso */
.access-backdrop { padding: 0; background: var(--c-top); }
.access-screen { position: relative; width: 100%; height: 100%; display: flex; flex-direction: column; background: var(--c-top); color: var(--c-on-top); overflow-y: auto; }
.access-close { position: absolute; top: 20px; right: 16px; }
.access-hero { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 40px 28px 28px; text-align: center; }
.access-hero ugo-mascot { width: 120px; color: var(--c-on-top); margin-bottom: 8px; }
.access-title { font-size: 30px; font-weight: 700; }
.access-sub { font-size: 16px; line-height: 1.5; color: var(--c-on-top-2); max-width: 360px; }
.access-sheet { background: var(--c-sheet); color: var(--c-text); border-radius: 28px 28px 0 0; padding: 28px 20px calc(24px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 14px; }
body.theme-contrast .access-sheet { border-top: 2px solid #000; }
.access-sheet h2 { font-size: 18px; font-weight: 600; }
.access-text { font-size: 14px; line-height: 1.5; color: var(--c-text-2); }
.access-later { align-self: center; }
.access-foot { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 13px; color: var(--c-text-2); }
.access-foot .ic { width: 16px; height: 16px; }
.usso-modal-label { font-size: 13px; font-weight: 600; color: var(--c-text-2); margin-bottom: 6px; }
@media (min-width: 769px) {
  .access-backdrop { padding: 16px; background: var(--c-scrim); }
  .access-screen { max-width: 440px; height: auto; max-height: calc(100vh - 32px); border-radius: 28px; overflow: hidden; }
  .access-hero { padding: 48px 28px 32px; }
}

/* Visualizzatore */
.viewer-backdrop { padding: 0; background: var(--c-live); }
.viewer-screen { width: 100%; height: 100%; display: flex; flex-direction: column; color: #FFFFFF; }
.viewer-head { display: flex; align-items: center; gap: 12px; padding: 20px 16px; }
.viewer-head .panel-sq { background: rgba(255, 255, 255, 0.1); color: #fff; border: 0; text-decoration: none; }
.viewer-title-block { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.viewer-title { font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer-sub { font-size: 13px; color: #C9D3DC; }
.viewer-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 8px 24px; }
.viewer-stage img { max-width: 100%; max-height: 100%; border-radius: 6px; background: #fff; object-fit: contain; }
.viewer-ask { margin: 12px 16px calc(24px + env(safe-area-inset-bottom, 0px)); align-self: center; width: calc(100% - 32px); max-width: 420px; min-height: 52px; border-radius: 999px; border: 0; background: #FBFAF8; color: #1F1D1A; font-size: 16px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 10px; }
.viewer-ask-ugo { color: #2C3E50; display: inline-flex; }
.viewer-ask-ugo .ic-ugo { width: 15px; height: 19px; }
.viewer-backdrop :focus-visible { outline-color: #F3A57E; }

/* Fogli in basso: server MCP, esporta */
.sheet-backdrop { align-items: flex-end; padding: 0; }
.sheet {
  width: 100%; max-width: 560px; max-height: calc(100vh - 60px); display: flex; flex-direction: column;
  background: var(--c-sheet); color: var(--c-text); border-radius: 28px 28px 0 0; box-shadow: var(--c-shadow);
}
.sheet-grip { align-self: center; width: 40px; height: 4px; border-radius: 2px; background: var(--c-chip-border); margin-top: 12px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px 4px; }
.sheet-title { font-size: 22px; font-weight: 700; }
.sheet-body { padding: 4px 20px 8px; overflow-y: auto; display: flex; flex-direction: column; }
.sheet-text { font-size: 15px; line-height: 1.5; color: var(--c-text-2); margin-top: 8px; }
.sheet-note { font-size: 13px; line-height: 1.5; color: var(--c-text-2); margin-top: 14px; }
.sheet-foot { padding: 12px 20px calc(24px + env(safe-area-inset-bottom, 0px)); }
.mcp-result { margin-top: 14px; padding: 16px; border-radius: 20px; background: var(--c-surface); border: var(--c-bw) solid var(--c-border); display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.mcp-result strong { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; }
.mcp-result.is-error { flex-direction: row; gap: 10px; color: var(--c-danger); background: var(--c-danger-bg); }
.mcp-result.is-error .ic { margin-top: 2px; }
.mcp-bar { display: block; height: 6px; border-radius: 3px; background: var(--c-chip); overflow: hidden; }
.mcp-bar span { display: block; height: 100%; width: 40%; border-radius: 3px; background: var(--c-primary); animation: mcp-bar 1.2s ease-in-out infinite alternate; }
@keyframes mcp-bar { from { margin-left: 0; } to { margin-left: 60%; } }
.mcp-tools { list-style: none; margin: 0; padding: 0; font-family: var(--font-mono); font-size: 13px; line-height: 1.8; }
.share-preview { padding: 14px 16px; border-radius: 20px; background: var(--c-surface); border: var(--c-bw) solid var(--c-border); display: flex; flex-direction: column; gap: 6px; font-size: 15px; line-height: 1.45; margin-top: 8px; }
.share-preview-title { font-size: 13px; font-weight: 600; color: var(--c-text-2); }
.share-formats { border: 0; margin: 0; padding: 0; }
.share-format-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.share-format { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 70px; padding: 8px; border-radius: 16px; border: var(--c-bw) solid var(--c-border); background: var(--c-surface); font-size: 14px; font-weight: 600; text-align: center; cursor: pointer; }
.share-format input { accent-color: var(--c-primary); width: 16px; height: 16px; margin: 0; }
.share-format:has(input:checked) { border: 2px solid var(--c-primary); }
body.theme-contrast .share-format:has(input:checked) { border-width: 4px; }
.share-format:focus-within { outline: 3px solid var(--c-focus); outline-offset: 2px; }
.option-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; padding: 14px 16px; border-radius: 20px; background: var(--c-surface); border: var(--c-bw) solid var(--c-border); cursor: pointer; }
.option-card > span { display: flex; flex-direction: column; gap: 2px; }
.option-card strong { font-size: 15px; font-weight: 600; }
.option-card span span { font-size: 13px; color: var(--c-text-2); }
@media (min-width: 769px) {
  .sheet-backdrop { align-items: center; padding: 16px; }
  .sheet { border-radius: 28px; }
}

/* Porta Ugo sul telefono */
.modal-pwa-box { max-width: 760px; display: flex; gap: 28px; padding: 28px; }
.pwa-main { flex: 1; display: flex; flex-direction: column; gap: 14px; }
.pwa-top { display: flex; align-items: center; justify-content: space-between; }
.pwa-app-icon { width: 64px; height: 64px; border-radius: 16px; background: #2C3E50; color: #FFFFFF; display: flex; align-items: center; justify-content: center; }
.pwa-app-icon .ic-ugo { width: 26px; height: 32px; }
.pwa-title { font-size: 26px; font-weight: 700; }
.pwa-text { font-size: 16px; line-height: 1.55; color: var(--c-text-3); }
.pwa-points { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; font-size: 15px; }
.pwa-points li { display: flex; align-items: center; gap: 10px; }
.pwa-points .ic { width: 16px; height: 16px; }
.pwa-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.pwa-hint { font-size: 13px; color: var(--c-text-2); }
.pwa-qr-box { flex: 0 0 262px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 20px; border-radius: 20px; background: var(--c-surface); border: var(--c-bw) solid var(--c-border); text-align: center; }
.pwa-qr { width: 170px; height: 170px; }
.pwa-qr svg { width: 100%; height: 100%; display: block; border-radius: 8px; }
.pwa-qr-box p { font-size: 14px; color: var(--c-text-2); }
@media (max-width: 768px) {
  .modal-pwa-box { flex-direction: column; padding: 24px 20px; }
  .pwa-qr-box { display: none; }
}

/* Chat Duo: nuova chat e invito */
.duo-modal-overlay { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; }
.duo-modal-backdrop { position: absolute; inset: 0; background: var(--c-scrim); }
.duo-modal-card { position: relative; width: 100%; max-width: 480px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; background: var(--c-page); color: var(--c-text); border-radius: 28px; box-shadow: var(--c-shadow); }
.duo-modal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 16px 4px 20px; }
.duo-modal-title { font-size: 22px; font-weight: 700; }
.duo-modal-body { flex: 1; overflow-y: auto; padding: 8px 16px 16px; display: flex; flex-direction: column; gap: 14px; }
.duo-intro { display: flex; align-items: center; gap: 12px; padding: 14px 16px 14px 8px; border-radius: 20px; background: var(--c-top); color: var(--c-on-top); }
body.theme-dark .duo-intro { background: #2C3E50; color: #fff; }
body.theme-contrast .duo-intro { border: 2px solid #000; }
.duo-intro-ugo { flex: 0 0 64px; display: flex; justify-content: center; }
.duo-intro-ugo ugo-mascot { width: 46px; color: currentColor; }
.duo-modal-subtitle { font-size: 14px; line-height: 1.5; }
.duo-form-group { padding: 16px; border-radius: 20px; background: var(--c-surface); border: var(--c-bw) solid var(--c-border); display: flex; flex-direction: column; gap: 10px; margin: 0; min-width: 0; }
.duo-form-label { font-size: 15px; font-weight: 600; padding: 0; }
.duo-who legend { float: left; width: 100%; margin-bottom: 10px; }
.duo-who .duo-participants-grid { clear: both; }
.duo-mention-input-row { display: flex; align-items: center; gap: 8px; height: 50px; padding: 0 6px 0 14px; border-radius: 14px; border: var(--c-bw) solid var(--c-chip-border); background: var(--c-sheet); }
.duo-mention-input-row:focus-within { outline: 3px solid var(--c-focus); outline-offset: 2px; }
.duo-at-icon { font-size: 17px; font-weight: 600; color: var(--c-text-2); }
.duo-mention-field { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font-size: 16px; color: var(--c-text); }
.duo-mention-btn { min-height: 38px; height: 38px; padding: 0 14px; border-radius: 10px; font-size: 14px; }
.duo-mention-resolved-card { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: var(--c-duo2-bg); border: var(--c-bw) solid var(--c-duo2-border); }
.duo-resolved-avatar { flex: 0 0 36px; width: 36px; height: 36px; border-radius: 50%; background: var(--c-duo2); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; }
.duo-resolved-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.duo-resolved-name { font-size: 15px; font-weight: 600; color: var(--c-duo2-text); }
.duo-resolved-id { font-size: 13px; color: var(--c-duo2-sub); }
.duo-resolved-ok { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; color: var(--c-duo2-sub); }
.duo-resolved-ok .ic { width: 14px; height: 14px; }
.duo-hint-text { font-size: 13px; line-height: 1.45; color: var(--c-text-2); }
.duo-share-box { display: flex; gap: 8px; }
.duo-share-input { flex: 1; min-width: 0; height: 48px; padding: 0 14px; border-radius: 14px; border: var(--c-bw) solid var(--c-chip-border); background: var(--c-sheet); font-size: 15px; color: var(--c-text-3); }
.duo-copy-btn { height: 48px; border-radius: 14px; }
.duo-sync-status-row { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--c-text-2); }
.duo-sync-status-row .ic { width: 16px; height: 16px; }
.duo-participants-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.duo-participant-card { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 14px; border: var(--c-bw) solid var(--c-border); background: var(--c-surface); min-width: 0; }
.user1-card { border-color: var(--c-duo1-border); }
.user2-card { border-color: var(--c-duo2-border); }
.user1-card:has(input[type=radio]:checked) { border: 2px solid var(--c-duo1); background: var(--c-duo1-bg); padding: 11px; }
.user2-card:has(input[type=radio]:checked) { border: 2px solid var(--c-duo2); background: var(--c-duo2-bg); padding: 11px; }
body.theme-contrast .duo-participant-card:has(input[type=radio]:checked) { border-width: 4px; padding: 9px; }
.duo-participant-card input[type=radio] { margin: 0; width: 18px; height: 18px; flex: 0 0 auto; }
.user1-card input[type=radio] { accent-color: var(--c-duo1); }
.user2-card input[type=radio] { accent-color: var(--c-duo2); }
.duo-participant-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.duo-name-input { width: 100%; border: 0; border-bottom: 1px dashed transparent; background: transparent; font-size: 15px; font-weight: 600; padding: 2px 0; min-height: 28px; }
.user1-card .duo-name-input { color: var(--c-duo1-text); }
.user2-card .duo-name-input { color: var(--c-duo2-text); }
.duo-name-input:hover { border-bottom-color: var(--c-text-2); }
.duo-name-input:focus-visible { outline: 2px solid var(--c-focus); outline-offset: 2px; border-radius: 4px; }
.duo-role-badge { font-size: 12px; }
.user1-card .duo-role-badge { color: var(--c-duo1-sub); }
.user2-card .duo-role-badge { color: var(--c-duo2-sub); }
.duo-checkbox-label { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-radius: 20px; background: var(--c-surface); border: var(--c-bw) solid var(--c-border); cursor: pointer; }
.duo-checkbox-label > span { display: flex; flex-direction: column; gap: 2px; }
.duo-checkbox-label strong { font-size: 15px; font-weight: 600; }
.duo-checkbox-label span span { font-size: 13px; color: var(--c-text-2); }
.duo-disable { align-self: center; color: var(--c-danger); }
.duo-modal-footer { padding: 12px 16px 24px; border-top: var(--c-bw) solid var(--c-border); background: var(--c-page); border-radius: 0 0 28px 28px; }
@media (max-width: 768px) {
  .duo-modal-card { max-width: none; max-height: none; height: 100%; border-radius: 0; }
  .duo-modal-footer { border-radius: 0; padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }
}

/* Teatro */
.ugo-theater-overlay { position: fixed; inset: 0; z-index: 110; display: flex; align-items: center; justify-content: center; }
.ugo-theater-backdrop { position: absolute; inset: 0; background: var(--c-scrim); }
.ugo-theater-stage-container { position: relative; width: 100%; max-width: 420px; height: min(844px, calc(100vh - 32px)); }
.ugo-theater-stage { height: 100%; display: flex; flex-direction: column; background: var(--c-top); color: var(--c-on-top); border-radius: 28px; overflow: hidden; }
body.theme-dark .ugo-theater-stage { background: #2C3E50; color: #fff; }
body.theme-contrast .ugo-theater-stage { border: 2px solid #000; }
.theater-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 16px 0 20px; }
.ugo-theater-title { font-size: 20px; font-weight: 700; }
.theater-scene { flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding: 0 24px 40px; min-height: 0; }
.ugo-speech-bubble { position: absolute; top: 28px; left: 32px; right: 32px; padding: 14px 18px; border-radius: 22px; background: #FBFAF8; color: #1F1D1A; font-size: 16px; line-height: 1.45; text-align: center; }
body.theme-contrast .ugo-speech-bubble { border: 2px solid #000; background: #fff; color: #000; }
.ugo-hero-avatar-wrapper { position: relative; display: flex; align-items: center; justify-content: center; width: 220px; height: 240px; }
.ugo-aura-ring { position: absolute; width: 210px; height: 210px; border-radius: 50%; border: 3px solid var(--c-accent); opacity: 0; transition: opacity 0.3s ease; }
.ugo-theater-overlay[data-act="power"] .ugo-aura-ring { opacity: 1; animation: ugo-aura 1.4s ease-in-out infinite; }
@keyframes ugo-aura { 50% { transform: scale(1.06); } }
.ugo-zzz-container { position: absolute; top: 20px; right: 20px; }
#ugo-theater-mascot { width: 150px; color: currentColor; }
.ugo-theater-overlay[data-act="rocket"] #ugo-theater-mascot { animation: ugo-rocket 1.6s ease-in-out; }
@keyframes ugo-rocket { 40% { transform: translateY(-140px); opacity: 0; } 41% { transform: translateY(140px); opacity: 0; } 100% { transform: translateY(0); opacity: 1; } }
.theater-floor { width: 220px; height: 22px; border-radius: 50%; background: rgba(255, 255, 255, 0.08); margin-top: -6px; }
body.theme-contrast .theater-floor { background: rgba(0, 0, 0, 0.15); }
.ugo-theater-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; background: var(--c-sheet); color: var(--c-text); border-radius: 28px 28px 0 0; padding: 18px 16px 24px; max-height: 50%; overflow-y: auto; }
body.theme-contrast .ugo-theater-actions { border-top: 2px solid #000; }
.ugo-act-btn { display: flex; align-items: center; gap: 10px; height: 50px; padding: 0 14px; border-radius: 16px; border: var(--c-bw) solid var(--c-border); background: var(--c-surface); color: var(--c-text); font-size: 15px; font-weight: 600; text-align: left; }
.ugo-act-btn.active { background: var(--c-primary); border-color: var(--c-primary); color: var(--c-on-primary); }
@media (max-width: 768px) {
  .ugo-theater-stage-container { max-width: none; height: 100%; }
  .ugo-theater-stage { border-radius: 0; }
}

/* Avviso breve */
.ugo-toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 200; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  display: inline-flex; align-items: center; gap: 8px; max-width: calc(100vw - 32px); padding: 12px 18px; border-radius: 999px;
  background: var(--c-primary); color: var(--c-on-primary); font-size: 14px; font-weight: 600; box-shadow: var(--c-shadow); transition: opacity 0.2s ease, transform 0.2s ease;
}
.ugo-toast.show { opacity: 1; transform: translate(-50%, 0); }
.ugo-toast .ic { width: 16px; height: 16px; }
@media (max-width: 768px) { .ugo-toast { bottom: 110px; } }

/* App installata: rispetta le aree sicure */
@media (display-mode: standalone) and (max-width: 768px) {
  .ugo-panel, .page-head, .chat-head { padding-top: max(20px, env(safe-area-inset-top, 0px)); }
}

/* Stampa della chat (Esporta in PDF) */
@media print {
  body { overflow: visible; background: #fff; color: #000; }
  .rail, .sidebar, .ugo-panel, .chat-head-actions, #chat-back-btn, .chat-head-ugo, .duo-strip, .home-recent, .home-controls, .home-type-row,
  .sheet-handle, .input-dock-wrapper, .duo-session-bar, .offline-banner, .chat-welcome-container, .msg-footer-bar, .typing-bar,
  .modal-backdrop, .duo-modal-overlay, .ugo-theater-overlay, .ugo-toast, .msg-failed-note, .msg-inline-actions { display: none !important; }
  .workspace-view { display: none !important; }
  #view-chat { display: block !important; height: auto !important; }
  .app-container, .main-workspace, .chat-layout, .chat-column { display: block !important; height: auto !important; overflow: visible !important; padding: 0 !important; border: 0 !important; background: #fff !important; }
  .chat-head { display: flex !important; padding: 0 0 16px !important; border: 0 !important; }
  .chat-thread-container { display: block !important; overflow: visible !important; padding: 0 !important; }
  .msg-meta-bar { display: flex !important; }
  .msg-time-stamp.sr-only { position: static !important; width: auto; height: auto; clip: auto; margin: 0 0 0 6px; font-size: 11px; color: #555; }
  body.print-no-times .msg-time-stamp { display: none !important; }
  .msg-bubble { background: #fff !important; color: #000 !important; border: 1px solid #999 !important; }
  .message-row { break-inside: avoid; }
}

/* Meno movimento: dal dispositivo o dall'impostazione «Riduci le animazioni» */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
html.reduce-motion *, html.reduce-motion *::before, html.reduce-motion *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }

/* Aree di tocco di almeno 44 px anche per i controlli piccoli dei mockup */
.pill, .chip-btn, .sensor-chip, .note-tag, .duo-speaker-pill, .msg-action-btn, .chat-action-icon, .round-btn, .icon-btn-ghost, .icon-btn-sm, .mem-actions .icon-btn, .copy-code-btn, .msg-failed-note { position: relative; }
.pill::after, .chip-btn::after, .sensor-chip::after, .note-tag::after, .duo-speaker-pill::after, .copy-code-btn::after, .msg-failed-note::after {
  content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 44px; transform: translateY(-50%);
}
.msg-action-btn::after, .chat-action-icon::after, .round-btn::after, .icon-btn-ghost::after, .icon-btn-sm::after, .mem-actions .icon-btn::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; transform: translate(-50%, -50%);
}
