:root {
  color-scheme: dark;
  --background: #070b14;
  --surface: #0d1320;
  --surface-elevated: #121a2a;
  --surface-soft: #182235;
  --border: #263247;
  --text: #f6f8fc;
  --muted: #95a3ba;
  --primary: #1288ff;
  --primary-hover: #2b98ff;
  --ink: var(--text);
  --line: var(--border);
  --panel: var(--surface-elevated);
  --accent: var(--primary);
  --danger: #ffb7bd;
  --success: #a5e5bd;
  --success-bg: rgba(44, 151, 88, 0.18);
  --overlay: rgba(2, 6, 13, 0.62);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
  --sidebar-width: 272px;
  --sidebar-collapsed: 84px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="light"] {
  color-scheme: light;
  --background: #f7f9fc;
  --surface: #ffffff;
  --surface-elevated: #ffffff;
  --surface-soft: #edf2f8;
  --border: #dce3ed;
  --text: #10213f;
  --muted: #607089;
  --primary: #087df0;
  --primary-hover: #006fdc;
  --danger: #a91e2c;
  --success: #176f3b;
  --success-bg: #eaf8ef;
  --overlay: rgba(28, 42, 64, 0.38);
  --shadow: 0 24px 70px rgba(20, 37, 63, 0.2);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  background: var(--background);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  transition: background-color 180ms ease, color 180ms ease;
}

button,
input,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

button {
  color: inherit;
}

svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  height: 100dvh;
  min-height: 100dvh;
  transition: grid-template-columns 180ms ease;
}

.sidebar-is-collapsed .app-shell {
  grid-template-columns: var(--sidebar-collapsed) minmax(0, 1fr);
}

.sidebar {
  display: flex;
  min-width: 0;
  max-height: 100dvh;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--border);
  background: var(--surface);
  transition: background-color 180ms ease, border-color 180ms ease;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand {
  display: flex;
  min-width: 0;
  flex: 1;
  align-items: center;
  text-decoration: none;
}

.brand-image {
  display: block;
  object-fit: contain;
  object-position: left center;
}

.brand-image-full {
  max-height: 52px;
}

.brand-image-symbol {
  display: none !important;
  width: 48px;
  height: 48px;
}

.brand-light,
:root[data-theme="light"] .brand-dark {
  display: none;
}

:root[data-theme="light"] .brand-light {
  display: block;
}

.icon-button {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
}

.icon-button:hover,
.icon-button:focus-visible {
  border-color: var(--border);
  background: var(--surface-soft);
  outline: 0;
}

.navigation {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
}

.nav-item {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
  text-decoration: none;
}

.nav-item:hover,
.nav-item:focus-visible {
  border-color: var(--border);
  background: var(--surface-soft);
  color: var(--text);
  outline: 0;
}

.sidebar-history-note {
  display: grid;
  gap: 4px;
  margin: 12px 13px 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.sidebar-history-note strong {
  color: var(--text);
  font-size: 12px;
}

.nav-item svg {
  flex: 0 0 auto;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 18px;
}

.sidebar-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.5;
  white-space: nowrap;
}

.sidebar-meta-icon {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  object-fit: contain;
}

.sidebar-is-collapsed .sidebar {
  align-items: center;
  padding-right: 14px;
  padding-left: 14px;
}

.sidebar-is-collapsed .brand {
  justify-content: center;
}

.sidebar-is-collapsed .brand-image-full,
.sidebar-is-collapsed .nav-item span,
.sidebar-is-collapsed .sidebar-history-note,
.sidebar-is-collapsed .sidebar-meta {
  display: none;
}

.sidebar-is-collapsed .brand-image-symbol.brand-dark {
  display: block !important;
}

:root[data-theme="light"].sidebar-is-collapsed .brand-image-symbol.brand-dark {
  display: none !important;
}

:root[data-theme="light"].sidebar-is-collapsed .brand-image-symbol.brand-light {
  display: block !important;
}

.sidebar-is-collapsed .sidebar-header {
  flex-direction: column;
}

.sidebar-is-collapsed .sidebar-toggle svg {
  transform: rotate(180deg);
}

.sidebar-is-collapsed .nav-item {
  justify-content: center;
  width: 48px;
  padding: 0;
}

.main-content {
  display: flex;
  min-width: 0;
  min-height: 0;
  max-height: 100dvh;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  position: relative;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--background) 88%, transparent);
  transition: background-color 180ms ease, border-color 180ms ease;
}

.mobile-menu-toggle {
  display: none;
}

.topbar-title {
  display: grid;
  min-width: 0;
  flex: 1;
}

.topbar-title strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-title span {
  overflow: hidden;
  color: var(--muted);
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sun-icon {
  display: none;
}

:root[data-theme="light"] .moon-icon {
  display: none;
}

:root[data-theme="light"] .sun-icon {
  display: block;
}

.laboratorio-content {
  display: flex;
  min-height: 0;
  flex: 1;
  justify-content: center;
  overflow: auto;
}

.conversation {
  display: flex;
  width: min(960px, 100%);
  min-height: 0;
  flex: 1;
  flex-direction: column;
  justify-content: flex-end;
  align-self: stretch;
  padding: 10px 0 0;
}

.conversation.has-messages {
  justify-content: flex-start;
}

.demo-intro {
  width: 100%;
  max-width: min(960px, 100%);
  margin: 0 auto 14px;
  text-align: center;
}

.demo-intro[hidden] {
  display: none;
}

.demo-intro p {
  max-width: 760px;
  margin: 0 auto 5px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.42;
}

.starter-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 12px;
}

.starter-actions button {
  min-width: 0;
  display: inline-flex;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
  text-align: left;
}

.quick-icon {
  flex: 0 0 auto;
  line-height: 1;
}

.starter-actions button:hover,
.starter-actions button:focus-visible {
  border-color: color-mix(in srgb, var(--primary) 65%, var(--border));
  background: var(--surface-soft);
  outline: 0;
}

.message-list {
  min-height: 0;
  flex: 0 1 auto;
  max-height: 260px;
  padding: 0 10px 18px;
  overflow-y: auto;
  scroll-behavior: smooth;
  scrollbar-width: thin;
}

.conversation.has-messages .message-list {
  flex: 1;
  max-height: none;
  padding: 18px 10px 30px;
}

.message-list[hidden] {
  display: none;
}

.message-row {
  display: flex;
  margin: 0 0 16px;
}

.message-user {
  justify-content: flex-end;
}

.message-assistant {
  justify-content: flex-start;
  align-items: flex-start;
  flex-direction: column;
}

.conversation-tools {
  position: relative;
  display: none;
  flex: 0 0 auto;
  justify-content: flex-end;
}

.conversation.has-messages .conversation-tools {
  display: flex;
}

.conversation-tools-trigger {
  display: inline-flex;
  align-items: center;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.conversation-tools-trigger:hover,
.conversation-tools-trigger:focus-visible {
  background: var(--surface-soft);
  color: var(--text);
  outline: 0;
}

.conversation-tools-trigger svg {
  width: 17px;
  height: 17px;
}

.conversation-tools-menu,
.attachment-menu {
  position: absolute;
  z-index: 35;
  display: grid;
  min-width: 220px;
  gap: 3px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface-elevated);
  box-shadow: var(--shadow);
}

.conversation-tools-menu {
  top: 34px;
  right: 10px;
}

.conversation-tools-menu[hidden],
.attachment-menu[hidden] {
  display: none;
}

.conversation-tools-menu button,
.attachment-menu button {
  display: flex;
  min-height: 36px;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  font-size: 11.5px;
}

.conversation-tools-menu button:hover,
.conversation-tools-menu button:focus-visible,
.attachment-menu button:hover,
.attachment-menu button:focus-visible {
  background: var(--surface-soft);
  outline: 0;
}

.conversation-tools-menu button:disabled {
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.55;
}

.message-bubble {
  max-width: min(82%, 900px);
  color: var(--text);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.message-user .message-bubble {
  border: 1px solid var(--border);
  background: var(--surface-soft);
}

.message-assistant .message-bubble strong {
  font-weight: 750;
}

.message-assistant .message-bubble code {
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-soft);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.92em;
}

.message-assistant .assistant-code-block {
  width: min(100%, 980px);
  border: 1px solid var(--border);
  overflow: hidden;
  background: color-mix(in srgb, var(--surface-soft) 72%, #000 28%);
  white-space: normal;
}

.message-assistant .assistant-code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.message-assistant .assistant-code-copy {
  padding: 0 11px;
  border-radius: 7px;
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
}

.message-assistant .assistant-code-copy:hover,
.message-assistant .assistant-code-copy:focus-visible {
  border-color: var(--primary);
  outline: 0;
}

.message-assistant .assistant-code-block pre {
  margin: 0;
  overflow-x: auto;
  white-space: pre;
  tab-size: 4;
}

.message-assistant .assistant-code-block code {
  display: block;
  min-width: max-content;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12.5px;
  white-space: pre;
}

.message-assistant .message-bubble a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.message-assistant .message-bubble a:hover,
.message-assistant .message-bubble a:focus-visible {
  color: color-mix(in srgb, var(--primary) 78%, white);
  outline: 0;
}

.message-bubble.is-pending {
  color: var(--muted);
}

.dalila-loader {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}

.dalila-loader-mark {
  position: relative;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-elevated);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
}

.dalila-loader-mark::after {
  position: absolute;
  inset: -4px;
  border: 1px solid color-mix(in srgb, var(--primary) 55%, transparent);
  border-radius: 15px;
  animation: dalila-loader-pulse 900ms infinite alternate;
  content: "";
}

.dalila-loader-image {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.message-bubble.is-error {
  color: var(--danger);
}

.message-actions {
  display: flex;
  flex-wrap: wrap;
}

.message-actions button {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
}

.message-actions button:hover,
.message-actions button:focus-visible,
.message-actions button.is-selected {
  background: var(--surface-soft);
  color: var(--primary);
  outline: 0;
}

.message-sources {
  display: flex;
  width: min(100%, 760px);
  flex-wrap: wrap;
  align-items: center;
  gap: 3px;
}

.message-sources > strong {
  width: 100%;
  color: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.message-sources a {
  display: inline-flex;
  width: auto;
  min-height: 24px;
  max-width: 180px;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  padding: 3px 7px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  font-size: 11px;
  text-decoration: none;
  opacity: 0.68;
  transition: opacity 150ms ease, background-color 150ms ease, border-color 150ms ease;
}

.message-sources a:hover,
.message-sources a:focus-visible {
  border-color: color-mix(in srgb, var(--primary) 55%, var(--border));
  background: var(--surface-soft);
  opacity: 1;
  outline: 0;
}

.message-sources img {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  border-radius: 4px;
}

.message-sources a.has-fallback {
  padding-inline: 8px;
}

.message-sources a > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-domain-fallback {
  max-width: 138px;
  overflow: hidden;
  color: var(--primary);
  font-size: 9px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@keyframes dalila-pulse {
  from {
    opacity: 0.25;
    transform: translateY(0);
  }

  to {
    opacity: 1;
    transform: translateY(-2px);
  }
}

@keyframes dalila-loader-pulse {
  from {
    opacity: 0.25;
    transform: scale(0.94);
  }

  to {
    opacity: 1;
    transform: scale(1.04);
  }
}

.composer {
  display: flex;
  align-items: stretch;
  flex-direction: column;
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.14);
}

.composer-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.composer-context-actions { display: flex; align-items: center; gap: 3px; }

.attachment-actions {
  position: relative;
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 1px;
  padding-bottom: 0;
}

.project-composer-tag {
  display: inline-flex;
  align-items: center;
  align-self: center;
  min-width: 0;
  max-width: 128px;
  height: 18px;
  margin-left: 1px;
  padding: 0 5px 0 4px;
  border: 1px solid color-mix(in srgb, var(--border) 88%, var(--primary) 12%);
  border-radius: 6px;
  background: color-mix(in srgb, var(--surface-soft) 94%, var(--primary) 6%);
  color: color-mix(in srgb, var(--muted) 90%, transparent 10%);
  font-size: 9px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.project-composer-tag[hidden] {
  display: none;
}

.project-composer-tag svg {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  margin-right: 3px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.project-composer-tag span, .municipality-selector span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-menu {
  bottom: 38px;
  left: 0;
}

.attachment-menu button svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
}

.attachment-menu button[hidden] {
  display: none;
}

.attachment-button,
.voice-button {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.attachment-button:hover,
.voice-button:hover {
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  color: var(--primary);
}

.attachment-button:disabled,
.voice-button:disabled {
  cursor: default;
  opacity: 0.4;
}

.attachment-button[hidden] {
  display: none;
}

.attachment-button svg,
.voice-button svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.attachment-camera-icon { display: none; }

.municipality-context { position: relative; }
.municipality-selector {
  display: flex; align-items: center; gap: 6px; max-width: 235px; background: transparent;
  color: var(--muted); cursor: pointer; font: inherit;
}
.municipality-selector:hover, .municipality-selector[aria-expanded="true"] { background: color-mix(in srgb, var(--primary) 10%, transparent); color: var(--text); }
.municipality-selector svg { width: 17px; height: 17px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.municipality-selector .municipality-chevron { width: 13px; height: 13px; }
.municipality-menu {
  position: absolute; right: 0; bottom: calc(100% + 9px); z-index: 45; width: 292px;
  padding: 8px; border: 1px solid var(--border); border-radius: 13px;
  background: var(--surface-elevated); box-shadow: 0 18px 45px rgba(0, 0, 0, 0.34);
}
.municipality-menu p { margin: 3px 6px 8px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.municipality-menu .context-menu-title { margin-top: 5px; margin-bottom: 4px; color: var(--text); font-size: 11px; font-weight: 750; letter-spacing: .01em; }
.municipality-menu button { width: 100%; padding: 8px 9px; border: 0; border-radius: 8px; background: transparent; color: var(--text); cursor: pointer; font: inherit; font-size: 12px; text-align: left; }
.municipality-menu button:hover, .municipality-menu .scope-option[aria-checked="true"] { background: var(--surface-soft); }
.municipality-menu .is-danger, .profile-municipality-actions .is-danger { color: var(--danger); }
.municipality-menu button[hidden] { display: none; }
.municipality-menu .scope-option { display: flex; align-items: center; gap: 8px; }
.municipality-menu .scope-option svg { width: 16px; height: 16px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.municipality-menu .scope-option > span:nth-child(2) { flex: 1; }
.municipality-menu .scope-check { visibility: hidden; color: var(--primary); font-weight: 800; }
.municipality-menu .scope-option[aria-checked="true"] .scope-check { visibility: visible; }

.voice-button.is-recording {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  animation: dalila-recording 900ms infinite alternate;
}

.voice-button .voice-icon-stop {
  display: none;
  fill: currentColor;
  stroke: none;
}

.voice-button.is-recording .voice-icon-mic {
  display: none;
}

.voice-button.is-recording .voice-icon-stop {
  display: block;
}

.voice-button.is-transcribing {
  color: var(--primary);
  animation: dalila-loader-pulse 700ms infinite alternate;
}

.voice-waveform {
  width: 112px;
  height: 38px;
  flex: 0 1 112px;
  overflow: hidden;
  border-radius: 11px;
  background: color-mix(in srgb, var(--primary) 8%, transparent);
}

.voice-waveform canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.selected-images {
  display: flex;
  flex: 0 0 auto;
  overflow-x: auto;
}

.selected-images[hidden] {
  display: none;
}

.selected-image {
  position: relative;
  width: 74px;
  height: 74px;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-elevated);
}

.selected-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.selected-document {
  position: relative;
  display: flex;
  width: 220px;
  height: 74px;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
  padding: 10px 34px 10px 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-elevated);
}

.selected-document-icon {
  display: grid;
  width: 40px;
  height: 46px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
  background: color-mix(in srgb, var(--primary) 14%, var(--surface-soft));
  color: var(--primary);
  font-size: 9px;
  font-weight: 800;
}

.selected-document > span:nth-child(2) {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.selected-document strong {
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selected-document small {
  color: var(--muted);
  font-size: 9px;
}

.selected-image-remove {
  position: absolute;
  display: grid;
  place-items: center;
  border: 0;
  color: #fff;
  line-height: 1;
  cursor: pointer;
}

.install-pwa-button {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  border: 1px solid color-mix(in srgb, var(--primary) 45%, var(--border));
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  color: var(--primary);
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

.install-pwa-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.install-pwa-button[hidden] {
  display: none;
}

@keyframes dalila-recording {
  from { opacity: 0.65; }
  to { opacity: 1; }
}

.conversation.has-messages .composer {
  flex: 0 0 auto;
}

.composer:focus-within {
  border-color: rgba(18, 136, 255, 0.65);
}

.composer textarea {
  width: 100%;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
}

.composer textarea::placeholder {
  color: var(--muted);
}

.send-button {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
  border: 0;
  background: var(--primary);
  color: #ffffff;
  cursor: pointer;
}

.send-button:hover {
  background: var(--primary-hover);
}

.send-button:disabled {
  cursor: default;
}

.composer-caption {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  margin: 11px 0 0;
  color: var(--muted);
  text-align: center;
}

.sidebar-backdrop {
  display: none;
}

.sidebar-history-note {
  width: auto;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.sidebar-history-note:hover span,
.sidebar-history-note:focus-visible span {
  color: var(--primary);
}

.sidebar-history {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  gap: 8px;
  margin: 12px 3px 0;
  overflow: hidden;
}

.history-list {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  overflow-y: auto;
  scrollbar-width: thin;
}

.history-item {
  display: grid;
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.history-entry {
  position: relative;
}

.history-controls {
  display: none;
  gap: 3px;
  padding: 0 9px 6px;
}

.history-entry:hover .history-controls,
.history-entry:focus-within .history-controls {
  display: flex;
}

.history-controls button {
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 9px;
}

.history-controls button + button::before {
  margin: 0 5px;
  color: var(--border-strong);
  content: "·";
}

.history-controls button:hover,
.history-controls button:focus-visible {
  color: var(--primary);
  outline: 0;
}

.history-item:hover,
.history-item:focus-visible,
.history-item.is-active {
  border-color: var(--border);
  background: var(--surface-soft);
  outline: 0;
}

.history-item span {
  overflow: hidden;
  font-size: 11.5px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-item .history-item-title {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 5px;
  overflow: visible;
}

.history-item .history-item-title-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-cowork-indicator {
  display: inline-flex;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  align-items: center;
  justify-content: center;
  border: 1px solid color-mix(in srgb, var(--primary) 30%, var(--border));
  border-radius: 5px;
  background: color-mix(in srgb, var(--primary) 7%, transparent);
  color: var(--primary);
}

.history-cowork-indicator svg {
  width: 11px;
  height: 11px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.history-item small,
.history-empty {
  color: var(--muted);
  font-size: 10px;
}

.history-empty {
  padding: 7px 10px;
  line-height: 1.45;
}

.sidebar-is-collapsed .sidebar-history {
  display: none;
}

.topbar-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
}

.registration-banner {
  border-bottom: 1px solid color-mix(in srgb, var(--primary) 20%, var(--border));
  background: color-mix(in srgb, var(--primary) 7%, var(--background));
}

.registration-banner button {
  padding: 4px 9px;
  border: 0;
  border-radius: 8px;
  background: color-mix(in srgb, var(--primary) 15%, transparent);
  color: var(--primary);
  cursor: pointer;
  font: inherit;
  font-weight: 760;
}

.account-login-trigger,
.user-account-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font: inherit;
}

.account-login-trigger:hover,
.account-login-trigger:focus-visible,
.user-account-trigger:hover,
.user-account-trigger:focus-visible {
  border-color: color-mix(in srgb, var(--primary) 48%, var(--border));
  outline: 0;
}

.account-login-trigger svg {
  width: 24px;
  height: 24px;
  padding: 3px;
  border-radius: 8px;
  background: var(--surface-soft);
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.account-login-trigger span {
  font-size: 11px;
  font-weight: 760;
}

.login-biometric-button[hidden] {
  display: none !important;
}

.user-account-menu {
  position: relative;
}

.user-account-trigger > img,
.user-account-initial {
  display: grid;
  place-items: center;
  background: var(--surface-soft);
  object-fit: cover;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
}

.user-account-trigger strong {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-chevron {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: var(--muted);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  transition: transform 160ms ease;
}

.user-account-trigger[aria-expanded="true"] .account-chevron {
  transform: rotate(180deg);
}

.account-dropdown {
  position: absolute;
  z-index: 90;
  top: calc(100% + 8px);
  right: 0;
  display: grid;
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.3);
}

.account-dropdown[hidden] {
  display: none;
}

.account-dropdown button,
.account-dropdown > a {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.account-dropdown > a {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.account-dropdown button:hover,
.account-dropdown button:focus-visible,
.account-dropdown > a:hover,
.account-dropdown > a:focus-visible {
  background: var(--surface-soft);
  outline: 0;
}

.account-dropdown .is-danger {
  color: var(--danger);
}

.account-dropdown form {
  margin: 5px 0 0;
  border-top: 1px solid var(--border);
}

.account-dialog {
  box-sizing: border-box;
  width: min(92vw, 460px);
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  color: var(--text);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.42);
}

.account-dialog::backdrop {
  background: rgba(4, 7, 13, 0.76);
  backdrop-filter: blur(8px);
}

.account-dialog p {
  color: var(--muted);
}

.account-profile-api-key {
  display: grid;
  grid-template-columns: 110px 1fr auto;
  align-items: center;
  gap: 10px;
}

.account-profile-api-key button,
.api-key-actions button,
.api-key-secret button {
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--primary);
  cursor: pointer;
  font: inherit;
  font-weight: 750;
}

.api-key-dialog { width: min(94vw, 760px); }
.api-key-state { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 16px 0; }
.api-key-state > div { display: grid; gap: 5px; padding: 12px; border-radius: 11px; background: var(--surface-soft); }
.api-key-state span, .api-key-secret > span, .api-key-usage > div:first-child span { color: var(--muted); font-size: 10px; }
.api-key-state strong { font-size: 12px; }
.api-key-empty, .api-key-loading { grid-column: 1 / -1; padding: 18px; text-align: center; }
.api-key-secret { display: grid; gap: 7px; padding: 13px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-soft); }
.api-key-secret[hidden] { display: none; }
.api-key-secret > div { display: flex; align-items: center; gap: 8px; }
.api-key-secret code { min-width: 0; overflow-x: auto; padding: 10px; border-radius: 8px; background: var(--surface); white-space: nowrap; }
.api-key-secret small { color: var(--muted); font-size: 10px; line-height: 1.45; }
.api-key-actions { display: flex; gap: 8px; margin: 12px 0 20px; }
.api-key-actions .is-danger { color: var(--danger); }
.api-key-actions button:disabled { opacity: .55; cursor: wait; }
.api-key-usage { padding-top: 16px; border-top: 1px solid var(--border); }
.api-key-usage > div:first-child { display: flex; align-items: baseline; justify-content: space-between; }
.api-key-usage h3 { margin: 0; font-size: 14px; }
.api-key-chart { display: flex; align-items: flex-end; gap: 3px; height: 170px; margin-top: 12px; }
.api-key-chart-column { display: flex; min-width: 0; height: 100%; flex: 1; flex-direction: column; justify-content: flex-end; align-items: center; gap: 5px; }
.api-key-chart-column i { display: block; width: 100%; min-height: 2px; border-radius: 4px 4px 1px 1px; background: var(--primary); opacity: .82; }
.api-key-chart-column small { color: var(--muted); font-size: 7px; white-space: nowrap; }
.api-key-status { min-height: 18px; margin: 10px 0 0 !important; color: var(--danger) !important; }

@media (max-width: 620px) {
  .account-profile-api-key { grid-template-columns: 1fr auto; }
  .account-profile-api-key dt { grid-column: 1 / -1; }
  .api-key-state { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .api-key-chart-column small { display: none; }
}

.image-generation-dialog form {
  display: grid;
  gap: 12px;
}

.image-generation-dialog label {
  color: var(--text);
  font-size: 12px;
  font-weight: 750;
}

.image-generation-dialog textarea {
  width: 100%;
  min-height: 132px;
  resize: vertical;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  outline: 0;
  background: var(--surface-soft);
  color: var(--text);
  line-height: 1.5;
}

.image-generation-dialog textarea:focus {
  border-color: var(--primary);
}


/* Modifica immagine: scroll contenuto nel popup e selezione risorse immagini. */
.image-generation-dialog.image-edit-dialog {
  position: relative;
  max-height: calc(var(--dalila-viewport-height, 100dvh) - 24px);
  padding: 0;
  overflow: hidden;
}

.image-edit-dialog-scroll {
  box-sizing: border-box;
  width: 100%;
  max-height: calc(var(--dalila-viewport-height, 100dvh) - 24px);
  padding: 28px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: auto;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}

.image-edit-dialog-scroll:hover,
.image-edit-dialog-scroll.is-scrolling {
  scrollbar-color: color-mix(in srgb, var(--muted) 42%, transparent) transparent;
}

.image-edit-dialog-scroll::-webkit-scrollbar {
  width: 6px;
}

.image-edit-dialog-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.image-edit-dialog-scroll::-webkit-scrollbar-thumb {
  min-height: 42px;
  border-radius: 999px;
  background: transparent;
}

.image-edit-dialog-scroll:hover::-webkit-scrollbar-thumb,
.image-edit-dialog-scroll.is-scrolling::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--muted) 42%, transparent);
}

.image-edit-dialog-scroll::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}

.image-edit-dialog .account-dialog-close {
  z-index: 3;
}

.image-edit-resource-section {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-soft);
}

.image-edit-resource-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.image-edit-resource-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.image-edit-resource-copy small,
.image-edit-resource-status {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.image-edit-resource-heading .secondary-action {
  flex: 0 0 auto;
  white-space: nowrap;
}

.image-edit-resource-selected {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-elevated);
}

.image-edit-resource-selected img {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: contain;
  background: var(--surface);
}

.image-edit-resource-selected strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
}

.image-edit-resource-selected button {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 10px;
  font-weight: 700;
}

.image-edit-resource-selected button:hover {
  color: var(--text);
}

.image-edit-resource-picker {
  display: grid;
  gap: 8px;
}

.image-edit-resource-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  max-height: 210px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.image-edit-resource-item {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-elevated);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.image-edit-resource-item:hover,
.image-edit-resource-item.is-selected {
  border-color: var(--primary);
}

.image-edit-resource-item img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 7px;
  object-fit: contain;
  background: var(--surface);
}

.image-edit-resource-item span {
  overflow: hidden;
  padding: 0 2px 2px;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
  font-weight: 700;
}

.image-edit-resource-section[hidden],
.image-edit-resource-selected[hidden],
.image-edit-resource-picker[hidden] {
  display: none;
}

.image-generation-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.image-generation-footer small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.image-generation-footer button,
.image-generation-login {
  flex: 0 0 auto;
  padding: 10px 14px;
  border: 0;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 750;
}

.image-generation-footer button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.image-generation-status {
  min-height: 18px;
  margin: 0 !important;
}

.image-generation-status.is-error {
  color: var(--danger);
}

.image-generation-login[hidden] {
  display: none;
}

.generated-image {
  display: grid;
  width: min(560px, 100%);
  gap: 9px;
  margin: 0;
}

.generated-image img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 16px;
}

.generated-image figcaption {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.generated-image a {
  color: var(--primary);
  font-size: 12px;
  font-weight: 750;
  text-decoration: none;
}

.generated-image small {
  color: var(--muted);
  font-size: 10px;
}

.account-dialog-close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  width: 32px;
  height: 32px;
  padding: 0;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 25px;
  font-weight: 300;
  line-height: 1;
}

.account-dialog-close:hover,
.account-dialog-close:focus-visible {
  color: var(--text);
  outline: 0;
}

.account-profile-data {
  display: grid;
  margin: 0;
}

.account-profile-data div {
  background: var(--surface-soft);
}

.account-profile-data dt {
  color: var(--muted);
  text-transform: uppercase;
}

.account-profile-data dd {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.profile-municipality-actions { display: flex; gap: 8px; margin-top: 9px; }
.profile-municipality-actions button { padding: 5px 9px; border: 1px solid var(--border); border-radius: 8px; background: transparent; color: var(--primary); cursor: pointer; font: inherit; font-size: 11px; }
.improvement-consent-control { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; cursor: pointer; }
.improvement-consent-control span { display: grid; gap: 5px; }
.improvement-consent-control strong { color: var(--text); font-size: 13px; }
.improvement-consent-control small, .improvement-consent-note { display: block; color: var(--muted); font-size: 10px; line-height: 1.5; }
.improvement-consent-control input { appearance: none; flex: 0 0 auto; margin: 0; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); cursor: pointer; transition: 160ms ease; }
.improvement-consent-control input::before { content: ''; display: block; margin: 2px; border-radius: 50%; background: var(--muted); transition: 160ms ease; }
.improvement-consent-control input:checked { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 28%, var(--surface)); }
.improvement-consent-control input:checked::before { background: var(--primary); }
.improvement-consent-control input:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.improvement-consent-control input:disabled { cursor: wait; opacity: .65; }
.improvement-consent-note { margin-top: 9px; }
.improvement-consent-status { display: block; min-height: 15px; margin-top: 6px; color: var(--primary); font-size: 10px; }
.municipality-dialog label { display: block; margin: 17px 0 7px; color: var(--text); font-size: 12px; font-weight: 700; }
.municipality-dialog input { width: 100%; padding: 11px 12px; border: 1px solid var(--border); border-radius: 11px; outline: 0; background: var(--surface-soft); color: var(--text); font: inherit; }
.municipality-dialog input:focus { border-color: var(--primary); }
.municipality-results { display: grid; gap: 4px; max-height: 280px; margin-top: 8px; overflow-y: auto; }
.municipality-results button { display: grid; gap: 3px; width: 100%; padding: 9px 10px; border: 0; border-radius: 9px; background: transparent; color: var(--text); cursor: pointer; font: inherit; text-align: left; }
.municipality-results button:hover, .municipality-results button:focus-visible { background: var(--surface-soft); outline: 0; }
.municipality-results strong { font-size: 13px; }
.municipality-results span, .municipality-search-status { color: var(--muted); font-size: 10px; }

.biometric-state {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface-soft);
}

.biometric-state-dot {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--muted) 15%, transparent);
}

.biometric-state-dot.is-active {
  background: #22c55e;
  box-shadow: 0 0 0 4px color-mix(in srgb, #22c55e 17%, transparent);
}

.biometric-state-dot.is-warning {
  background: #eab308;
  box-shadow: 0 0 0 4px color-mix(in srgb, #eab308 17%, transparent);
}

.biometric-state > div {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.biometric-state strong {
  font-size: 13px;
}

.biometric-state small,
.biometric-privacy {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.biometric-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 9px;
  margin: 16px 0 13px;
}

.biometric-actions button {
  padding: 10px 14px;
  border: 1px solid color-mix(in srgb, var(--primary) 48%, var(--border));
  border-radius: 10px;
  background: color-mix(in srgb, var(--primary) 13%, transparent);
  color: var(--primary);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 760;
}

.biometric-actions button.is-danger {
  border-color: color-mix(in srgb, var(--danger) 55%, var(--border));
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: var(--danger);
}

.biometric-actions button:disabled {
  cursor: wait;
  opacity: .62;
}


.passkey-list {
  display: grid;
  gap: 8px;
  margin: 14px 0 4px;
}

.passkey-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface-soft);
}

.passkey-item-copy {
  display: grid;
  min-width: 0;
  flex: 1 1 auto;
  gap: 3px;
}

.passkey-item-copy strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.passkey-item-copy small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.passkey-item button {
  flex: 0 0 auto;
  padding: 7px 9px;
  border: 1px solid color-mix(in srgb, var(--danger) 45%, var(--border));
  border-radius: 8px;
  background: color-mix(in srgb, var(--danger) 9%, transparent);
  color: var(--danger);
  cursor: pointer;
  font: inherit;
  font-size: 10px;
  font-weight: 700;
}

.passkey-item button:disabled {
  cursor: wait;
  opacity: .55;
}

.biometric-dialog-status {
  display: block;
  min-height: 16px;
  margin-top: 8px;
  color: var(--primary);
  font-size: 10px;
  line-height: 1.4;
  text-align: center;
}

.biometric-dialog-status.is-error {
  color: var(--danger);
}

.account-delete-dialog form {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.account-delete-dialog label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.account-delete-dialog form button {
  padding: 10px 14px;
  border: 1px solid color-mix(in srgb, var(--danger) 55%, var(--border));
  border-radius: 10px;
  background: color-mix(in srgb, var(--danger) 13%, transparent);
  color: var(--danger);
  cursor: pointer;
  font: inherit;
  font-weight: 760;
}

.login-dialog {
  width: min(92vw, 430px);
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  color: var(--text);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.42);
}

.login-dialog::backdrop {
  background: rgba(4, 7, 13, 0.76);
  backdrop-filter: blur(8px);
}

.login-dialog > img {
  width: 46px;
  height: 46px;
  object-fit: contain;
}

.login-dialog h2 {
  margin: 18px 0 7px;
  font-size: 24px;
}

.login-dialog p {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.login-biometric-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  gap: 9px;
  margin: -5px 0 12px;
  padding: 11px 14px;
  border: 1px solid color-mix(in srgb, var(--primary) 48%, var(--border));
  border-radius: 11px;
  background: color-mix(in srgb, var(--primary) 13%, transparent);
  color: var(--primary);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 780;
}

.login-biometric-button:hover,
.login-biometric-button:focus-visible {
  background: color-mix(in srgb, var(--primary) 20%, transparent);
  outline: 0;
}

.login-biometric-button:disabled {
  cursor: wait;
  opacity: .62;
}

.login-biometric-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.75;
}

.biometric-login-status {
  display: block;
  min-height: 0;
  margin: -4px 0 10px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.biometric-login-status:empty {
  display: none;
}

.login-dialog-close {
  position: absolute;
  top: 13px;
  right: 15px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 27px;
}

.social-login {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: 13px;
  color: var(--text);
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
}

.social-login:hover,
.social-login:focus-visible {
  border-color: color-mix(in srgb, var(--primary) 55%, var(--border));
  background: var(--surface-soft);
  outline: 0;
}

.social-login span {
  font-size: 18px;
  font-weight: 850;
}

.google-login span {
  color: #4285f4;
}

.meta-login span {
  color: #1877f2;
}

.login-dialog small {
  display: block;
  margin-top: 18px;
  color: var(--muted);
  font-size: 10.5px;
  text-align: center;
}

.auth-toast {
  position: fixed;
  z-index: 80;
  right: 20px;
  bottom: 20px;
  max-width: min(420px, calc(100vw - 40px));
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 11px 11px 16px;
  border: 1px solid color-mix(in srgb, #22c55e 55%, var(--border));
  background: var(--surface-elevated);
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 180ms ease, transform 180ms ease;
}

.auth-toast.is-error {
  border-color: color-mix(in srgb, var(--danger) 60%, var(--border));
}

.auth-toast.is-closing {
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
}

.auth-toast-close {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
}

.auth-toast-close:hover,
.auth-toast-close:focus-visible {
  background: var(--surface-soft);
  color: var(--text);
}

@media (max-width: 760px) {
  html,
  body {
    width: 100%;
    height: var(--dalila-viewport-height, 100dvh);
    min-height: 0;
    overflow: hidden;
  }

  .attachment-actions {
    gap: 0;
  }

  .attachment-button.has-camera .attachment-paperclip-icon { display: none; }
  .attachment-button.has-camera .attachment-camera-icon { display: block; }

  .voice-waveform {
    width: 76px;
    flex-basis: 76px;
  }

  .install-pwa-button {
    padding: 8px;
  }

  .install-pwa-button span {
    display: none;
  }

  .topbar-actions {
    gap: 5px;
  }

  .user-account-trigger strong,
  .account-chevron {
    display: none;
  }

  .user-account-trigger {
    padding: 2px;
    border: 0;
    background: transparent;
  }

  .account-login-trigger {
    padding-right: 7px;
  }

  .sidebar-is-collapsed .sidebar-history {
    display: flex;
  }

  .sidebar-is-collapsed .sidebar-history-note {
    display: grid;
  }

  .history-controls {
    display: flex;
  }

  .app-shell,
  .sidebar-is-collapsed .app-shell {
    position: absolute;
    top: var(--dalila-viewport-offset-top, 0px);
    right: 0;
    left: 0;
    display: block;
    height: var(--dalila-viewport-height, 100dvh);
    min-height: 0;
    overflow: hidden;
  }

  .sidebar {
    position: fixed;
    z-index: 45;
    inset: 0 auto 0 0;
    width: min(86vw, 320px);
    height: var(--dalila-viewport-height, 100dvh);
    max-height: var(--dalila-viewport-height, 100dvh);
    padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
    transform: translateX(-105%);
    transition: transform 180ms ease;
    box-shadow: var(--shadow);
  }

  .mobile-sidebar-open .sidebar {
    transform: translateX(0);
  }

  .mobile-sidebar-open .sidebar-backdrop {
    position: fixed;
    z-index: 44;
    inset: 0;
    display: block;
    padding: 0;
    border: 0;
    background: var(--overlay);
  }

  .sidebar-toggle {
    display: none;
  }

  .sidebar-is-collapsed .sidebar {
    align-items: stretch;
    padding-right: 18px;
    padding-left: 18px;
  }

  .sidebar-is-collapsed .brand-image-full {
    display: block;
  }

  .sidebar-is-collapsed .brand-image-full.brand-light {
    display: none;
  }

  :root[data-theme="light"].sidebar-is-collapsed .brand-image-full.brand-dark {
    display: none;
  }

  :root[data-theme="light"].sidebar-is-collapsed .brand-image-full.brand-light {
    display: block;
  }

  .sidebar-is-collapsed .brand-image-symbol {
    display: none !important;
  }

  .sidebar-is-collapsed .nav-item span,
  .sidebar-is-collapsed .sidebar-meta {
    display: inline;
  }

  .sidebar-is-collapsed .sidebar-header {
    flex-direction: row;
  }

  .sidebar-is-collapsed .nav-item {
    justify-content: flex-start;
    width: auto;
    padding: 0 13px;
  }

  .main-content {
    height: var(--dalila-viewport-height, 100dvh);
    min-height: 0;
    max-height: var(--dalila-viewport-height, 100dvh);
  }

  .topbar {
    position: relative;
    z-index: 40;
    top: 0;
    padding: max(10px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 10px max(14px, env(safe-area-inset-left));
  }

  .mobile-menu-toggle {
    display: grid;
  }

  .topbar-title {
    display: grid;
  }

  .laboratorio-content {
    min-height: 0;
    overflow: hidden;
    padding: 10px max(12px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  }

  .conversation {
    height: 100%;
    min-height: 0;
    padding-top: 6px;
  }

  .demo-intro p {
    font-size: 12px;
    line-height: 1.35;
  }

  .demo-intro.is-returning {
    margin-bottom: 5px;
  }

  .demo-intro.is-returning p:not(:first-child) {
    display: none;
  }

  .demo-intro.is-returning .starter-actions {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 3px;
    scrollbar-width: none;
  }

  .demo-intro.is-returning .starter-actions::-webkit-scrollbar {
    display: none;
  }

  .demo-intro.is-returning .starter-actions button {
    min-width: 190px;
    flex: 0 0 auto;
  }

  .starter-actions {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 10px;
  }

  .starter-actions button {
    min-height: 42px;
    justify-content: flex-start;
    padding: 0 10px;
    font-size: 10.5px;
  }

  .message-list {
    min-height: 0;
    flex: 1;
    max-height: none;
    padding-bottom: 12px;
    overscroll-behavior: contain;
  }

  .conversation.has-messages .message-list {
    min-height: 0;
    padding-top: 8px;
    padding-bottom: 24px;
    scroll-padding-bottom: 24px;
  }

  .mobile-keyboard-open .topbar {
    min-height: 54px;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .mobile-keyboard-open .registration-banner {
    display: none;
  }

  .mobile-keyboard-open .laboratorio-content {
    padding-top: 4px;
  }

  .conversation-tools-menu {
    right: 2px;
  }

  .composer {
    position: relative;
    z-index: 20;
    flex: 0 0 auto;
    margin-top: auto;
  }
  .municipality-menu { position: fixed; right: 12px; bottom: calc(112px + env(safe-area-inset-bottom)); width: min(310px, calc(100vw - 24px)); }

  .composer-caption {
    flex: 0 0 auto;
    margin: 5px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .composer-caption span:not(.question-quota) {
    display: none;
  }

  .image-generation-dialog {
    width: calc(100vw - 24px);
    max-height: calc(var(--dalila-viewport-height, 100dvh) - 24px);
    padding: 22px 18px;
  }

  .image-generation-dialog.image-edit-dialog {
    padding: 0;
  }

  .image-edit-dialog-scroll {
    padding: 22px 18px;
  }

  .image-edit-resource-heading, .image-generation-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .image-edit-resource-heading .secondary-action {
    width: 100%;
  }

  .image-edit-resource-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .image-generation-footer button {
    width: 100%;
  }
}

/* Chat dei progetti richiudibili */

.project-history-toggle {
  display: flex;
  min-width: 0;
  flex: 1;
  align-items: center;
  gap: 7px;
  padding: 4px 5px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.project-history-toggle:hover,
.project-history-toggle:focus-visible {
  background: var(--surface-soft);
  outline: 0;
}

.project-history-toggle:focus-visible {
  box-shadow: var(--focus-ring);
}

.project-history-toggle > svg:not(.project-history-chevron) {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  fill: none;
  stroke: var(--primary);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.project-history-chevron {
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
  fill: none;
  stroke: var(--muted);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
  transform: rotate(-90deg);
  transition: transform 150ms ease;
}

.project-history-group.is-open .project-history-chevron {
  transform: rotate(0);
}

.project-history-body {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.project-history-body[hidden] {
  display: none !important;
}

/* Manager surface */
.manager-page { overflow: hidden; background: var(--surface); color: var(--ink); }
.manager-shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); height: 100dvh; min-height: 0; }
.manager-sidebar { display: flex; min-height: 0; flex-direction: column; gap: 30px; padding: 26px 16px 18px; overflow-y: auto; border-right: 1px solid var(--line); background: var(--panel); }
.manager-brand { display: block; padding: 4px 12px 18px; border-bottom: 1px solid var(--line); }
.manager-brand img { width: 142px; height: auto; }
.manager-nav { display: grid; gap: 5px; }
.manager-nav-item { display: flex; align-items: center; gap: 12px; padding: 11px 13px; border-radius: 8px; color: var(--muted); font-size: 13px; font-weight: 650; text-decoration: none; transition: background 160ms ease, color 160ms ease; }
.manager-nav-item span { width: 20px; color: var(--accent); text-align: center; font-size: 17px; }
.manager-nav-item:hover, .manager-nav-item.is-active { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--ink); }
.manager-sidebar-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding: 14px 10px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.manager-sidebar-footer button { padding: 0; border: 0; background: transparent; color: var(--accent); cursor: pointer; font: inherit; }
.manager-main { min-width: 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.manager-topbar { display: flex; align-items: center; justify-content: space-between; min-height: 88px; padding: 18px clamp(20px, 4vw, 56px); border-bottom: 1px solid var(--line); background: var(--surface); }
.manager-topbar h1, .manager-heading h2 { margin: 2px 0 0; font-size: 23px; letter-spacing: 0; }
.manager-topbar-meta { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.manager-theme-toggle { width: 36px; height: 36px; margin-left: 14px; border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--ink); cursor: pointer; }
.manager-content { max-width: 1480px; margin: 0 auto; padding: 34px clamp(20px, 4vw, 56px) 56px; }
.manager-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.manager-kicker, .eyebrow { margin: 0; color: var(--accent); font-size: 11px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.manager-muted { color: var(--muted); font-size: 12px; }
.manager-metrics { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.manager-metric, .manager-panel { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); box-shadow: var(--shadow); }
.manager-metric { min-height: 108px; padding: 17px; }
.manager-metric span { display: block; color: var(--muted); font-size: 11px; }
.manager-metric strong { display: block; margin-top: 17px; color: var(--ink); font-size: 22px; }
.manager-grid { display: grid; gap: 18px; margin-bottom: 18px; }
.manager-grid-two { grid-template-columns: 1fr 1fr; }
.manager-panel { min-width: 0; padding: 20px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.panel-heading h3 { margin: 0; font-size: 14px; }
.panel-heading span { color: var(--muted); font-size: 11px; }
.health-row { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 13px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.health-row:last-child { border-bottom: 0; }
.health-row strong { color: var(--ink); font-size: 12px; font-weight: 650; text-align: right; }
.status-dot { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: #39d98a; box-shadow: 0 0 0 4px color-mix(in srgb, #39d98a 14%, transparent); }
.status-dot.is-off { background: #f59e0b; box-shadow: 0 0 0 4px color-mix(in srgb, #f59e0b 14%, transparent); }
.bar-chart { display: flex; align-items: end; gap: 5px; height: 180px; padding-top: 20px; }
.bar-column { display: flex; min-width: 0; flex: 1; height: 100%; flex-direction: column; align-items: center; justify-content: end; gap: 7px; }
.bar-column i { width: 100%; min-height: 3px; border-radius: 4px 4px 1px 1px; background: var(--accent); opacity: .82; }
.bar-column small { color: var(--muted); font-size: 8px; }
.manager-login-form input { min-height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 7px; outline: 0; background: var(--panel); color: var(--ink); font: inherit; }
.manager-login-form input:focus { border-color: var(--accent); }
.manager-primary-button { min-height: 40px; padding: 0 18px; border: 0; border-radius: 7px; background: var(--accent); color: #fff; cursor: pointer; font: inherit; font-weight: 700; }
.manager-table-wrap { overflow-x: auto; }
.manager-table { width: 100%; border-collapse: collapse; white-space: nowrap; font-size: 12px; }
.manager-table th { padding: 0 12px 12px; color: var(--muted); font-size: 10px; font-weight: 700; text-align: left; text-transform: uppercase; }
.manager-table td { padding: 14px 12px; border-top: 1px solid var(--line); color: var(--ink); }
.manager-table code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.badge { display: inline-flex; align-items: center; padding: 5px 9px; border-radius: 999px; font-size: 10px; font-weight: 700; }
.badge-success { background: color-mix(in srgb, #39d98a 18%, transparent); color: #39d98a; }
.badge-muted { background: color-mix(in srgb, var(--muted) 15%, transparent); color: var(--muted); }
.empty-state { padding: 42px 12px !important; color: var(--muted) !important; text-align: center; }
.manager-pagination { display: flex; justify-content: center; align-items: center; gap: 16px; padding-top: 20px; color: var(--muted); font-size: 12px; }
.manager-pagination a { color: var(--accent); text-decoration: none; }
.manager-login-page { display: grid; min-height: 100dvh; place-items: center; background: var(--surface); }
.manager-login { width: min(92vw, 390px); padding: 34px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); box-shadow: var(--shadow); }
.manager-login-mark { display: grid; width: 44px; height: 44px; margin-bottom: 24px; place-items: center; border-radius: 50%; background: var(--accent); color: #fff; font-size: 22px; font-weight: 800; }
.manager-login h1 { margin: 5px 0; font-size: 27px; }.manager-login-form { display: grid; gap: 15px; margin-top: 25px; }.manager-login-form label { display: grid; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 650; }.manager-login-form input { width: 100%; }.form-error { margin: -4px 0 0; color: #fb7185; font-size: 11px; }
.manager-secondary-button, .manager-danger-button { min-height: 40px; padding: 0 16px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); color: var(--ink); cursor: pointer; font: inherit; font-weight: 700; }
.manager-danger-button { border-color: color-mix(in srgb, #fb7185 45%, var(--line)); color: #fb7185; }
.manager-alert { margin: 0 0 18px; padding: 12px 15px; border: 1px solid var(--line); border-radius: 8px; font-size: 12px; }
.manager-alert-success { border-color: color-mix(in srgb, #39d98a 40%, var(--line)); color: #39d98a; }
.manager-alert-error { border-color: color-mix(in srgb, #fb7185 40%, var(--line)); color: #fb7185; }
.knowledge-create-panel { margin-bottom: 18px; }
.knowledge-list { display: grid; gap: 10px; }
.knowledge-document { border: 1px solid var(--line); border-radius: 8px; }
.knowledge-document summary { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 15px; cursor: pointer; }
.knowledge-document summary span { color: var(--muted); font-size: 11px; }
.knowledge-form { display: grid; gap: 14px; padding: 0 15px 15px; }
.knowledge-form label { display: grid; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 650; }
.knowledge-form input, .knowledge-form textarea { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 7px; outline: 0; background: var(--surface); color: var(--ink); font: 12px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; }
.knowledge-form textarea { resize: vertical; }
.knowledge-form input:focus, .knowledge-form textarea:focus { border-color: var(--accent); }
.knowledge-actions { display: flex; justify-content: flex-end; gap: 9px; }
.knowledge-document > form:last-child { padding: 0 15px 15px; text-align: right; }
@media (max-width: 1050px) { .manager-metrics { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 760px) { .manager-page { overflow: auto; }.manager-shell { display: block; height: auto; min-height: 100dvh; }.manager-sidebar { position: static; gap: 14px; padding: 15px; overflow: visible; border-right: 0; border-bottom: 1px solid var(--line); }.manager-main { overflow: visible; }.manager-brand { padding-bottom: 12px; }.manager-nav { grid-template-columns: repeat(4, 1fr); }.manager-nav-item { flex-direction: column; gap: 4px; padding: 8px 4px; font-size: 10px; text-align: center; }.manager-nav-item span { width: auto; }.manager-sidebar-footer { display: none; }.manager-topbar { min-height: 68px; padding: 14px 16px; }.manager-topbar h1 { font-size: 18px; }.manager-content { padding: 22px 14px 35px; }.manager-metrics, .manager-grid-two { grid-template-columns: 1fr; }.manager-metric { min-height: 88px; }.manager-metric strong { margin-top: 12px; }.manager-heading { align-items: start; flex-direction: column; }.manager-table { font-size: 11px; } }

/* Storage account */
.account-profile-storage dd {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px;
}

.account-profile-storage button {
  margin-left: auto;
  padding: 5px 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  font: inherit;
  font-size: 11px;
}

.account-profile-storage small {
  flex-basis: 100%;
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.storage-dialog {
  width: min(94vw, 760px);
  max-height: min(86dvh, 820px);
}

.storage-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 18px 0 10px;
}

.storage-summary div {
  display: grid;
  gap: 4px;
  background: var(--surface-soft);
}

.storage-summary span {
  color: var(--muted);
  text-transform: uppercase;
}

.storage-progress {
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-soft);
}

.storage-progress i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  transition: width 180ms ease;
}

.storage-file-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.storage-file-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface-soft);
}

.storage-file-preview {
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--surface);
  color: var(--muted);
}

.storage-file-preview img {
  display: block;
  width: 100%;
  object-fit: contain;
  object-position: center;
}

.storage-file-preview span {
  padding: 18px;
  font-size: 34px;
}

.storage-file-body {
  display: grid;
  gap: 5px;
  padding: 11px;
}

.storage-file-body strong {
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.storage-file-body small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.storage-file-actions {
  display: flex;
  flex-wrap: wrap;
}

.storage-file-actions a,
.storage-file-actions button,
.storage-footer button {
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  font: inherit;
  font-size: 10px;
  font-weight: 700;
  text-decoration: none;
}

.storage-file-actions button {
  color: var(--danger);
}

.storage-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.storage-status {
  min-height: 18px;
  margin: 0 !important;
}

.storage-empty {
  grid-column: 1 / -1;
  border: 1px dashed var(--border);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.message-attachments {
  display: flex;
  flex-wrap: wrap;
}

.message-attachment-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--primary);
  font-size: 10px;
  text-decoration: none;
}

.message-attachment-link span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 620px) {
  .storage-summary,
  .storage-file-list {
    grid-template-columns: 1fr;
  }

  .storage-file-preview img {
    height: 210px;
  }
}


/* Anteprima immagini interna alla chat */
.image-lightbox[hidden] {
  display: none;
}

.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 24px;
  place-items: center;
  overflow: hidden;
  border: 0;
  background: transparent;
}

.image-lightbox::backdrop {
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(6px);
}

.image-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: transparent;
}

.image-lightbox-dialog {
  position: relative;
  z-index: 1;
  display: grid;
  max-width: min(1100px, 94vw);
  max-height: 92vh;
  gap: 10px;
  place-items: center;
}

.image-lightbox-image {
  display: block;
  max-width: 94vw;
  max-height: 84vh;
  width: auto;
  height: auto;
  background: #05070b;
  object-fit: contain;
}

.image-lightbox-close {
  position: absolute;
  z-index: 2;
  display: grid;
  padding: 0;
  place-items: center;
  border: 0;
  background: transparent;
  color: #fff;
  font-weight: 300;
  line-height: 1;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.85);
  cursor: pointer;
}

.image-lightbox-close:hover {
  opacity: 0.78;
}

.image-lightbox-caption {
  max-width: 90vw;
  color: rgba(255, 255, 255, 0.9);
  font-size: 12px;
  text-align: center;
}

.image-lightbox-open {
  overflow: hidden;
}

.generated-image img,
.message-attachment-link[type="button"] {
  cursor: zoom-in;
}

button.message-attachment-link {
  font: inherit;
  text-align: left;
}

@media (max-width: 620px) {
  .image-lightbox {
    padding: 12px;
  }

  .image-lightbox-image {
    max-width: 96vw;
    max-height: 82vh;
  }

  .image-lightbox-close {
    top: 8px;
    right: 8px;
  }
}

.message-actions button[data-message-action="finance_pdf"],
.message-actions button[data-message-action="finance_monitor"] {
  color: var(--primary);
}

.message-actions button[data-message-action="finance_monitor"]:disabled {
  cursor: wait;
  opacity: 0.55;
}

/* Specializzazioni chat */

.specialization-suggestion-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.specialization-suggestion-actions button {
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-soft);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 11px;
}

.specialization-suggestion-actions button:hover,
.specialization-suggestion-actions button:focus-visible {
  border-color: color-mix(in srgb, var(--primary) 55%, var(--border));
  outline: 0;
}

.specialization-suggestion-actions .specialization-suggestion-primary {
  border-color: color-mix(in srgb, var(--primary) 55%, var(--border));
  color: var(--primary);
}

.history-group {
  display: grid;
  margin: 0 0 9px;
}

.history-group-title {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-weight: 760;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.history-group-icon {
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.history-group + .history-group {
  padding-top: 5px;
  border-top: 1px solid var(--border);
}

/* Avviso Storage nella top bar */
.storage-warning-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border: 1px solid color-mix(in srgb, var(--danger) 42%, var(--border));
  background: color-mix(in srgb, var(--danger) 8%, transparent);
  color: var(--danger);
  cursor: pointer;
  font: inherit;
  font-size: 10.5px;
  font-weight: 750;
  white-space: nowrap;
}

.storage-warning-trigger[hidden] {
  display: none;
}

.storage-warning-trigger:hover,
.storage-warning-trigger:focus-visible {
  background: color-mix(in srgb, var(--danger) 14%, transparent);
  outline: 0;
}

.storage-warning-mark {
  display: grid;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  line-height: 1;
}

/* Esperienza immagini: formato, galleria e risorse */
.image-format-select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--text);
  padding: 0 11px;
}

.image-format-hint {
  display: block;
  margin-top: -5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.generated-image-caption {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* v192.56: fonti dei dati usati per l'immagine (documento, risposte precedenti). */
.generated-image-sources {
  flex: 1 0 100%;
  order: 3;
  margin: 0;
  padding: 0 7px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.generated-image-primary-actions,
.image-collection-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.generated-image-primary-actions a,
.generated-image-primary-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 7px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 10.5px;
  font-weight: 400;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
}

.generated-image-primary-actions a:hover,
.generated-image-primary-actions a:focus-visible,
.generated-image-primary-actions button:hover,
.generated-image-primary-actions button:focus-visible {
  background: var(--surface-soft);
  color: var(--primary);
  outline: 0;
}

.image-collection-actions button,
.image-collection-actions a {
  border: 0;
  background: transparent;
  padding: 0;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}

.image-collection-actions button:hover,
.image-collection-actions a:hover {
  text-decoration: underline;
}

.image-library-dialog,
.image-assets-dialog {
  width: min(1000px, calc(100vw - 32px));
}

.image-library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  max-height: min(62vh, 680px);
  overflow: auto;
}

.image-collection-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface-soft);
}

.image-collection-card > img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  cursor: zoom-in;
  background: var(--surface);
}

/* Risorse immagini: miniature compatte, sempre visibili per intero. */
.image-assets-grid {
  grid-template-columns: repeat(auto-fill, minmax(150px, 180px));
  justify-content: start;
  align-items: start;
}

.image-assets-grid .image-collection-card > img {
  width: 100%;
  height: 140px;
  aspect-ratio: auto;
  box-sizing: border-box;
  padding: 10px;
  object-fit: contain;
  object-position: center;
}

.image-collection-card-body {
  display: grid;
  gap: 7px;
  padding: 10px;
}

.image-collection-card-body > strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-collection-card-body > small {
  color: var(--muted);
}

.image-collection-actions .is-danger {
  color: var(--danger);
}

.image-asset-upload {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.4fr) auto;
  align-items: end;
  margin-bottom: 12px;
}

.image-asset-upload input[type="text"],
.image-asset-upload input[type="file"] {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--text);
  padding: 9px 11px;
  font: inherit;
}

.image-asset-upload input[type="file"] {
  padding: 4px 6px;
  cursor: pointer;
}

.image-asset-upload input[type="file"]::file-selector-button {
  margin-right: 10px;
  padding: 6px 11px;
  border: 0;
  border-radius: 8px;
  background: color-mix(in srgb, var(--primary) 16%, var(--surface-elevated));
  color: var(--primary);
  cursor: pointer;
  font: inherit;
  font-weight: 750;
}

.image-asset-upload input[type="file"]::file-selector-button:hover {
  background: color-mix(in srgb, var(--primary) 24%, var(--surface-elevated));
}

.image-asset-upload button {
  padding: 0 15px;
  border: 0;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 750;
}

.image-asset-upload button:hover,
.image-asset-upload button:focus-visible {
  filter: brightness(1.08);
  outline: 0;
}

.image-asset-upload button:disabled {
  cursor: wait;
  opacity: .6;
}

@media (max-width: 700px) {
  .image-library-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .image-asset-upload {
    grid-template-columns: 1fr;
  }
}

/* UX refresh 23/08/2026 */
:root {
  --border-strong: color-mix(in srgb, var(--text) 16%, var(--border));
  --primary-soft: color-mix(in srgb, var(--primary) 12%, transparent);
  --primary-soft-strong: color-mix(in srgb, var(--primary) 20%, transparent);
  --surface-glass: color-mix(in srgb, var(--surface-elevated) 90%, transparent);
  --surface-hover: color-mix(in srgb, var(--surface-soft) 78%, var(--surface-elevated));
  --focus-ring: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
  --soft-shadow: 0 14px 34px rgba(0, 0, 0, .14);
}

:root[data-theme="light"] {
  --soft-shadow: 0 14px 34px rgba(31, 52, 84, .09);
}

.main-content {
  background:
    radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--primary) 5%, transparent), transparent 34%),
    var(--background);
}

.topbar {
  min-height: 68px;
  padding: 12px 20px;
  border-bottom-color: color-mix(in srgb, var(--border) 82%, transparent);
  background: color-mix(in srgb, var(--background) 82%, transparent);
  box-shadow: 0 1px 0 color-mix(in srgb, var(--text) 2%, transparent);
  backdrop-filter: blur(22px) saturate(135%);
}

.topbar-title {
  gap: 0;
}

.topbar-title strong {
  font-size: 16px;
  letter-spacing: -.015em;
}

.topbar-title span {
  margin-top: 1px;
  font-size: 10.5px;
  letter-spacing: .02em;
}

.topbar-actions {
  gap: 7px;
}

.icon-button,
.install-pwa-button,
.account-login-trigger,
.user-account-trigger,
.storage-warning-trigger {
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

.icon-button:hover,
.install-pwa-button:hover,
.account-login-trigger:hover,
.user-account-trigger:hover,
.storage-warning-trigger:hover {
  transform: translateY(-1px);
}

.icon-button:active,
.install-pwa-button:active,
.account-login-trigger:active,
.user-account-trigger:active,
.storage-warning-trigger:active {
  transform: translateY(0);
}

.sidebar {
  padding: 18px 14px 16px;
  border-right-color: color-mix(in srgb, var(--border) 78%, transparent);
  background: color-mix(in srgb, var(--surface) 96%, var(--background));
}

.sidebar-header {
  min-height: 50px;
  padding: 0 4px;
}

.brand-image-full {
  width: 158px;
}

.navigation {
  gap: 10px;
  margin-top: 24px;
}

.nav-item {
  min-height: 44px;
  padding: 0 12px;
  border-radius: 12px;
  font-size: 13px;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.nav-item.new-conversation {
  border-color: color-mix(in srgb, var(--primary) 28%, var(--border));
  background: color-mix(in srgb, var(--primary) 9%, var(--surface));
  color: var(--text);
  box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 4%, transparent);
}

.nav-item.new-conversation svg {
  color: var(--primary);
}

.nav-item.new-conversation:hover,
.nav-item.new-conversation:focus-visible {
  border-color: color-mix(in srgb, var(--primary) 48%, var(--border));
  background: color-mix(in srgb, var(--primary) 14%, var(--surface));
  transform: translateY(-1px);
}

.sidebar-history {
  margin-top: 15px;
}

.sidebar-history > strong {
  padding: 0 11px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 760;
  letter-spacing: .065em;
  text-transform: uppercase;
}

.history-list {
  gap: 2px;
  padding-right: 2px;
}

.history-group {
  gap: 2px;
  margin-bottom: 7px;
}

.history-group-title {
  padding: 8px 10px 4px;
  font-size: 9px;
}

.history-item {
  position: relative;
  min-height: 44px;
  gap: 2px;
  padding: 8px 10px 8px 12px;
  border-radius: 10px;
  transition: background-color 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.history-item:hover,
.history-item:focus-visible {
  transform: translateX(1px);
}

.history-item.is-active {
  border-color: color-mix(in srgb, var(--primary) 25%, var(--border));
  background: color-mix(in srgb, var(--primary) 9%, var(--surface-soft));
}

.history-item.is-active::before {
  position: absolute;
  top: 9px;
  bottom: 9px;
  left: 4px;
  width: 2px;
  border-radius: 999px;
  background: var(--primary);
  content: "";
}

.history-controls {
  padding-left: 12px;
}

.sidebar-footer {
  padding: 12px 5px 0;
}

.sidebar-meta {
  opacity: .78;
}

.laboratorio-content {
  padding: 20px 30px 22px;
}

.conversation {
  width: min(980px, 100%);
  padding-top: 8px;
}

.demo-intro {
  max-width: 900px;
  margin-bottom: 18px;
  padding: 8px 14px 0;
}

.demo-intro-mark {
  display: grid;
  width: 54px;
  height: 54px;
  margin: 0 auto 14px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--primary) 24%, var(--border));
  border-radius: 17px;
  background: color-mix(in srgb, var(--primary) 8%, var(--surface-elevated));
  box-shadow: var(--soft-shadow);
}

.demo-intro-mark img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.demo-intro h1 {
  margin: 0 0 8px;
  color: var(--text);
  font-size: clamp(24px, 3vw, 34px);
  font-weight: 720;
  letter-spacing: -.035em;
  line-height: 1.08;
}

.demo-intro p {
  margin-bottom: 0;
}

.demo-intro .demo-intro-lead {
  max-width: 680px;
  color: color-mix(in srgb, var(--text) 78%, var(--muted));
  font-size: 14px;
  line-height: 1.55;
}

.starter-actions {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 9px;
  max-width: 900px;
  margin: 18px auto 0;
}

.starter-actions button {
  position: relative;
  min-height: 72px;
  align-items: flex-start;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding: 11px 12px;
  border-color: color-mix(in srgb, var(--border) 88%, transparent);
  border-radius: 15px;
  background: color-mix(in srgb, var(--surface-elevated) 88%, var(--background));
  box-shadow: 0 8px 22px rgba(0, 0, 0, .07);
  font-size: 11px;
  line-height: 1.28;
  transition: transform 150ms ease, background-color 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

:root[data-theme="light"] .starter-actions button {
  box-shadow: 0 8px 20px rgba(29, 50, 79, .05);
}

.starter-actions button:hover,
.starter-actions button:focus-visible {
  border-color: color-mix(in srgb, var(--primary) 38%, var(--border));
  background: color-mix(in srgb, var(--primary) 7%, var(--surface-elevated));
  box-shadow: 0 12px 28px rgba(0, 0, 0, .1);
  transform: translateY(-2px);
}

.starter-actions button:active {
  transform: translateY(0);
}

.quick-icon {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 9px;
  background: var(--primary-soft);
  font-size: 15px;
}

.message-list {
  padding-inline: 14px;
  scrollbar-gutter: stable;
}

.message-bubble {
  max-width: min(86%, 820px);
  font-size: 14px;
}

.message-user .message-bubble {
  padding: 11px 15px;
  border-color: color-mix(in srgb, var(--primary) 18%, var(--border));
  border-radius: 18px 18px 6px 18px;
  background: color-mix(in srgb, var(--primary) 8%, var(--surface-soft));
  box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 3%, transparent);
}

.message-assistant .message-bubble {
  padding: 3px 0;
}

.message-actions {
  gap: 2px;
}

.message-actions button {
  min-height: 28px;
  padding: 4px 6px;
  border-radius: 7px;
  font-size: 10px;
  transition: background-color 140ms ease, color 140ms ease;
}

.message-sources {
  margin-top: 9px;
}

.message-assistant .assistant-code-block {
  margin: 14px 0;
  border-radius: 13px;
  box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 3%, transparent);
}

.message-assistant .assistant-code-block-header {
  padding-inline: 14px 8px;
}

.message-assistant .assistant-code-copy {
  border: 0;
  background: transparent;
  color: var(--muted);
}

.message-assistant .assistant-code-copy:hover,
.message-assistant .assistant-code-copy:focus-visible {
  background: var(--surface-hover);
  color: var(--primary);
}

.conversation-tools {
  padding: 0 14px 3px;
}

.conversation-tools-trigger {
  min-height: 32px;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 9px;
  font-size: 10px;
}

.conversation-tools-menu,
.attachment-menu,
.account-dropdown,
.municipality-menu {
  border-color: color-mix(in srgb, var(--border) 86%, transparent);
  background: var(--surface-glass);
  box-shadow: 0 22px 60px rgba(0, 0, 0, .28);
  backdrop-filter: blur(20px) saturate(135%);
}

.account-dropdown {
  width: 232px;
  gap: 2px;
  padding: 7px;
  border-radius: 14px;
}

.account-dropdown button,
.account-dropdown > a {
  display: flex;
  min-height: 39px;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 9px;
  font-size: 11.5px;
}

.account-dropdown button svg,
.account-dropdown > a svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  color: var(--muted);
  stroke-width: 1.75;
}

.account-dropdown button:hover svg,
.account-dropdown button:focus-visible svg,
.account-dropdown > a:hover svg,
.account-dropdown > a:focus-visible svg {
  color: var(--primary);
}

.account-dropdown .is-danger:hover svg,
.account-dropdown .is-danger:focus-visible svg {
  color: var(--danger);
}

.account-dropdown form {
  margin-top: 3px;
  padding-top: 4px;
}

.account-login-trigger,
.user-account-trigger {
  min-height: 40px;
  border-color: color-mix(in srgb, var(--border) 88%, transparent);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface-elevated) 88%, transparent);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .06);
}

.user-account-trigger > img,
.user-account-initial {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: color-mix(in srgb, var(--primary) 13%, var(--surface-soft));
}

.user-account-trigger strong {
  font-size: 10.5px;
  font-weight: 700;
}

.install-pwa-button {
  min-height: 38px;
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 10.5px;
}

.storage-warning-trigger {
  min-height: 38px;
  padding-inline: 9px;
  border-radius: 10px;
}

.storage-warning-mark {
  width: 16px;
  height: 16px;
  font-size: 10px;
}

.composer {
  gap: 6px;
  padding: 11px 12px 9px;
  border-color: color-mix(in srgb, var(--border) 90%, transparent);
  border-radius: 20px;
  background: color-mix(in srgb, var(--surface-elevated) 96%, transparent);
  box-shadow: 0 16px 38px rgba(0, 0, 0, .15), inset 0 1px 0 color-mix(in srgb, #fff 3%, transparent);
  backdrop-filter: blur(16px);
  transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

:root[data-theme="light"] .composer {
  box-shadow: 0 14px 34px rgba(31, 52, 84, .1), inset 0 1px 0 rgba(255, 255, 255, .8);
}

.composer:focus-within {
  border-color: color-mix(in srgb, var(--primary) 52%, var(--border));
  box-shadow: 0 18px 42px rgba(0, 0, 0, .17), var(--focus-ring);
}

.composer textarea {
  min-height: 46px;
  max-height: 180px;
  padding: 5px 7px 4px;
  font-size: 15px;
  line-height: 1.5;
}

.composer-toolbar {
  min-height: 34px;
}

.attachment-button,
.voice-button {
  width: 34px;
  height: 34px;
  border-radius: 10px;
}

.attachment-button svg,
.voice-button svg {
  width: 18px;
  height: 18px;
}

.municipality-selector {
  min-height: 34px;
  padding: 5px 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface-soft) 58%, transparent);
  font-size: 11px;
}

.municipality-selector:hover,
.municipality-selector[aria-expanded="true"] {
  border-color: color-mix(in srgb, var(--primary) 20%, var(--border));
  background: color-mix(in srgb, var(--primary) 9%, var(--surface-soft));
}

.reasoning-toggle {
  display: flex;
  min-height: 34px;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface-soft) 58%, transparent);
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  transition: border-color 140ms ease, background-color 140ms ease, color 140ms ease;
}

.reasoning-toggle:hover {
  border-color: color-mix(in srgb, var(--primary) 20%, var(--border));
  background: color-mix(in srgb, var(--primary) 9%, var(--surface-soft));
  color: var(--text);
}

.reasoning-toggle.is-active {
  border-color: color-mix(in srgb, var(--primary) 38%, var(--border));
  background: color-mix(in srgb, var(--primary) 16%, var(--surface-soft));
  color: var(--primary);
}

.reasoning-toggle.is-auto-active {
  animation: dalila-loader-pulse 700ms infinite alternate;
}

.reasoning-toggle:disabled {
  cursor: default;
  opacity: .5;
}

.reasoning-toggle svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.65;
}

.send-button {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  box-shadow: 0 7px 18px color-mix(in srgb, var(--primary) 24%, transparent);
  transition: background-color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

.send-button:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: 0 9px 22px color-mix(in srgb, var(--primary) 30%, transparent);
}

.send-button:not(:disabled):active {
  transform: translateY(0);
}

.send-button:disabled {
  box-shadow: none;
  opacity: .32;
}

.composer-caption {
  gap: 6px 12px;
  margin-top: 9px;
  font-size: 9.5px;
  line-height: 1.35;
  opacity: .84;
}

.selected-images {
  gap: 8px;
  padding: 0 5px 9px;
}

.selected-image,
.selected-document {
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .08);
}

.selected-image-remove {
  top: 5px;
  right: 5px;
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 7px;
  background: rgba(7, 11, 20, .72);
  backdrop-filter: blur(7px);
  font-size: 16px;
}

.account-dialog,
.login-dialog {
  border-color: color-mix(in srgb, var(--border) 88%, transparent);
  background: color-mix(in srgb, var(--surface-elevated) 98%, var(--background));
  box-shadow: 0 30px 90px rgba(0, 0, 0, .38);
}

.account-dialog {
  width: min(92vw, 500px);
  max-height: min(88dvh, 860px);
  padding: 26px 28px 28px;
  overflow: auto;
  border-radius: 22px;
}

.account-dialog::backdrop,
.login-dialog::backdrop {
  background: color-mix(in srgb, #02050b 72%, transparent);
  backdrop-filter: blur(10px) saturate(90%);
}

.account-dialog h2 {
  margin: 0 42px 8px 0;
  background: transparent;
  font-size: 21px;
  font-weight: 720;
  letter-spacing: -.025em;
}

.account-dialog > p:first-of-type {
  margin-top: 0;
}

.account-dialog p {
  font-size: 12px;
  line-height: 1.55;
}

.account-dialog-close,
.login-dialog-close {
  top: 15px;
  right: 17px;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 25px;
  line-height: 1;
  transition: color 140ms ease, background-color 140ms ease;
}

.account-dialog-close:hover,
.account-dialog-close:focus-visible,
.login-dialog-close:hover,
.login-dialog-close:focus-visible {
  background: var(--surface-soft);
  color: var(--text);
  outline: 0;
}

.account-profile-data {
  gap: 8px;
  margin-top: 16px;
}

.account-profile-data div {
  padding: 13px 14px;
  border: 1px solid color-mix(in srgb, var(--border) 72%, transparent);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface-soft) 72%, transparent);
}

.account-profile-data dt {
  font-size: 9px;
  letter-spacing: .055em;
}

.account-profile-data dd {
  margin-top: 5px;
}

.profile-municipality-actions button,
.account-profile-storage button {
  border: 0;
  background: transparent;
  color: var(--primary);
  font-size: 10px;
}

.profile-municipality-actions button:hover,
.account-profile-storage button:hover {
  text-decoration: underline;
}

.improvement-consent-control input {
  width: 42px;
  height: 24px;
}

.improvement-consent-control input::before {
  width: 18px;
  height: 18px;
}

.improvement-consent-control input:checked::before {
  transform: translateX(18px);
}

.storage-dialog,
.image-library-dialog,
.image-assets-dialog {
  width: min(1040px, calc(100vw - 38px));
  max-height: min(90dvh, 880px);
}

.storage-summary {
  gap: 9px;
  margin-top: 17px;
}

.storage-summary div {
  padding: 13px 14px;
  border: 1px solid color-mix(in srgb, var(--border) 68%, transparent);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface-soft) 66%, transparent);
}

.storage-summary span {
  font-size: 9px;
  letter-spacing: .06em;
}

.storage-summary strong {
  font-size: 16px;
}

.storage-progress {
  height: 8px;
  margin-top: 4px;
  background: color-mix(in srgb, var(--surface-soft) 88%, var(--background));
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .12);
}

.storage-progress i {
  box-shadow: 0 0 16px color-mix(in srgb, var(--primary) 30%, transparent);
}

.storage-file-list {
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.storage-file-card,
.image-collection-card {
  border-color: color-mix(in srgb, var(--border) 85%, transparent);
  background: color-mix(in srgb, var(--surface-soft) 74%, transparent);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .07);
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.storage-file-card:hover,
.image-collection-card:hover {
  border-color: color-mix(in srgb, var(--primary) 26%, var(--border));
  box-shadow: 0 13px 30px rgba(0, 0, 0, .11);
  transform: translateY(-2px);
}

.storage-file-preview {
  min-height: 146px;
  background: color-mix(in srgb, var(--surface) 92%, var(--background));
}

.storage-file-preview img {
  height: 178px;
  transition: transform 180ms ease;
}

.storage-file-card:hover .storage-file-preview img,
.image-collection-card:hover > img {
  transform: scale(1.015);
}

.storage-file-body,
.image-collection-card-body {
  gap: 5px;
  padding: 11px 12px 12px;
}

.storage-file-actions {
  gap: 10px;
  padding-top: 4px;
}

.storage-file-actions a,
.storage-file-actions button {
  padding: 2px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
}

.storage-file-actions a:hover,
.storage-file-actions a:focus-visible,
.storage-file-actions button:hover,
.storage-file-actions button:focus-visible {
  color: var(--primary);
  text-decoration: none;
  outline: 0;
}

.storage-file-actions button:hover,
.storage-file-actions button:focus-visible {
  color: var(--danger);
}

.storage-footer {
  min-height: 34px;
  margin-top: 13px;
}

.storage-footer > button {
  min-height: 32px;
  padding: 5px 10px;
  border-radius: 8px;
  background: var(--surface-soft);
  font-size: 10px;
}

.storage-empty {
  padding: 36px 24px;
  border-style: dashed;
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface-soft) 42%, transparent);
}

.image-library-grid {
  grid-template-columns: repeat(auto-fill, minmax(205px, 1fr));
  gap: 12px;
  max-height: min(64vh, 690px);
  padding: 2px 4px 6px 2px;
}

.image-collection-card {
  border-radius: 14px;
}

.image-collection-card > img {
  background: color-mix(in srgb, var(--surface) 94%, var(--background));
  transition: transform 180ms ease;
}

.image-collection-card-body > strong {
  font-size: 11.5px;
}

.image-collection-card-body > small {
  font-size: 9.5px;
}

.image-collection-actions {
  gap: 10px;
  padding-top: 2px;
}

.image-collection-actions button,
.image-collection-actions a {
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
}

.image-collection-actions button:hover,
.image-collection-actions button:focus-visible,
.image-collection-actions a:hover,
.image-collection-actions a:focus-visible {
  color: var(--primary);
  text-decoration: none;
  outline: 0;
}

.image-collection-actions .is-danger:hover,
.image-collection-actions .is-danger:focus-visible {
  color: var(--danger);
}

.image-asset-upload {
  grid-template-columns: minmax(180px, .9fr) minmax(250px, 1.35fr) auto;
  gap: 10px 12px;
  margin: 16px 0 18px;
  padding: 13px;
  border: 1px solid color-mix(in srgb, var(--border) 78%, transparent);
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface-soft) 54%, transparent);
}

.image-asset-upload label {
  display: block;
  margin: 0 0 -4px 2px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 720;
  letter-spacing: .045em;
  text-transform: uppercase;
}

.image-asset-upload label:nth-of-type(1) {
  grid-column: 1;
  grid-row: 1;
}

.image-asset-upload input[type="text"] {
  grid-column: 1;
  grid-row: 2;
}

.image-asset-upload label:nth-of-type(2) {
  grid-column: 2;
  grid-row: 1;
}

.image-asset-upload input[type="file"] {
  grid-column: 2;
  grid-row: 2;
}

.image-asset-upload button {
  grid-column: 3;
  grid-row: 1 / span 2;
  align-self: end;
  min-height: 42px;
  border-radius: 10px;
  box-shadow: 0 8px 20px color-mix(in srgb, var(--primary) 18%, transparent);
}

.image-asset-upload input[type="text"],
.image-asset-upload input[type="file"],
.image-format-select,
.image-generation-dialog textarea,
.municipality-dialog input {
  border-color: color-mix(in srgb, var(--border) 90%, transparent);
  background: color-mix(in srgb, var(--surface) 52%, var(--surface-soft));
  transition: border-color 140ms ease, box-shadow 140ms ease, background-color 140ms ease;
}

.image-asset-upload input[type="text"]:focus,
.image-asset-upload input[type="file"]:focus,
.image-format-select:focus,
.image-generation-dialog textarea:focus,
.municipality-dialog input:focus {
  border-color: color-mix(in srgb, var(--primary) 60%, var(--border));
  box-shadow: var(--focus-ring);
  outline: 0;
}

.image-asset-upload input[type="file"]::file-selector-button {
  min-height: 31px;
  border: 1px solid color-mix(in srgb, var(--primary) 24%, var(--border));
  background: color-mix(in srgb, var(--primary) 9%, var(--surface-elevated));
  font-size: 10px;
}

.image-generation-footer button,
.image-generation-login,
.image-asset-upload button,
.account-delete-dialog form button {
  transition: transform 140ms ease, background-color 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.image-generation-footer button:not(:disabled):hover,
.image-generation-login:hover,
.image-asset-upload button:not(:disabled):hover {
  filter: none;
  transform: translateY(-1px);
}

.login-dialog {
  padding: 30px;
  border-radius: 22px;
}

.login-dialog h2 {
  letter-spacing: -.03em;
}

.social-login {
  border-color: color-mix(in srgb, var(--border) 88%, transparent);
  background: color-mix(in srgb, var(--surface-soft) 32%, transparent);
  transition: background-color 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.social-login:hover,
.social-login:focus-visible {
  transform: translateY(-1px);
}

.registration-banner {
  border-bottom-color: color-mix(in srgb, var(--primary) 15%, var(--border));
  background: color-mix(in srgb, var(--primary) 5%, var(--background));
}

.auth-toast {
  border-radius: 14px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .24);
}

.image-lightbox-image {
  border-radius: 16px;
  box-shadow: 0 32px 100px rgba(0, 0, 0, .62);
}

.image-lightbox-close {
  top: -2px;
  right: -4px;
  width: 38px;
  height: 38px;
  font-size: 30px;
}

/* Consistenza dei focus senza aggiungere bordi visivi permanenti */
.nav-item:focus-visible,
.history-item:focus-visible,
.starter-actions button:focus-visible,
.send-button:focus-visible,
.attachment-button:focus-visible,
.voice-button:focus-visible,
.reasoning-toggle:focus-visible,
.municipality-selector:focus-visible,
.account-dropdown button:focus-visible,
.storage-file-actions a:focus-visible,
.storage-file-actions button:focus-visible,
.image-collection-actions a:focus-visible,
.image-collection-actions button:focus-visible {
  box-shadow: var(--focus-ring);
  outline: 0;
}

@media (max-width: 1100px) {
  .starter-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .topbar {
    min-height: 62px;
    padding-top: max(8px, env(safe-area-inset-top));
    padding-bottom: 8px;
  }

  .topbar-title strong {
    font-size: 14px;
  }

  .topbar-title span {
    font-size: 9px;
  }

  .laboratorio-content {
    padding: 8px max(10px, env(safe-area-inset-right)) max(5px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  }

  .demo-intro {
    margin-bottom: 8px;
    padding-inline: 5px;
  }

  .demo-intro-mark {
    width: 46px;
    height: 46px;
    margin-bottom: 10px;
    border-radius: 14px;
  }

  .demo-intro-mark img {
    width: 29px;
    height: 29px;
  }

  .demo-intro h1 {
    margin-bottom: 6px;
    font-size: 24px;
  }

  .demo-intro .demo-intro-lead {
    font-size: 12px;
    line-height: 1.45;
  }

  .demo-intro.is-returning .demo-intro-mark,
  .demo-intro.is-returning h1 {
    display: none;
  }

  .demo-intro.is-returning .demo-intro-lead {
    display: block !important;
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 10.5px;
  }

  .starter-actions,
  .demo-intro.is-returning .starter-actions {
    display: flex;
    grid-template-columns: none;
    gap: 7px;
    margin-top: 11px;
    overflow-x: auto;
    padding: 1px 2px 5px;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }

  .starter-actions::-webkit-scrollbar {
    display: none;
  }

  .starter-actions button,
  .demo-intro.is-returning .starter-actions button {
    min-width: 154px;
    min-height: 64px;
    flex: 0 0 154px;
    scroll-snap-align: start;
    padding: 9px 10px;
    font-size: 10px;
  }

  .quick-icon {
    width: 25px;
    height: 25px;
    font-size: 13px;
  }

  .message-list,
  .conversation.has-messages .message-list {
    padding-inline: 4px;
  }

  .message-bubble {
    max-width: 94%;
    font-size: 13px;
    line-height: 1.52;
  }

  .message-user .message-bubble {
    padding: 10px 13px;
  }

  .conversation-tools {
    padding-right: 0;
  }

  .composer {
    gap: 5px;
    padding: 9px 10px 8px;
    border-radius: 18px;
  }

  .composer textarea {
    min-height: 42px;
    max-height: 140px;
    font-size: 16px;
  }

  .attachment-button,
  .voice-button {
    width: 32px;
    height: 32px;
  }

  .municipality-selector {
    max-width: 148px;
    min-height: 32px;
    font-size: 10px;
  }

  .reasoning-toggle {
    min-height: 32px;
    padding-inline: 7px;
    font-size: 10px;
  }

  .send-button {
    width: 34px;
    height: 34px;
  }

  .composer-caption {
    margin-top: 4px;
    font-size: 9px;
  }

  .storage-warning-trigger {
    min-height: 34px;
    padding-inline: 7px;
  }

  .storage-warning-trigger span:last-child {
    font-size: 9px;
  }

  .account-dialog,
  .login-dialog,
  .image-generation-dialog {
    width: 100vw;
    max-width: none;
    max-height: min(90dvh, calc(var(--dalila-viewport-height, 100dvh) - 18px));
    margin: auto 0 0;
    padding: 24px 18px max(22px, env(safe-area-inset-bottom));
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 22px 22px 0 0;
  }

  .account-dialog h2 {
    font-size: 20px;
  }

  .account-dialog-close,
  .login-dialog-close {
    top: 12px;
    right: 14px;
  }

  .storage-summary {
    grid-template-columns: 1fr 1fr;
  }

  .storage-file-list {
    grid-template-columns: 1fr 1fr;
    gap: 9px;
  }

  .storage-file-preview img {
    height: 145px;
  }

  .image-library-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
    max-height: none;
    overflow: visible;
  }

  .image-collection-card-body,
  .storage-file-body {
    padding: 9px;
  }

  .image-collection-actions,
  .storage-file-actions {
    gap: 8px;
  }

  .image-asset-upload {
    grid-template-columns: 1fr;
    padding: 11px;
  }

  .image-asset-upload label:nth-of-type(1),
  .image-asset-upload input[type="text"],
  .image-asset-upload label:nth-of-type(2),
  .image-asset-upload input[type="file"],
  .image-asset-upload button {
    grid-column: 1;
    grid-row: auto;
  }

  .image-asset-upload button {
    width: 100%;
    margin-top: 2px;
  }
}

@media (max-width: 460px) {
  .topbar-actions {
    gap: 3px;
  }

  .install-pwa-button {
    display: none;
  }

  .storage-warning-trigger span:last-child {
    max-width: 78px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .storage-file-list {
    grid-template-columns: 1fr;
  }

  .storage-file-preview img {
    height: 205px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .nav-item,
  .history-item,
  .starter-actions button,
  .storage-file-card,
  .image-collection-card,
  .send-button,
  .icon-button,
  .install-pwa-button,
  .account-login-trigger,
  .user-account-trigger,
  .storage-warning-trigger,
  .social-login,
  .image-generation-footer button,
  .image-generation-login,
  .image-asset-upload button {
    transition: none !important;
  }
}


/* Fluidita delle risposte e reveal immagini */
.message-assistant .message-bubble.is-fluid-streaming::after {
  display: inline-block;
}

.message-assistant .message-bubble.is-fluid-streaming .assistant-code-copy {
  pointer-events: none;
  opacity: .45;
}

.generated-image-stage {
  position: relative;
  width: 100%;
  min-height: 180px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--border) 72%, transparent);
  border-radius: 16px;
  background:
    linear-gradient(110deg, transparent 24%, color-mix(in srgb, var(--text) 7%, transparent) 42%, transparent 60%),
    color-mix(in srgb, var(--surface-soft) 78%, var(--surface));
  background-size: 240% 100%, 100% 100%;
}

.generated-image-stage.is-square {
  aspect-ratio: 1 / 1;
}

.generated-image-stage.is-landscape {
  aspect-ratio: 16 / 9;
}

.generated-image-stage.is-portrait {
  aspect-ratio: 4 / 5;
}

.generated-image.is-image-loading .generated-image-stage {
  animation: dalila-image-shimmer 1.1s linear infinite;
}

.generated-image-stage img {
  width: 100%;
  height: 100%;
  min-height: inherit;
  border-radius: 0;
  object-fit: cover;
  opacity: 0;
  filter: blur(14px) saturate(.82);
  transform: scale(1.025);
  transition: opacity 420ms ease, filter 520ms ease, transform 520ms ease;
}

.generated-image.is-image-ready .generated-image-stage {
  min-height: 0;
  animation: none;
  background: var(--surface-soft);
}

.generated-image.is-image-ready .generated-image-stage img {
  height: auto;
  min-height: 0;
  opacity: 1;
  filter: none;
  transform: scale(1);
}

@keyframes dalila-writing-caret {
  0%, 46% { opacity: 1; }
  47%, 100% { opacity: .15; }
}

@keyframes dalila-image-shimmer {
  from { background-position: 145% 0, 0 0; }
  to { background-position: -85% 0, 0 0; }
}

@media (prefers-reduced-motion: reduce) {

  .generated-image.is-image-loading .generated-image-stage {
    animation: none;
  }

  .generated-image-stage img {
    transition: none;
  }
}

/* v192.52: strumenti rapidi sulle immagini generate (Modifica, Rimuovi
   sfondo, Cambia sfondo, Migliora). Stessi colori del tema. */
.generated-image-tools-wrap {
  display: grid;
  gap: 7px;
  width: 100%;
  min-width: 0;
}

.generated-image-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.generated-image-tools[hidden],
.generated-image-tool-input[hidden] {
  display: none;
}

.generated-image-tool {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 5px;
  min-height: 30px;
  padding: 5px 10px 5px 8px;
  border: 1px solid color-mix(in srgb, var(--border) 85%, transparent);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.generated-image-tool svg {
  flex: 0 0 auto;
  width: 15px !important;
  height: 15px !important;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: var(--primary);
}

.generated-image-tool:hover,
.generated-image-tool:focus-visible,
.generated-image-tool[aria-expanded="true"] {
  border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
  background: var(--surface-soft);
  outline: 0;
}

.generated-image-tool:disabled {
  cursor: default;
  opacity: .55;
}

.generated-image-tool.is-busy {
  opacity: 1;
  border-color: color-mix(in srgb, var(--primary) 55%, var(--border));
}

.generated-image-tool.is-busy svg {
  animation: dalila-image-tool-spin 900ms linear infinite;
}

@keyframes dalila-image-tool-spin {
  to { transform: rotate(360deg); }
}

.generated-image-tool-input {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.generated-image-tool-input input {
  flex: 1 1 auto;
  min-width: 0;
  height: 32px;
  padding: 0 12px;
  border: 1px solid color-mix(in srgb, var(--border) 90%, transparent);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
}

.generated-image-tool-input input:focus {
  border-color: color-mix(in srgb, var(--primary) 60%, var(--border));
  outline: 0;
}

.generated-image-tool-apply,
.generated-image-tool-cancel {
  flex: 0 0 auto;
  height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.generated-image-tool-apply {
  background: var(--primary);
  color: #fff;
}

.generated-image-tool-cancel {
  background: transparent;
  color: var(--muted);
}

/* PNG trasparente: scacchiera neutra dietro l'immagine. */
.generated-image-stage.has-transparency,
.generated-image.is-image-ready .generated-image-stage.has-transparency {
  background-color: #ffffff;
  background-image:
    linear-gradient(45deg, #d9dee6 25%, transparent 25%),
    linear-gradient(-45deg, #d9dee6 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #d9dee6 75%),
    linear-gradient(-45deg, transparent 75%, #d9dee6 75%);
  background-size: 18px 18px;
  background-position: 0 0, 0 9px, 9px -9px, -9px 0;
}

.generated-image-stage.has-transparency img {
  object-fit: contain;
}

@media (max-width: 640px) {
  /* Mobile: una riga ordinata scorrevole, senza tagliare le etichette. */
  .generated-image-tools {
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
  }

  .generated-image-tools::-webkit-scrollbar {
    display: none;
  }

  .generated-image-tool {
    min-height: 34px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .generated-image-tool.is-busy svg {
    animation: none;
  }
}

/* Email pronta: oggetto e corpo separati, copiabili senza perdere formattazione. */
.assistant-email-card {
  display: grid;
  width: min(100%, 900px);
  gap: 10px;
  margin: 2px 0;
}

.assistant-email-card-title {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.assistant-email-field {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-elevated);
}

.assistant-email-field-header {
  display: flex;
  min-height: 38px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 10px 7px 13px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-soft);
}

.assistant-email-field-label {
  color: var(--text);
  font-size: 12px;
  font-weight: 750;
}

.assistant-email-copy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 7px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 650;
}

.assistant-email-copy:hover,
.assistant-email-copy:focus-visible {
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  color: var(--primary);
  outline: none;
}

.assistant-email-copy-icon {
  font-size: 15px;
  line-height: 1;
}

.assistant-email-field pre {
  max-width: 100%;
  margin: 0;
  padding: 13px 15px;
  overflow-x: auto;
  background: transparent;
  color: var(--text);
  white-space: pre-wrap;
  overflow-wrap: normal;
  tab-size: 4;
}

.assistant-email-field code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.65;
  white-space: inherit;
}

/* Sovrascrive lo stile globale degli inline code dentro i messaggi assistente.
   Il testo della mail deve apparire pulito, senza evidenziazione riga per riga. */
.message-assistant .message-bubble .assistant-email-field code {
  display: block;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  line-height: 1.65;
  white-space: inherit;
}

.assistant-email-field-subject pre {
  padding-top: 11px;
  padding-bottom: 11px;
}

.assistant-email-field-subject code {
  font-weight: 650;
}

@media (max-width: 700px) {
  .assistant-email-card {
    width: 100%;
  }

  .assistant-email-field pre {
    padding: 12px;
  }
}

/* Finanza personale: workspace patrimoniale persistente */
.finance-workspace {
  flex: 0 0 auto;
  width: calc(100% - 20px);
  margin: 4px 10px 10px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  overflow: hidden;
}

.finance-workspace[hidden],
.finance-workspace-body[hidden] {
  display: none;
}

.finance-workspace-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border);
}

.finance-workspace-header h2,
.finance-dialog-header h2 {
  margin: 2px 0 3px;
  font-size: 18px;
  line-height: 1.15;
}

.finance-workspace-header p,
.finance-dialog-header p,
.finance-empty p {
  margin: 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.4;
}

.finance-eyebrow {
  display: block;
  color: var(--primary);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.finance-workspace-toggle,
.finance-workspace button,
.finance-portfolio-dialog button,
.finance-management-dialog button {
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface-soft);
  color: var(--text);
  cursor: pointer;
  font: inherit;
}

.finance-workspace-toggle {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 5px 9px;
  font-size: 10.5px;
}

.finance-workspace-body {
  max-height: min(72vh, 820px);
  padding: 12px;
  overflow: auto;
}

.finance-loading {
  padding: 24px 8px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.finance-empty {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px;
  border: 1px dashed var(--border);
  border-radius: 15px;
  background: var(--surface-soft);
}

.finance-empty strong {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
}

.finance-empty-actions,
.finance-workspace-actions,
.finance-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.finance-empty-actions button,
.finance-workspace-actions button,
.finance-dialog-actions button,
.finance-import-picker button,
.finance-add-position {
  min-height: 34px;
  padding: 7px 11px;
  font-size: 11px;
  font-weight: 700;
}

.finance-primary-action {
  border-color: color-mix(in srgb, var(--primary) 60%, var(--border)) !important;
  background: color-mix(in srgb, var(--primary) 15%, var(--surface)) !important;
}

.finance-primary-action:disabled {
  opacity: 0.52;
  cursor: wait;
}

.finance-danger-action {
  color: var(--danger, #dc5c5c) !important;
}

.finance-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

.finance-metric,
.finance-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-soft);
}

.finance-metric {
  min-width: 0;
  padding: 10px 11px;
}

.finance-metric span,
.finance-metric small {
  display: block;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.3;
}

.finance-metric strong {
  display: block;
  margin: 3px 0 2px;
  overflow: hidden;
  font-size: 16px;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.finance-dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

.finance-card {
  padding: 11px;
}

.finance-card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 11px;
}

.finance-card-heading span {
  color: var(--muted);
  font-size: 9.5px;
}

.finance-allocation {
  display: grid;
  gap: 7px;
}

.finance-allocation-row {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) 2fr auto;
  align-items: center;
  gap: 8px;
  font-size: 10.5px;
}

.finance-allocation-track {
  height: 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 14%, transparent);
  overflow: hidden;
}

.finance-allocation-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}

.finance-sparkline {
  min-height: 58px;
}

.finance-sparkline svg {
  display: block;
  width: 100%;
  height: 58px;
}

.finance-sparkline polyline {
  fill: none;
  stroke: var(--primary);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.finance-history {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}

.finance-history-item {
  min-width: 0;
  padding: 6px 7px;
  border-radius: 9px;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
}

.finance-history-item span,
.finance-history-item strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.finance-history-item span {
  color: var(--muted);
  font-size: 8.5px;
}

.finance-history-item strong {
  margin-top: 2px;
  font-size: 10px;
}

.finance-position-list {
  display: grid;
  gap: 4px;
  max-height: 145px;
  overflow: auto;
}

.finance-position-row {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(70px, .8fr) minmax(75px, .8fr) minmax(55px, .6fr);
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 9px;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  font-size: 10px;
}

.finance-position-row strong,
.finance-position-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.finance-position-row span {
  color: var(--muted);
}

.finance-workspace-actions {
  margin-top: 9px;
}

.finance-portfolio-dialog {
  width: min(1180px, calc(100vw - 28px));
  max-width: 1180px;
  height: min(900px, calc(100dvh - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text);
}

.finance-portfolio-dialog::backdrop {
  background: rgb(0 0 0 / .55);
  backdrop-filter: blur(4px);
}

.finance-dialog-shell {
  display: flex;
  height: 100%;
  max-height: calc(100dvh - 34px);
  flex-direction: column;
  padding: 16px;
  overflow: hidden;
}

.finance-dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex: 0 0 auto;
}

.finance-dialog-close {
  display: grid;
  width: 28px !important;
  min-width: 28px !important;
  height: 28px !important;
  min-height: 28px !important;
  place-items: center;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: var(--text);
  font-size: 24px !important;
  line-height: 1 !important;
}

.finance-dialog-close:hover,
.finance-dialog-close:focus-visible {
  background: transparent !important;
}

.finance-import-picker {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 14px;
}

.finance-file-drop {
  display: flex;
  min-height: 64px;
  align-items: flex-start;
  justify-content: center;
  flex-direction: column;
  padding: 10px 14px;
  border: 1px dashed color-mix(in srgb, var(--primary) 55%, var(--border));
  border-radius: 13px;
  background: var(--surface-soft);
  cursor: pointer;
}

.finance-file-drop span {
  font-size: 12px;
  font-weight: 750;
}

.finance-file-drop small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9.5px;
}

.finance-import-status {
  margin-top: 10px;
  padding: 9px 11px;
  border-radius: 11px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 10.5px;
}

.finance-import-status.is-error {
  color: var(--danger, #dc5c5c);
}

.finance-review {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  margin-top: 12px;
  overflow: hidden;
}

.finance-review[hidden] {
  display: none;
}

.finance-review-meta {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 140px;
  gap: 8px;
  margin-bottom: 8px;
}

.finance-review-meta label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 9.5px;
}

.finance-review-meta input,
.finance-review-meta select,
.finance-review-table input,
.finance-review-table select {
  min-height: 32px;
  width: 100%;
  padding: 5px 7px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.finance-review-summary-row {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.finance-review-summary {
  color: var(--muted);
  font-size: 10.5px;
}

.finance-refresh-quotes {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 4px 9px !important;
  font-size: 9.5px !important;
}

.finance-review-table-wrap {
  flex: 1 1 auto;
  min-height: 180px;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable both-edges;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.finance-review-table {
  width: 100%;
  min-width: 860px;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 10px;
}

.finance-review-table th,
.finance-review-table td {
  padding: 5px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

.finance-review-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 8.5px;
  letter-spacing: .02em;
}

.finance-review-table th:nth-child(1),
.finance-review-table td:nth-child(1) { width: 205px; }
.finance-review-table th:nth-child(2),
.finance-review-table td:nth-child(2) { width: 165px; }
.finance-review-table th:nth-child(3),
.finance-review-table td:nth-child(3) { width: 84px; }
.finance-review-table th:nth-child(4),
.finance-review-table td:nth-child(4) { width: 88px; }
.finance-review-table th:nth-child(5),
.finance-review-table td:nth-child(5) { width: 104px; }
.finance-review-table th:nth-child(6),
.finance-review-table td:nth-child(6) { width: 76px; }
.finance-review-table th:nth-child(7),
.finance-review-table td:nth-child(7) { width: 132px; }
.finance-review-table th:nth-child(8),
.finance-review-table td:nth-child(8) { width: 34px; }

.finance-review-table input {
  min-width: 0;
}

.finance-class-combo {
  position: relative;
  display: flex;
  align-items: stretch;
}

.finance-class-combo input {
  padding-right: 30px;
}

.finance-class-toggle {
  position: absolute;
  top: 0;
  right: 3px;
  bottom: 0;
  display: grid;
  width: 22px !important;
  min-width: 22px !important;
  height: auto !important;
  place-items: center;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: var(--muted);
  font-size: 13px !important;
  line-height: 1 !important;
}

.finance-class-toggle:hover,
.finance-class-toggle:focus-visible {
  background: transparent !important;
  color: var(--text);
}

.finance-class-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 8;
  display: grid;
  width: max(160px, 100%);
  max-height: 220px;
  overflow: auto;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 10px 28px rgb(0 0 0 / .28);
}

.finance-class-menu[hidden] {
  display: none;
}

.finance-class-menu button {
  width: 100%;
  min-height: 30px;
  padding: 5px 8px !important;
  border: 0 !important;
  border-radius: 7px !important;
  background: transparent !important;
  text-align: left;
  font-size: 10px !important;
}

.finance-class-menu button:hover,
.finance-class-menu button:focus-visible {
  background: var(--surface-soft) !important;
}

.finance-review-table .finance-row-remove {
  width: 30px;
  height: 30px;
  padding: 0;
}

.finance-confidence {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 8px;
}

.finance-identity-status {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.25;
}

.finance-identity-status.is-loading {
  opacity: .8;
}

.finance-identity-status.is-valid {
  color: var(--success, #3f9f6f);
}

.finance-identity-status.is-error {
  color: var(--danger, #d86666);
}

.finance-quote-status {
  display: block;
  min-height: 10px;
  margin-top: 3px;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.2;
  white-space: nowrap;
}

.finance-quote-status.is-loading {
  opacity: .82;
}

.finance-quote-status.is-valid {
  color: var(--success, #3f9f6f);
}

.finance-quote-status.is-error {
  color: var(--danger, #d86666);
}

.finance-add-position {
  margin-top: 8px;
}

.finance-draft-warnings {
  margin-top: 8px;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.4;
}

.finance-draft-warnings p {
  margin: 3px 0;
}

.finance-dialog-actions {
  justify-content: flex-end;
  flex: 0 0 auto;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}


/* Finanza personale: pianificazione e monitoraggio patrimoniale */
.finance-plan-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

.finance-advisor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  margin-bottom: 8px;
}

.finance-plan-card,
.finance-health-card,
.finance-insights-card,
.finance-monitor-card {
  min-width: 0;
}

.finance-card-copy {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.42;
}

.finance-card-action,
.finance-inline-action,
.finance-muted-action {
  min-height: 29px !important;
  padding: 4px 8px !important;
  font-size: 9.5px !important;
}

.finance-plan-card > .finance-card-action,
.finance-insights-card > .finance-card-action {
  margin-top: 9px;
}

.finance-inline-action {
  border: 0 !important;
  background: transparent !important;
  color: var(--primary) !important;
}

.finance-muted-action {
  color: var(--muted) !important;
}

.finance-progress-track,
.finance-health-track {
  display: block;
  height: 6px;
  margin-top: 9px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 14%, transparent);
  overflow: hidden;
}

.finance-progress-track > span,
.finance-health-track > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}

.finance-plan-preview {
  display: grid;
  gap: 5px;
}

.finance-preview-row {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 7px;
  border-radius: 9px;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  font-size: 9.5px;
}

.finance-preview-row > span {
  min-width: 0;
}

.finance-preview-row > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.finance-preview-row > span:last-child {
  flex: 0 0 auto;
  text-align: right;
}

.finance-preview-row strong,
.finance-preview-row small {
  display: block;
}

.finance-preview-row small {
  color: var(--muted);
  font-size: 8px;
}

.finance-preview-row.is-warning small {
  color: var(--danger, #d86666);
}

.finance-health-overview {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 9px;
}

.finance-health-overview > strong {
  display: grid;
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--primary) 45%, var(--border));
  border-radius: 50%;
  background: color-mix(in srgb, var(--primary) 9%, var(--surface));
  font-size: 19px;
}

.finance-health-overview span,
.finance-health-overview small {
  display: block;
}

.finance-health-overview span {
  font-size: 11px;
  font-weight: 750;
}

.finance-health-overview small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 8.5px;
}

.finance-health-dimensions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 10px;
}

.finance-health-dimension > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 8.8px;
}

.finance-health-dimension strong {
  font-size: 8.5px;
}

.finance-health-dimension .finance-health-track {
  height: 4px;
  margin-top: 3px;
}

.finance-insight-list {
  display: grid;
  gap: 6px;
}

.finance-insight-list-full {
  gap: 9px;
}

.finance-insight-item {
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
}

.finance-insight-item.severity-critical {
  border-color: color-mix(in srgb, var(--danger, #d86666) 55%, var(--border));
}

.finance-insight-item.severity-warning {
  border-color: color-mix(in srgb, #c99538 48%, var(--border));
}

.finance-insight-heading {
  display: flex;
  align-items: center;
  gap: 7px;
}

.finance-insight-heading span {
  flex: 0 0 auto;
  padding: 2px 5px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 7.5px;
  text-transform: uppercase;
}

.finance-insight-heading strong {
  min-width: 0;
  overflow: hidden;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.finance-insight-item p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.4;
}

.finance-insight-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}

.finance-monitor-card {
  margin-bottom: 8px;
}

.finance-monitor-controls {
  display: grid;
  grid-template-columns: auto minmax(130px, 180px) minmax(190px, 1fr) auto;
  align-items: end;
  gap: 8px;
}

.finance-monitor-controls label,
.finance-monitor-thresholds label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 8.8px;
}

.finance-monitor-controls select,
.finance-monitor-thresholds input,
.finance-management-dialog input,
.finance-management-dialog select,
.finance-management-dialog textarea {
  width: 100%;
  min-height: 32px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.finance-switch-label {
  display: flex !important;
  min-height: 32px;
  align-items: center;
  gap: 7px !important;
  color: var(--text) !important;
}

.finance-switch-label input[type="checkbox"] {
  width: 16px;
  min-width: 16px;
  height: 16px;
  min-height: 16px;
  margin: 0;
}

.finance-monitor-thresholds {
  margin-top: 9px;
}

.finance-monitor-thresholds summary {
  color: var(--muted);
  cursor: pointer;
  font-size: 9px;
}

.finance-monitor-thresholds > div {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  margin-top: 7px;
}

.finance-monitor-detail {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 8.8px;
  line-height: 1.4;
}

.finance-management-dialog {
  width: min(920px, calc(100vw - 28px));
  max-width: 920px;
  height: min(780px, calc(100dvh - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text);
}

.finance-management-dialog::backdrop {
  background: rgb(0 0 0 / .55);
  backdrop-filter: blur(4px);
}

.finance-management-shell {
  display: flex;
  height: 100%;
  min-height: 0;
  flex-direction: column;
  padding: 16px;
  overflow: hidden;
}

.finance-management-body {
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 14px;
  overflow: auto;
  padding-right: 3px;
}

.finance-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.finance-form-grid label {
  display: grid;
  align-content: start;
  gap: 4px;
  color: var(--muted);
  font-size: 9.5px;
}

.finance-form-wide {
  grid-column: 1 / -1;
}

.finance-management-dialog textarea {
  resize: vertical;
}

.finance-form-status {
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 9px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 9.5px;
}

.finance-form-status[hidden] {
  display: none;
}

.finance-form-status.is-error {
  color: var(--danger, #d86666);
}

.finance-goals-manager {
  display: grid;
  grid-template-columns: minmax(250px, .8fr) minmax(0, 1.4fr);
  gap: 12px;
  overflow: hidden;
}

.finance-manager-list,
.finance-goal-form {
  min-height: 0;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface-soft);
}

.finance-goal-manager-item {
  padding: 9px;
  border-radius: 10px;
  background: var(--surface);
}

.finance-goal-manager-item + .finance-goal-manager-item {
  margin-top: 7px;
}

.finance-goal-manager-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.finance-goal-manager-heading strong {
  min-width: 0;
  overflow: hidden;
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.finance-goal-manager-heading span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 8px;
}

.finance-goal-manager-item p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 8.8px;
  line-height: 1.35;
}

.finance-goal-manager-actions {
  display: flex;
  gap: 5px;
  margin-top: 7px;
}

.finance-goal-form > .finance-primary-action {
  margin-top: 10px;
}

.finance-target-head,
.finance-target-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 110px 110px 34px;
  gap: 7px;
  align-items: center;
}

.finance-target-head {
  padding: 0 4px 5px;
  color: var(--muted);
  font-size: 8.5px;
}

.finance-target-rows {
  display: grid;
  gap: 6px;
}

.finance-target-row .finance-row-remove {
  width: 32px;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
}

.finance-target-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
}

.finance-target-toolbar strong {
  font-size: 10px;
}

.finance-target-toolbar .is-invalid {
  color: var(--danger, #d86666);
}


@media (max-width: 760px) {
  .finance-plan-grid,
  .finance-advisor-grid {
    grid-template-columns: 1fr;
  }

  .finance-monitor-controls,
  .finance-monitor-thresholds > div {
    grid-template-columns: 1fr;
  }

  .finance-goals-manager {
    grid-template-columns: 1fr;
    overflow: auto;
  }

  .finance-manager-list,
  .finance-goal-form {
    overflow: visible;
  }

  .finance-target-head,
  .finance-target-row {
    grid-template-columns: minmax(120px, 1fr) 82px 82px 32px;
  }

  .finance-management-dialog {
    width: calc(100vw - 14px);
    height: calc(100dvh - 14px);
    max-height: calc(100dvh - 14px);
  }

  .finance-management-shell {
    padding: 12px;
  }

  .finance-workspace {
    width: calc(100% - 12px);
    margin: 2px 6px 8px;
    border-radius: 16px;
  }

  .finance-workspace-header {
    padding: 11px 12px 10px;
  }

  .finance-workspace-header h2 {
    font-size: 16px;
  }

  .finance-workspace-body {
    max-height: 64vh;
    padding: 8px;
  }

  .finance-metrics {
    grid-template-columns: 1fr 1fr;
  }

  .finance-dashboard-grid {
    grid-template-columns: 1fr;
  }

  .finance-position-row {
    grid-template-columns: minmax(0, 1.7fr) minmax(70px, .8fr) minmax(55px, .6fr);
  }

  .finance-position-row span:nth-child(3) {
    display: none;
  }

  .finance-empty, .finance-review-summary-row {
    align-items: stretch;
    flex-direction: column;
  }

  .finance-import-picker,
  .finance-review-meta {
    grid-template-columns: 1fr;
  }

  .finance-dialog-shell {
    padding: 12px;
  }

  .finance-portfolio-dialog {
    width: calc(100vw - 14px);
    height: calc(100dvh - 14px);
    max-height: calc(100dvh - 14px);
  }

  .finance-form-grid {
    grid-template-columns: 1fr;
  }

  .finance-health-dimensions {
    grid-template-columns: 1fr;
  }

  .finance-target-head {
    display: none;
  }

  .finance-target-row {
    grid-template-columns: minmax(0, 1fr) 70px 70px 32px;
  }
}

/* Landing compatta su viewport bassi - 24/08/2026 */
/* Il messaggio di benvenuto storico resta nella conversazione, ma non deve
   occupare spazio mentre e' visibile la home iniziale. */
.conversation:not(.has-messages) .message-list {
  display: none;
}

@media (min-width: 761px) and (max-height: 760px) {
  .topbar {
    min-height: 58px;
    padding: 9px 18px;
  }

  .registration-banner {
    min-height: 30px;
    font-size: 9.5px;
  }

  .laboratorio-content {
    padding: 8px 24px 10px;
  }

  .conversation:not(.has-messages) {
    justify-content: center;
    padding-top: 0;
  }

  .conversation:not(.has-messages) .demo-intro {
    margin-bottom: 8px;
    padding-top: 0;
  }

  .conversation:not(.has-messages) .demo-intro-mark {
    width: 42px;
    height: 42px;
    margin-bottom: 8px;
    border-radius: 13px;
  }

  .conversation:not(.has-messages) .demo-intro-mark img {
    width: 27px;
    height: 27px;
  }

  .conversation:not(.has-messages) .demo-intro h1 {
    margin-bottom: 4px;
    font-size: 28px;
  }

  .conversation:not(.has-messages) .demo-intro .demo-intro-lead {
    max-width: 760px;
    font-size: 12.5px;
    line-height: 1.35;
  }

  .conversation:not(.has-messages) .starter-actions {
    gap: 7px;
    margin-top: 9px;
  }

  .conversation:not(.has-messages) .starter-actions button {
    min-height: 58px;
    gap: 5px;
    padding: 8px 10px;
  }

  .conversation:not(.has-messages) .quick-icon {
    width: 24px;
    height: 24px;
    font-size: 13px;
  }

  .conversation:not(.has-messages) .composer {
    gap: 4px;
    padding: 8px 10px 7px;
    border-radius: 17px;
  }

  .conversation:not(.has-messages) .composer textarea {
    min-height: 36px;
    padding-top: 3px;
    padding-bottom: 3px;
    font-size: 14px;
  }

  .conversation:not(.has-messages) .composer-toolbar {
    min-height: 30px;
  }

  .conversation:not(.has-messages) .attachment-button,
  .conversation:not(.has-messages) .voice-button {
    width: 30px;
    height: 30px;
  }

  .conversation:not(.has-messages) .municipality-selector {
    min-height: 30px;
  }

  .conversation:not(.has-messages) .reasoning-toggle {
    min-height: 30px;
  }

  .conversation:not(.has-messages) .send-button {
    width: 32px;
    height: 32px;
  }

  .conversation:not(.has-messages) .composer-caption {
    margin-top: 4px;
    font-size: 8.8px;
    line-height: 1.2;
  }
}

@media (min-width: 761px) and (max-height: 660px) {
  .topbar {
    min-height: 52px;
    padding-top: 6px;
    padding-bottom: 6px;
  }

  .registration-banner {
    min-height: 26px;
    padding-top: 3px;
    padding-bottom: 3px;
  }

  .laboratorio-content {
    padding-top: 5px;
    padding-bottom: 6px;
  }

  .conversation:not(.has-messages) .demo-intro {
    margin-bottom: 5px;
  }

  .conversation:not(.has-messages) .demo-intro-mark {
    width: 34px;
    height: 34px;
    margin-bottom: 5px;
    border-radius: 11px;
  }

  .conversation:not(.has-messages) .demo-intro-mark img {
    width: 22px;
    height: 22px;
  }

  .conversation:not(.has-messages) .demo-intro h1 {
    margin-bottom: 3px;
    font-size: 24px;
  }

  .conversation:not(.has-messages) .demo-intro .demo-intro-lead {
    font-size: 11.5px;
    line-height: 1.25;
  }

  .conversation:not(.has-messages) .starter-actions {
    gap: 6px;
    margin-top: 6px;
  }

  .conversation:not(.has-messages) .starter-actions button {
    min-height: 50px;
    gap: 4px;
    padding-block: 6px;
    font-size: 10px;
  }

  .conversation:not(.has-messages) .quick-icon {
    width: 22px;
    height: 22px;
    font-size: 12px;
  }

  .conversation:not(.has-messages) .composer textarea {
    min-height: 32px;
  }

  .conversation:not(.has-messages) .composer-caption {
    margin-top: 3px;
    font-size: 8px;
  }
}

/* Nuova chat centrata - 24/08/2026 */
@media (min-width: 761px) {
  .conversation:not(.has-messages) {
    justify-content: center;
    padding-top: 0;
  }

  .conversation:not(.has-messages) .demo-intro {
    flex: 0 0 auto;
  }

  .conversation:not(.has-messages) .composer {
    flex: 0 0 auto;
    width: 100%;
  }

  .conversation:not(.has-messages) .composer-caption {
    flex: 0 0 auto;
  }
}


/* Home iniziale pulita - 24/08/2026 */
/* Le azioni rapide vivono sotto il composer e restano su una sola riga. */
.conversation.has-messages > .starter-actions {
  display: none;
}

.conversation:not(.has-messages) > .starter-actions {
  display: flex;
  width: 100%;
  max-width: 900px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 10px auto 0;
  padding: 0 2px 2px;
  overflow-x: auto;
  scrollbar-width: none;
}

.conversation:not(.has-messages) > .starter-actions::-webkit-scrollbar {
  display: none;
}

.conversation:not(.has-messages) > .starter-actions button {
  min-width: max-content;
  min-height: 34px;
  flex: 0 0 auto;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 10px;
  box-shadow: none;
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
}

.conversation:not(.has-messages) > .starter-actions button:hover,
.conversation:not(.has-messages) > .starter-actions button:focus-visible {
  transform: none;
  box-shadow: none;
}

.conversation:not(.has-messages) > .starter-actions .quick-icon {
  display: inline-grid;
  width: 21px;
  height: 21px;
  flex: 0 0 21px;
  place-items: center;
  border-radius: 7px;
  font-size: 12px;
}

@media (min-width: 761px) and (max-height: 760px) {
  .conversation:not(.has-messages) > .starter-actions {
    gap: 6px;
    margin-top: 7px;
  }

  .conversation:not(.has-messages) > .starter-actions button {
    min-height: 30px;
    padding: 5px 8px;
    font-size: 10px;
  }

  .conversation:not(.has-messages) > .starter-actions .quick-icon {
    width: 19px;
    height: 19px;
    flex-basis: 19px;
    font-size: 11px;
  }
}

@media (max-width: 760px) {
  .conversation:not(.has-messages) > .starter-actions {
    justify-content: flex-start;
    margin-top: 8px;
    padding-inline: 2px;
  }

  .conversation:not(.has-messages) > .starter-actions button {
    min-height: 32px;
    padding: 5px 9px;
    font-size: 10.5px;
  }
}


/* Logo sidebar compatto basato sulla larghezza reale, non solo sullo stato salvato. */
.sidebar.sidebar-visual-compact .brand {
  justify-content: center;
}

.sidebar.sidebar-visual-compact .brand-image-full {
  display: none !important;
}

.sidebar.sidebar-visual-compact .brand-image-symbol.brand-dark {
  display: block !important;
}

:root[data-theme="light"] .sidebar.sidebar-visual-compact .brand-image-symbol.brand-dark {
  display: none !important;
}

:root[data-theme="light"] .sidebar.sidebar-visual-compact .brand-image-symbol.brand-light {
  display: block !important;
}

/* Progetti */
.new-project {
  min-height: 40px;
  margin-top: -3px;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 400;
}

.new-project svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.project-history-group {
  display: grid;
  gap: 3px;
  margin: 0 0 10px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--border);
}

.project-history-heading {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 2px;
  padding: 4px 4px 4px 3px;
}

.project-history-heading > svg {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  fill: none;
  stroke: var(--primary);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.project-history-name {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  color: var(--text);
  font-size: 10.5px;
  font-weight: 760;
  letter-spacing: .015em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-history-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 2px;
}

.project-history-actions button {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.project-history-actions button:hover,
.project-history-actions button:focus-visible {
  border-color: var(--border);
  background: var(--surface-soft);
  color: var(--primary);
  outline: 0;
}

.project-history-actions svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.project-history-empty {
  padding: 5px 10px 7px;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.45;
}

.project-history-more {
  justify-self: start;
  margin: 2px 10px 0;
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 9px;
}

.project-history-more:hover,
.project-history-more:focus-visible {
  color: var(--primary);
  outline: 0;
}

.project-dialog {
  width: min(94vw, 640px);
}

.project-dialog form {
  display: grid;
  gap: 10px;
}

.project-dialog label {
  color: var(--text);
  font-size: 12px;
  font-weight: 750;
}

.project-dialog input[type="text"],
.project-dialog textarea,
.project-dialog select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 11px;
  outline: 0;
  background: var(--surface-soft);
  color: var(--text);
  font: inherit;
}

.project-dialog input[type="text"],
.project-dialog select {
  min-height: 42px;
  padding: 0 12px;
}

.project-dialog textarea {
  min-height: 210px;
  padding: 12px;
  resize: vertical;
  line-height: 1.5;
}

.project-dialog input:focus,
.project-dialog textarea:focus,
.project-dialog select:focus {
  border-color: var(--primary);
}


.conversation-move-dialog {
  width: min(92vw, 460px);
}

.conversation-move-dialog > p:first-of-type {
  margin-bottom: 14px;
}

.conversation-move-field {
  display: grid;
  gap: 7px;
}

.conversation-move-status {
  min-height: 18px;
  margin-top: 8px !important;
}

.conversation-move-actions {
  justify-content: flex-end;
}

.conversation-move-actions [data-conversation-move-confirm] {
  border-color: transparent;
  background: var(--primary);
  color: #fff;
}

.conversation-move-actions [data-conversation-move-confirm]:hover,
.conversation-move-actions [data-conversation-move-confirm]:focus-visible {
  border-color: transparent;
  color: #fff;
}

.project-dialog small {
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.45;
}

.project-instructions-label,
.project-instructions-tools,
.project-dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.project-voice-button,
.project-instructions-tools button,
.project-dialog-actions button {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-soft);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 10.5px;
  font-weight: 700;
}

.project-voice-button svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.project-voice-button.is-recording {
  border-color: color-mix(in srgb, var(--danger) 55%, var(--border));
  color: var(--danger);
}

.project-instructions-tools > span {
  color: var(--muted);
  font-size: 9.5px;
}

.project-instructions-tools > div {
  display: flex;
  gap: 6px;
}

.project-instructions-tools button:hover,
.project-instructions-tools button:focus-visible,
.project-dialog-actions button:hover,
.project-dialog-actions button:focus-visible,
.project-voice-button:hover,
.project-voice-button:focus-visible {
  border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
  color: var(--primary);
  outline: 0;
}

.project-dialog-actions {
  margin-top: 3px;
}

.project-dialog-actions [data-project-save],
.project-dialog-actions .project-delete-confirm {
  border-color: transparent;
  background: var(--primary);
  color: #fff;
}

/*
 * Fix: la regola generica ".project-dialog-actions button:hover" (piu'
 * specifica perche' combina classe + selettore di tipo "button") vinceva su
 * questa e riportava il testo a var(--primary), cioe' blu su sfondo blu con
 * tema chiaro. Qui alziamo la specificita' (classe + attributo/classe +
 * pseudo-classe) cosi' il pulsante "Salva modifiche" e la conferma di
 * eliminazione restano leggibili anche in hover/focus.
 */
.project-dialog-actions [data-project-save]:hover,
.project-dialog-actions [data-project-save]:focus-visible,
.project-dialog-actions .project-delete-confirm:hover,
.project-dialog-actions .project-delete-confirm:focus-visible {
  color: #fff;
  border-color: transparent;
}

.project-dialog-actions .project-delete-button,
.project-dialog-actions .project-delete-confirm {
  color: #fff;
}

.project-dialog-actions .project-delete-button {
  border-color: color-mix(in srgb, var(--danger) 55%, var(--border));
  background: color-mix(in srgb, var(--danger) 14%, var(--surface-soft));
  color: var(--danger);
}

.project-dialog-actions button:disabled,
.project-instructions-tools button:disabled,
.project-voice-button:disabled {
  cursor: wait;
  opacity: .58;
}

.project-status {
  min-height: 18px;
  margin: 0 !important;
  font-size: 11px !important;
}

.project-status.is-error {
  color: var(--danger) !important;
}

.project-delete-dialog {
  width: min(92vw, 520px);
}

.project-delete-choice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 9px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
}

.project-delete-choice input {
  margin-top: 3px;
}

.project-delete-choice span {
  display: grid;
  gap: 4px;
}

.project-delete-choice strong {
  color: var(--text);
  font-size: 12px;
}

.project-delete-choice small {
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.45;
}

@media (max-width: 760px) {
  .project-dialog {
    padding: 22px 18px;
  }

  .project-dialog textarea {
    min-height: 180px;
  }

  .project-dialog-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .project-dialog-actions > span {
    display: none;
  }

  .project-dialog-actions button {
    width: 100%;
  }

  .project-dialog-actions .project-delete-button {
    grid-column: 1 / -1;
  }
}


@media (max-width: 640px) {
  .project-composer-tag {
    max-width: 92px;
  }
}

/* Condivisione progetti */

.project-collaborator-note {
  color: var(--muted);
  font-size: 10.5px;
  text-align: right;
}

.project-share-dialog,
.project-redeem-dialog {
  width: min(92vw, 560px);
}

.project-share-dialog h3 {
  margin: 16px 0 6px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.project-share-code-block {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: var(--surface-soft);
}

.project-share-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: .12em;
  color: var(--muted);
}

.project-share-code.is-active {
  color: var(--primary);
}

.project-share-code-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.project-share-code-actions button {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  font-weight: 700;
}

.project-share-code-actions button:hover,
.project-share-code-actions button:focus-visible {
  border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
  color: var(--primary);
  outline: 0;
}

.project-share-code-actions .project-delete-button {
  border-color: color-mix(in srgb, var(--danger) 55%, var(--border));
  background: color-mix(in srgb, var(--danger) 14%, var(--surface-soft));
  color: var(--danger);
}

.project-share-code-block small {
  color: var(--muted);
  font-size: 10.5px;
}

.project-share-list {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
}

.project-share-empty {
  color: var(--muted);
  font-size: 11px;
}

.project-share-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface-soft);
}

.project-share-row-info {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.project-share-row-info strong {
  font-size: 12px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-share-row-info small {
  color: var(--muted);
  font-size: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-share-row-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.project-share-row-actions select,
.project-share-row-actions button {
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 10.5px;
  font-weight: 600;
}

.project-share-row-actions .project-delete-button {
  border-color: color-mix(in srgb, var(--danger) 55%, var(--border));
  background: color-mix(in srgb, var(--danger) 14%, var(--surface-soft));
  color: var(--danger);
}

.history-author-badge {
  background: color-mix(in srgb, var(--primary) 14%, transparent);
  font-weight: 700;
}

.project-history-owner-tag {
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
}

.conversation-read-only-banner {
  margin: 0 0 10px;
  padding: 10px 14px;
  border: 1px solid color-mix(in srgb, var(--primary) 35%, var(--border));
  border-radius: 12px;
  background: color-mix(in srgb, var(--primary) 8%, transparent);
  color: var(--text);
  font-size: 12px;
  line-height: 1.4;
}

@media (max-width: 760px) {
  .project-share-row {
    flex-direction: column;
    align-items: stretch;
  }

  .project-share-row-actions {
    justify-content: flex-start;
  }
}

/* Progetti, rifinitura UI 26/08/2026 */

/* L'invito resta collegato a Nuovo progetto ma con gerarchia da voce figlia. */
.new-project-redeem {
  position: relative;
  min-height: 24px;
  margin-top: -9px;
  padding: 0 10px 0 48px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 10.25px;
  font-weight: 500;
  opacity: .9;
}

.new-project-redeem::before {
  position: absolute;
  left: 21.5px;
  top: -7px;
  width: 19.5px;
  height: 19px;
  border-bottom: 1px solid color-mix(in srgb, var(--muted) 40%, transparent);
  border-left: 1px solid color-mix(in srgb, var(--muted) 40%, transparent);
  border-bottom-left-radius: 6px;
  content: "";
  pointer-events: none;
}

.new-project-redeem svg {
  width: 13px;
  height: 13px;
  flex: 0 0 13px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.55;
}

.new-project-redeem:hover,
.new-project-redeem:focus-visible {
  border-color: transparent;
  background: color-mix(in srgb, var(--primary) 6%, transparent);
  color: var(--text);
  transform: none;
}

/* I controlli di modifica esistono solo nel progetto gia' salvato. */
.project-dialog [hidden],
.project-redeem-dialog [hidden] {
  display: none !important;
}

.project-dialog-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 18px;
  margin-top: 2px;
  padding-top: 10px;
  border-top: 1px solid color-mix(in srgb, var(--border) 72%, transparent);
}

.project-edit-actions {
  display: grid;
  min-width: 0;
  gap: 12px;
  align-self: stretch;
}

.project-share-action {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.project-edit-actions .project-share-button {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 10px;
  font-weight: 650;
}

.project-edit-actions .project-share-button svg {
  width: 13px;
  height: 13px;
  flex: 0 0 13px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.65;
}

.project-edit-actions .project-share-button:hover,
.project-edit-actions .project-share-button:focus-visible {
  background: var(--surface-soft);
  color: var(--primary);
  outline: 0;
}

.project-edit-actions .project-collaborator-note {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 9.5px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-danger-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-top: auto;
}

.project-danger-actions .project-delete-button {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  justify-content: center;
  padding: 0 7px;
  border: 1px solid color-mix(in srgb, var(--danger) 34%, var(--border));
  border-radius: 7px;
  background: color-mix(in srgb, var(--danger) 7%, transparent);
  color: color-mix(in srgb, var(--danger) 88%, var(--text));
  cursor: pointer;
  font: inherit;
  font-size: 9px;
  font-weight: 650;
}

.project-danger-actions .project-delete-button:hover,
.project-danger-actions .project-delete-button:focus-visible {
  border-color: color-mix(in srgb, var(--danger) 58%, var(--border));
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: var(--danger);
  outline: 0;
}

.project-dialog-primary-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  margin: 0;
}

.project-dialog-primary-actions button {
  min-width: 76px;
}

/* Finestra codice invito, allineata ai controlli del progetto. */
.project-redeem-dialog {
  width: min(92vw, 460px);
}

.project-redeem-dialog > p {
  margin-bottom: 16px;
}

.project-redeem-form {
  display: grid;
  gap: 9px;
}

.project-redeem-form label {
  color: var(--text);
  font-size: 11.5px;
  font-weight: 700;
}

.project-redeem-form input[type="text"] {
  width: 100%;
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: 11px;
  outline: 0;
  background: var(--surface-soft);
  color: var(--text);
  font: inherit;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: .08em;
  text-transform: uppercase;
  transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

.project-redeem-form input[type="text"]::placeholder {
  color: var(--muted);
  font-family: inherit;
  font-weight: 500;
  letter-spacing: .04em;
  opacity: .72;
}

.project-redeem-form input[type="text"]:focus {
  border-color: color-mix(in srgb, var(--primary) 62%, var(--border));
  background: var(--surface);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 10%, transparent);
}

.project-redeem-actions {
  justify-content: flex-end;
  gap: 7px;
  margin-top: 1px;
}

.project-redeem-actions [data-project-redeem-submit] {
  border-color: transparent;
  background: var(--primary);
  color: #fff;
}

.project-redeem-actions [data-project-redeem-submit]:hover,
.project-redeem-actions [data-project-redeem-submit]:focus-visible {
  border-color: transparent;
  color: #fff;
}

@media (max-width: 760px) {
  .project-dialog-footer {
    grid-template-columns: 1fr;
    gap: 11px;
  }

  .project-edit-actions {
    gap: 9px;
  }

  .project-share-action {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .project-edit-actions .project-collaborator-note {
    max-width: 100%;
    white-space: normal;
  }

  .project-dialog-primary-actions, .project-redeem-actions {
    display: flex;
    justify-content: flex-end;
  }

  .project-dialog-primary-actions button {
    width: auto;
  }

  .project-redeem-actions button {
    width: auto;
  }
}

.sidebar-is-collapsed .new-project-redeem,
.sidebar.sidebar-visual-compact .new-project-redeem {
  display: none;
}

/* Progetti, ramo comprimibile della sidebar 26/08/2026 */
.new-project-tree {
  position: relative;
  width: 100%;
}

.new-project-root-row {
  position: relative;
  width: 100%;
}

.new-project-root-row .new-project {
  padding-right: 39px;
}

.new-project-tree-toggle {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  border: 0;
  white-space: nowrap;
}

.new-project-tree-toggle-control {
  position: absolute;
  z-index: 2;
  top: 50%;
  right: 8px;
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border-radius: 7px;
  color: var(--muted);
  cursor: pointer;
  transform: translateY(-50%);
  transition: background-color 150ms ease, color 150ms ease;
}

.new-project-tree-toggle-control:hover {
  background: color-mix(in srgb, var(--primary) 7%, transparent);
  color: var(--text);
}

.new-project-tree-toggle:focus-visible + .new-project-root-row .new-project-tree-toggle-control {
  box-shadow: var(--focus-ring);
}

.new-project-tree-toggle-control svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  transition: transform 150ms ease;
}

.new-project-tree-toggle:not(:checked) + .new-project-root-row .new-project-tree-toggle-control svg {
  transform: rotate(-90deg);
}

.new-project-tree-toggle:not(:checked) ~ .new-project-tree-children {
  display: none;
}

.new-project-tree-children {
  width: 100%;
}

.sidebar-is-collapsed .new-project-tree-toggle-control,
.sidebar.sidebar-visual-compact .new-project-tree-toggle-control {
  display: none;
}

.sidebar-is-collapsed .new-project-root-row .new-project,
.sidebar.sidebar-visual-compact .new-project-root-row .new-project {
  padding-right: 0;
}

/* ==========================================================================
   Fonti di progetto
   ========================================================================== */

/* Nelle chat di progetto vuote le azioni rapide generiche lasciano spazio
   al selettore Chat / Fonti. Le chat generiche restano invariate. */
.conversation:not(.has-messages).is-project-chat > .starter-actions {
  display: none;
}

.project-tabs {
  display: flex;
  width: fit-content;
  max-width: calc(100% - 20px);
  flex: 0 0 auto;
  align-items: center;
  gap: 4px;
  margin: 10px auto 0;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 8px 24px color-mix(in srgb, #000 6%, transparent);
}

.project-tabs[hidden] {
  display: none;
}

.project-tab {
  display: flex;
  min-height: 32px;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  transition: background .16s ease, color .16s ease;
}

.project-tab:hover,
.project-tab:focus-visible {
  background: color-mix(in srgb, var(--surface-soft) 72%, transparent);
  color: var(--text);
  outline: 0;
}

.project-tab.is-active {
  background: var(--surface-soft);
  color: var(--text);
}

.project-tab-count {
  display: inline-flex;
  min-width: 17px;
  height: 17px;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 9.5px;
  font-weight: 800;
}

.project-tab-count[hidden] {
  display: none;
}

/* La vista Fonti occupa l'area della chat. Il selettore rimane in basso,
   nello stesso punto in cui si trova sotto il composer nella chat vuota. */
.conversation.showing-sources {
  width: 100%;
  max-width: none;
}

.conversation.showing-sources > *:not(.project-tabs):not(.project-sources-view) {
  display: none !important;
}

.conversation.showing-sources .project-tabs {
  margin-top: 8px;
  margin-bottom: 8px;
}

.project-sources-view {
  display: none;
  width: 100%;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 18px;
  margin: 0;
  padding: 24px 28px 12px;
  overflow: auto;
}

.conversation.showing-sources .project-sources-view {
  display: flex;
}

.project-sources-view[hidden] {
  display: none;
}

.project-sources-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 2px;
}

.project-sources-heading {
  min-width: 0;
  flex: 1 1 auto;
}

.project-sources-header h2 {
  margin: 3px 0 6px;
  color: var(--text);
  font-size: 24px;
  line-height: 1.1;
}

.project-sources-header p {
  max-width: 920px;
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
}

.project-sources-usage {
  flex: 0 0 auto;
  margin-top: 1px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.project-sources-add-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: stretch;
  gap: 14px;
}

.project-source-option {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 8px 28px color-mix(in srgb, #000 4%, transparent);
}

.project-source-option-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.project-source-option-heading > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.project-source-option-heading strong {
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.2;
}

.project-source-option-heading small {
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.35;
}

.project-source-option-icon {
  display: inline-grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--primary) 26%, var(--border));
  border-radius: 11px;
  background: color-mix(in srgb, var(--primary) 8%, var(--surface-soft));
  color: var(--primary);
}

.project-source-option-icon svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.project-sources-choice {
  display: flex;
  align-items: center;
  justify-content: center;
}

.project-sources-choice span {
  display: inline-flex;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.project-sources-dropzone {
  display: flex;
  min-height: 168px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 20px 16px;
  border: 1.5px dashed color-mix(in srgb, var(--primary) 22%, var(--border));
  border-radius: 14px;
  background: var(--surface-soft);
  color: var(--muted);
  cursor: pointer;
  text-align: center;
  transition: border-color .16s ease, background .16s ease;
}

.project-sources-dropzone:hover,
.project-sources-dropzone:focus-visible,
.project-sources-dropzone.is-dragover {
  border-color: color-mix(in srgb, var(--primary) 68%, var(--border));
  background: color-mix(in srgb, var(--primary) 7%, var(--surface-soft));
  outline: 0;
}

.project-sources-dropzone > svg {
  width: 25px;
  height: 25px;
  margin-bottom: 2px;
  fill: none;
  stroke: var(--primary);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.project-sources-dropzone strong {
  color: var(--text);
  font-size: 13px;
}

.project-sources-dropzone > span {
  font-size: 10.5px;
}

.project-sources-dropzone button {
  min-height: 31px;
  padding: 6px 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-elevated);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 11.5px;
  font-weight: 700;
}

.project-sources-dropzone small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.project-sources-text-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.project-sources-text-form label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
}

.project-sources-text-form input,
.project-sources-text-form textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface-soft);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  outline: 0;
  transition: border-color .16s ease, box-shadow .16s ease;
}

.project-sources-text-form textarea {
  min-height: 88px;
  resize: vertical;
}

.project-sources-text-form input:focus,
.project-sources-text-form textarea:focus {
  border-color: color-mix(in srgb, var(--primary) 62%, var(--border));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 10%, transparent);
}

.project-sources-text-form button {
  align-self: flex-end;
  min-height: 34px;
  padding: 7px 14px;
  border: 1px solid color-mix(in srgb, var(--primary) 58%, var(--border));
  border-radius: 10px;
  background: color-mix(in srgb, var(--primary) 14%, var(--surface));
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 11.5px;
  font-weight: 700;
}

.project-sources-text-form button:hover,
.project-sources-text-form button:focus-visible {
  border-color: var(--primary);
  outline: 0;
}

.project-sources-text-form button:disabled {
  cursor: wait;
  opacity: .55;
}

.project-sources-status {
  min-height: 14px;
  margin: -6px 0 0;
  color: var(--muted);
  font-size: 11.5px;
}

.project-sources-status:empty {
  display: none;
}

.project-sources-status.is-error {
  color: var(--danger);
}

.project-sources-library {
  min-height: 160px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
}

.project-sources-library-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-soft) 56%, var(--surface));
}

.project-sources-library-heading > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.project-sources-library-heading strong {
  color: var(--text);
  font-size: 12.5px;
}

.project-sources-library-heading span {
  color: var(--muted);
  font-size: 10.5px;
}

.project-sources-table-wrap {
  overflow: auto;
}

.project-sources-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.project-sources-table th {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: .04em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.project-sources-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.project-sources-table tr:last-child td {
  border-bottom: none;
}

.project-source-name {
  display: flex;
  max-width: 360px;
  flex-direction: column;
  gap: 2px;
}

.project-source-name strong {
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-source-name small {
  color: var(--danger);
  font-size: 10px;
}

.project-source-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.project-source-status.is-indexed {
  background: var(--success-bg);
  color: var(--success);
}

.project-source-status.is-processing,
.project-source-status.is-pending {
  background: var(--surface-soft);
  color: var(--muted);
}

.project-source-status.is-failed {
  background: color-mix(in srgb, var(--danger) 18%, transparent);
  color: var(--danger);
}

.project-source-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--muted);
  cursor: pointer;
}

.project-source-delete:hover,
.project-source-delete:focus-visible {
  border-color: color-mix(in srgb, var(--danger) 45%, var(--border));
  color: var(--danger);
  outline: 0;
}

.project-source-delete svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 2;
}

.project-sources-empty {
  padding: 30px 14px;
  color: var(--muted);
  font-size: 11.5px;
  text-align: center;
}

.project-sources-empty[hidden] {
  display: none;
}

@media (max-width: 900px) {
  .project-sources-view {
    padding-inline: 18px;
  }

  .project-sources-add-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .project-sources-choice {
    height: 22px;
  }
}

@media (max-width: 760px) {
  .project-sources-view {
    gap: 14px;
    padding: 16px 10px 8px;
  }

  .project-sources-header {
    flex-direction: column;
    gap: 10px;
  }

  .project-sources-usage {
    margin-top: 0;
  }

  .project-source-option {
    padding: 13px;
    border-radius: 15px;
  }

  .project-sources-dropzone {
    min-height: 145px;
  }

  .project-source-name {
    max-width: 46vw;
  }

  .project-sources-table th,
  .project-sources-table td {
    padding-inline: 9px;
  }
}

/* Project chat empty state: keep only the project heading. */
.conversation.is-project-chat .demo-intro .demo-intro-lead {
  display: none;
}

.conversation.is-project-chat .demo-intro h1 {
  margin-bottom: 0;
}

/* Project sources: use one vertical scroll only, the Fonti view itself.
   The library expands to all rows, avoiding the nested scrollbar that clipped sources. */
.project-sources-library {
  flex: 0 0 auto;
}

.project-sources-table-wrap {
  min-height: 0;
  overflow-x: auto;
  overflow-y: visible;
}

.project-sources-table thead th {
  position: static;
}

/* Compact rows: keep more project sources visible without wasting vertical space. */
.project-sources-table th, .project-sources-table td {
  padding-top: 6px;
  padding-bottom: 6px;
}

.project-source-delete {
  width: 24px;
  height: 24px;
  border-radius: 8px;
}

.project-source-delete svg {
  width: 12px;
  height: 12px;
}

.project-source-status {
  padding: 2px 7px;
}


/* UX condivisione progetti, 26/08/2026 */
.project-approval-trigger {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  gap: 6px;
  padding: 0 9px;
  border: 1px solid color-mix(in srgb, #f59e0b 45%, var(--border));
  border-radius: 11px;
  background: color-mix(in srgb, #f59e0b 9%, var(--surface));
  color: color-mix(in srgb, #f59e0b 82%, var(--text));
  cursor: pointer;
  font: inherit;
  font-size: 10px;
  font-weight: 750;
  white-space: nowrap;
}

.project-approval-trigger[hidden] { display: none !important; }
.project-approval-trigger:hover,
.project-approval-trigger:focus-visible {
  border-color: color-mix(in srgb, #f59e0b 72%, var(--border));
  background: color-mix(in srgb, #f59e0b 14%, var(--surface));
  outline: 0;
}
.project-approval-trigger svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}
.project-approval-count {
  display: grid;
  min-width: 17px;
  height: 17px;
  place-items: center;
  padding: 0 4px;
  border-radius: 999px;
  background: #f59e0b;
  color: #111827;
  font-size: 8.5px;
  font-weight: 850;
}
.project-approval-count[hidden] { display: none !important; }

.project-share-dialog .project-status,
.project-redeem-dialog .project-status {
  display: none;
  min-height: 0;
  margin: 8px 0 10px !important;
  padding: 9px 11px;
  border: 1px solid color-mix(in srgb, var(--primary) 30%, var(--border));
  border-radius: 10px;
  background: color-mix(in srgb, var(--primary) 7%, var(--surface-soft));
  color: var(--text);
  font-size: 10.5px !important;
  font-weight: 600;
  line-height: 1.4;
}
.project-share-dialog .project-status.has-message,
.project-redeem-dialog .project-status.has-message { display: block; }
.project-share-dialog .project-status.is-success,
.project-redeem-dialog .project-status.is-success {
  border-color: color-mix(in srgb, #22c55e 42%, var(--border));
  background: color-mix(in srgb, #22c55e 9%, var(--surface-soft));
  color: color-mix(in srgb, #22c55e 78%, var(--text));
}
.project-share-dialog .project-status.is-error,
.project-redeem-dialog .project-status.is-error {
  border-color: color-mix(in srgb, var(--danger) 42%, var(--border));
  background: color-mix(in srgb, var(--danger) 9%, var(--surface-soft));
  color: var(--danger) !important;
}
.project-share-row.is-pending {
  border-color: color-mix(in srgb, #f59e0b 28%, var(--border));
  background: color-mix(in srgb, #f59e0b 5%, var(--surface-soft));
}

.history-item small {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}
.history-author-badge {
  --history-author-color: hsl(var(--history-author-hue, 210) 66% 43%);
  display: inline-flex;
  flex: 0 0 12px;
  width: 12px;
  height: 12px;
  margin-left: 1px;
  padding: 0;
  align-items: center;
  justify-content: center;
  border: 1px solid color-mix(in srgb, var(--history-author-color) 34%, var(--border));
  border-radius: 4px;
  background: color-mix(in srgb, var(--history-author-color) 11%, var(--surface-soft));
  color: var(--history-author-color);
  font-size: 0;
  line-height: 1;
  letter-spacing: 0;
  text-transform: uppercase;
  vertical-align: middle;
}

:root:not([data-theme="light"]) .history-author-badge {
  --history-author-color: hsl(var(--history-author-hue, 210) 72% 72%);
}

.history-author-badge > .history-author-initial {
  display: inline-flex;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  font-size: 7.25px;
  font-weight: 700;
  line-height: 12px;
  text-align: center;
}

@media (max-width: 760px) {
  .project-approval-trigger {
    position: relative;
    width: 36px;
    padding: 0;
    justify-content: center;
  }
  .project-approval-trigger > span[data-project-approval-label] { display: none; }
  .project-approval-count {
    position: absolute;
    top: -5px;
    right: -5px;
  }
}

/* PWA install: il controllo deve restare disponibile anche sugli smartphone. */
@media (max-width: 460px) {
  .install-pwa-button:not([hidden]) {
    display: inline-flex;
  }
}

/* Sidebar, sezioni Progetti e Chat Generali comprimibili 27/08/2026 */
.history-section {
  display: grid;
  min-width: 0;
  gap: 3px;
  margin: 0 0 9px;
}

.history-section + .history-section,
.history-section + .history-group,
.history-group + .history-section {
  padding-top: 5px;
  border-top: 1px solid var(--border);
}

.history-section-toggle {
  display: flex;
  width: 100%;
  min-height: 29px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px 4px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 9.5px;
  font-weight: 760;
  letter-spacing: .04em;
  text-align: left;
  text-transform: uppercase;
  transition: background-color 140ms ease, color 140ms ease;
}

.history-section-toggle:hover,
.history-section-toggle:focus-visible {
  background: color-mix(in srgb, var(--primary) 7%, transparent);
  color: var(--text);
  outline: 0;
}

.history-section-toggle:focus-visible {
  box-shadow: var(--focus-ring);
}

.history-section-label {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 6px;
}

.history-section-icon {
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.history-section-chevron {
  width: 13px;
  height: 13px;
  flex: 0 0 13px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
  transition: transform 150ms ease;
}

.history-section.is-collapsed .history-section-chevron {
  transform: rotate(-90deg);
}

.history-section-body {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.history-section-body[hidden] {
  display: none !important;
}

.sidebar-history > strong {
  display: none;
}

/* Sidebar: separazione pulita tra Progetti e Chat Generali 27/08/2026 */
.history-section[data-history-section="projects"] .project-history-group:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: 0;
}

.history-section[data-history-section="projects"] + .history-section[data-history-section="general"] {
  padding-top: 11px;
  border-top: 1px solid var(--border);
}

/* Report composer and reusable document templates */
.prompt-improve-row { display:flex; justify-content:flex-end; margin-top:.45rem; }
.secondary-action,.report-template-link { border:0; background:transparent; color:var(--accent,#2563eb); font:inherit; font-size:.88rem; cursor:pointer; padding:.35rem .2rem; }
.secondary-action:disabled { opacity:.45; cursor:default; }
.report-generation-dialog { width:min(720px,calc(100vw - 28px)); }
.report-option-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; margin-top:14px; }
.report-option-grid label { display:grid; gap:7px; }
.report-option-grid select,.document-template-upload input[type="text"],.document-template-upload input[type="file"] { width:100%; }
.report-research-option { display:flex!important; align-items:center; gap:9px; }
.report-research-option input { width:auto!important; }
.report-template-link { display:block; margin-top:6px; }
.report-generation-actions { display:flex; justify-content:center; margin-top:18px; }
.report-generation-actions button { min-width:190px; }
.document-templates-dialog { width:min(760px,calc(100vw - 28px)); }
.document-template-list { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; max-height:420px; overflow:auto; }
.document-template-card { display:grid; grid-template-columns:92px minmax(0,1fr); gap:12px; border:1px solid var(--border-color,rgba(127,127,127,.22)); border-radius:13px; padding:10px; background:var(--panel-bg,rgba(127,127,127,.06)); }
.document-template-card>img { width:92px; aspect-ratio:210/297; object-fit:cover; border-radius:7px; border:1px solid var(--border-color,rgba(127,127,127,.2)); background:#fff; }
.document-template-card-body { min-width:0; display:flex; flex-direction:column; gap:4px; }
.document-template-card-body strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.document-template-card-body small { opacity:.72; }
.document-template-card-actions { display:flex; flex-wrap:wrap; gap:6px; margin-top:auto; padding-top:8px; }
.document-template-card-actions button { font-size:.78rem; padding:.38rem .55rem; }
.document-template-card-actions .is-danger { color:#b42318; }
.document-template-empty { grid-column:1/-1; text-align:center; opacity:.7; padding:24px 10px; }
.document-template-upload { border-top:1px solid var(--border-color,rgba(127,127,127,.2)); }
.document-template-upload h3 { margin:0 0 12px; }
.document-template-upload>label:not(.report-research-option) { display:grid; gap:6px; margin-bottom:10px; }
.document-template-upload small { display:block; opacity:.7; margin:8px 0 12px; }
@media (max-width:620px) { .report-option-grid,.document-template-list { grid-template-columns:1fr; } .document-template-card { grid-template-columns:76px minmax(0,1fr); } .document-template-card>img { width:76px; } }
.template-margin-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:8px; }
.template-margin-grid>span { grid-column:1/-1; font-size:.86rem; opacity:.72; }
.template-margin-grid label { display:grid; gap:5px; font-size:.8rem; }
.template-margin-grid input { width:100%; }
@media(max-width:620px){.template-margin-grid{grid-template-columns:repeat(2,minmax(0,1fr));}}

/* Report generator + report templates UX refinement v24 */
.report-generation-dialog,
.document-templates-dialog {
  max-height: min(88dvh, 860px);
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.report-generation-dialog form,
.document-template-upload {
  display: grid;
  gap: 14px;
}

.report-generation-dialog form > label,
.document-template-upload > label:not(.report-research-option),
.report-option-grid label,
.template-margin-grid label {
  color: var(--text);
  font-size: 12px;
  font-weight: 750;
}

.report-generation-dialog textarea,
.report-generation-dialog select,
.document-template-upload input[type="text"],
.document-template-upload input[type="number"],
.document-template-upload input[type="file"] {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  outline: 0;
  background: var(--surface-soft);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.report-generation-dialog textarea {
  display: block;
  min-height: 156px;
  padding: 13px 14px;
  line-height: 1.55;
  resize: vertical;
}

.report-generation-dialog select,
.document-template-upload input[type="text"],
.document-template-upload input[type="number"] {
  min-height: 42px;
  padding: 9px 11px;
}

.report-generation-dialog textarea:focus,
.report-generation-dialog select:focus,
.document-template-upload input[type="text"]:focus,
.document-template-upload input[type="number"]:focus,
.document-template-upload input[type="file"]:focus-visible {
  border-color: var(--primary);
  box-shadow: var(--focus-ring);
}

.report-generation-dialog textarea::placeholder,
.document-template-upload input::placeholder {
  color: var(--muted);
  opacity: .82;
}

.prompt-improve-row {
  min-height: 32px;
  align-items: center;
}

.secondary-action,
.report-template-link {
  border-radius: 9px;
  transition: background 140ms ease, color 140ms ease, opacity 140ms ease;
}

.secondary-action:not(:disabled):hover,
.secondary-action:not(:disabled):focus-visible,
.report-template-link:hover,
.report-template-link:focus-visible {
  background: var(--surface-soft);
  outline: 0;
}

.report-option-grid {
  padding-top: 2px;
}

.report-option-grid label {
  align-content: start;
}

.report-research-option {
  width: fit-content;
  min-height: 34px;
  margin-top: 2px;
  padding: 7px 9px;
  border-radius: 10px;
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
}

.report-research-option:hover {
  background: var(--surface-soft);
}

.report-research-option input[type="checkbox"] {
  width: 16px !important;
  height: 16px;
  margin: 0;
  accent-color: var(--primary);
}

.report-generation-actions {
  padding-top: 4px;
}

.report-generation-actions button,
.document-template-upload > button[type="submit"] {
  min-height: 42px;
  padding: 10px 18px;
  border: 0;
  border-radius: 11px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 780;
  box-shadow: 0 7px 18px rgba(0, 0, 0, .12);
  transition: transform 120ms ease, opacity 120ms ease, filter 120ms ease;
}

.report-generation-actions button:hover,
.document-template-upload > button[type="submit"]:hover {
  filter: brightness(1.05);
}

.report-generation-actions button:active,
.document-template-upload > button[type="submit"]:active {
  transform: translateY(1px);
}

.report-generation-actions button:disabled,
.document-template-upload > button[type="submit"]:disabled {
  cursor: wait;
  opacity: .58;
}

.document-templates-dialog > p:first-of-type {
  margin-bottom: 8px;
}

.document-template-list {
  margin: 8px 0 2px;
  padding: 4px 4px 8px 0;
}

.document-template-empty {
  margin: 8px 0 14px;
  border: 1px dashed var(--border);
  border-radius: 14px;
  background: var(--surface-soft);
  color: var(--muted);
}

.document-template-upload {
  margin-top: 10px;
  padding-top: 22px;
}

.document-template-upload h3 {
  font-size: 17px;
}

.document-template-upload input[type="file"] {
  min-height: 44px;
  padding: 6px;
}

.document-template-upload input[type="file"]::file-selector-button {
  margin-right: 10px;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-elevated);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
}

.template-margin-grid {
  margin: 2px 0 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-soft);
}

.template-margin-grid > span {
  color: var(--muted);
  font-weight: 700;
}

.document-template-upload > button[type="submit"] {
  justify-self: center;
  min-width: 180px;
  margin-top: 2px;
}

.document-template-card-actions button {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-elevated);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

.document-template-card-actions button:hover,
.document-template-card-actions button:focus-visible {
  background: var(--surface-soft);
  outline: 0;
}

@media (max-width: 620px) {
  .report-generation-dialog,
  .document-templates-dialog {
    width: calc(100vw - 20px);
    max-height: calc(100dvh - 20px);
    padding: 22px 18px;
    border-radius: 18px;
  }

  .report-generation-dialog textarea {
    min-height: 138px;
  }

  .report-option-grid {
    gap: 11px;
  }

  .report-research-option {
    width: 100%;
    box-sizing: border-box;
  }

  .report-generation-actions button,
  .document-template-upload > button[type="submit"] {
    width: 100%;
  }
}

/* ========================================================================== 
   Memoria condivisa di progetto
   ========================================================================== */
.conversation.showing-memory {
  width: 100%;
  max-width: none;
}

.conversation.showing-memory > *:not(.project-tabs):not(.project-memory-view) {
  display: none !important;
}

.conversation.showing-memory .project-tabs {
  margin-top: 8px;
  margin-bottom: 8px;
}

.project-memory-view {
  display: none;
  width: 100%;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 16px;
  margin: 0;
  padding: 24px 28px 18px;
  overflow: auto;
}

.conversation.showing-memory .project-memory-view {
  display: flex;
}

.project-memory-view[hidden] {
  display: none;
}

.project-memory-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.project-memory-header h2 {
  margin: 4px 0 6px;
  color: var(--text);
  font-size: 22px;
}

.project-memory-header p {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.project-memory-summary {
  flex: 0 0 auto;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.project-memory-status,
.project-memory-readonly,
.project-memory-empty {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}

.project-memory-status:empty {
  display: none;
}

.project-memory-status.is-error {
  color: var(--danger, #b42318);
}

.project-memory-readonly {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
}

.project-memory-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(360px, 100%), 1fr));
  gap: 12px;
}

.project-memory-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 10px;
  padding: 14px 15px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}

.project-memory-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.project-memory-type {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 10.5px;
  font-weight: 800;
}

.project-memory-priority,
.project-memory-meta {
  color: var(--muted);
  font-size: 10.5px;
}

.project-memory-content {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.project-memory-meta {
  margin-top: auto;
}

.project-memory-actions {
  display: flex;
  gap: 8px;
  padding-top: 2px;
}

.project-memory-actions button {
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-soft);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 11.5px;
  font-weight: 700;
}

.project-memory-actions button:hover,
.project-memory-actions button:focus-visible {
  filter: brightness(.98);
  outline: 0;
}

.project-memory-actions button.is-danger {
  color: var(--danger, #b42318);
}

@media (max-width: 720px) {
  .project-memory-view {
    padding: 18px 16px 12px;
  }

  .project-memory-header {
    flex-direction: column;
    gap: 10px;
  }

  .project-memory-list {
    grid-template-columns: 1fr;
  }
}


/* Storage popup fixes 2026-08-31 */
.storage-dialog {
  box-sizing: border-box;
  height: min(90dvh, 880px);
  max-height: min(90dvh, 880px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.storage-dialog .storage-footer {
  flex: 0 0 auto;
}

@media (max-width: 620px) {
  .storage-dialog {
    height: min(92dvh, 880px);
    max-height: min(92dvh, 880px);
  }
}

/* Storage popup layout correction 2026-08-31 v2 */
.storage-dialog .storage-file-list {
  flex: 1 1 auto;
  min-height: 260px;
  overflow-y: auto;
  overflow-x: hidden;
  grid-auto-rows: max-content;
  align-content: start;
  padding-right: 8px;
  margin-right: 0;
  scrollbar-gutter: stable;
}
.storage-dialog .storage-file-card { align-self: start; }
@media (max-width: 620px) {
  .storage-dialog .storage-file-list { min-height: 180px; }
}

/* Storage bulk selection + native dialog close fix 2026-08-31 */
.storage-dialog:not([open]) { display: none; }
.storage-selection-toolbar { display:flex; flex:0 0 auto; align-items:center; gap:12px; margin-top:12px; padding:10px 0 2px; }
.storage-select-all { display:inline-flex; align-items:center; gap:7px; color:var(--text); cursor:pointer; font-size:11px; font-weight:700; }
.storage-select-all input,.storage-file-select input { width:16px; height:16px; margin:0; accent-color:var(--primary); cursor:pointer; }
.storage-selection-count { color:var(--muted); font-size:11px; }
.storage-delete-selected { margin-left:auto; min-height:30px; padding:5px 10px; border:1px solid var(--border); border-radius:8px; background:var(--surface-soft); color:var(--danger,#b42318); cursor:pointer; font:inherit; font-size:11px; font-weight:700; }
.storage-delete-selected:disabled { cursor:default; opacity:.45; }
.storage-dialog .storage-file-card,.image-library-dialog .image-collection-card,.image-assets-dialog .image-collection-card { position:relative; }
.storage-file-select { position:absolute; z-index:2; top:9px; left:9px; display:grid; width:28px; height:28px; place-items:center; border:1px solid var(--border); border-radius:8px; background:var(--surface-elevated); box-shadow:0 2px 8px rgba(0,0,0,.12); }
@media (max-width:620px) { .storage-selection-toolbar { flex-wrap:wrap; } .storage-delete-selected { width:100%; margin-left:0; } }

/* ========================================================================== 
   Chat desktop: colonna centrale piu compatta
   ========================================================================== */
@media (min-width: 900px) {
  .laboratorio-content {
    padding-inline: clamp(24px, 4vw, 64px);
  }

  .conversation:not(.showing-sources):not(.showing-memory) {
    width: min(1080px, 100%);
    max-width: 1080px;
    margin-inline: auto;
  }

  .conversation:not(.showing-sources):not(.showing-memory) .message-list,
  .conversation:not(.showing-sources):not(.showing-memory) .conversation-tools {
    padding-inline: 0;
  }

  .conversation:not(.showing-sources):not(.showing-memory) .message-assistant .message-bubble {
    width: min(920px, 100%);
    max-width: 920px;
  }

  .conversation:not(.showing-sources):not(.showing-memory) .message-user .message-bubble {
    width: auto;
    max-width: 720px;
  }

  .conversation:not(.showing-sources):not(.showing-memory) .message-row {
    margin-bottom: 14px;
  }

  .conversation:not(.showing-sources):not(.showing-memory) .message-assistant .assistant-code-block {
    margin-block: 10px;
  }

  .conversation:not(.showing-sources):not(.showing-memory) .composer {
    width: 100%;
    max-width: 1080px;
    margin-inline: auto;
  }
}

/* ========================================================================== 
   Chat density: meno spazio verticale tra testo e code block
   ========================================================================== */
.conversation.has-messages .message-list { padding-top:10px; padding-bottom:18px; }
.message-row { margin-bottom:10px; }
.message-bubble { line-height:1.45; }
.message-assistant .message-bubble { padding-block:1px; }
.message-actions { margin-top:3px; }
.message-assistant .assistant-code-block { margin-block:6px; }
.message-assistant .assistant-code-block-header { min-height:34px; padding:4px 8px 4px 12px; }
.message-assistant .assistant-code-copy { min-height:26px; padding-inline:8px; }
.message-assistant .assistant-code-block pre { padding:10px 14px 11px; }
.message-assistant .assistant-code-block code { line-height:1.4; }
@media (min-width:900px) {
  .conversation:not(.showing-sources):not(.showing-memory) .message-row { margin-bottom:10px; }
  .conversation:not(.showing-sources):not(.showing-memory) .message-assistant .assistant-code-block { margin-block:6px; }
}

/* Chat loader: evita il taglio dell'anello sul bordo sinistro della message-list. */

/* Chat viewport bottom anchor + autohide scrollbar 2026-08-31 */
@media (min-width: 761px) {
  /* La pagina non deve avere un secondo scroll mentre la chat e attiva.
     Scorre solo la lista messaggi e il composer resta interamente visibile. */
  .laboratorio-content:has(.conversation.has-messages:not(.showing-sources):not(.showing-memory)) {
    overflow: hidden;
  }

  .conversation.has-messages:not(.showing-sources):not(.showing-memory) {
    height: 100%;
    max-height: 100%;
  }

  .conversation.has-messages:not(.showing-sources):not(.showing-memory) .message-list {
    min-height: 0;
    flex: 1 1 auto;
    padding-bottom: 8px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: auto;
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
  }

  .conversation.has-messages:not(.showing-sources):not(.showing-memory) .message-list > .message-row:last-child {
    margin-bottom: 4px;
  }

  .conversation.has-messages:not(.showing-sources):not(.showing-memory) .composer {
    flex: 0 0 auto;
  }

  /* Firefox: thumb invisibile a riposo, visibile solo durante uso/hover. */
  .conversation.has-messages:not(.showing-sources):not(.showing-memory) .message-list:hover,
  .conversation.has-messages:not(.showing-sources):not(.showing-memory) .message-list.is-scrolling {
    scrollbar-color: color-mix(in srgb, var(--muted) 42%, transparent) transparent;
  }

  /* Chromium/WebKit: barra sottile, senza track e quasi invisibile a riposo. */
  .conversation.has-messages:not(.showing-sources):not(.showing-memory) .message-list::-webkit-scrollbar {
    width: 6px;
  }

  .conversation.has-messages:not(.showing-sources):not(.showing-memory) .message-list::-webkit-scrollbar-track {
    background: transparent;
  }

  .conversation.has-messages:not(.showing-sources):not(.showing-memory) .message-list::-webkit-scrollbar-thumb {
    min-height: 42px;
    border-radius: 999px;
    background: transparent;
  }

  .conversation.has-messages:not(.showing-sources):not(.showing-memory) .message-list:hover::-webkit-scrollbar-thumb,
  .conversation.has-messages:not(.showing-sources):not(.showing-memory) .message-list.is-scrolling::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--muted) 42%, transparent);
  }

  .conversation.has-messages:not(.showing-sources):not(.showing-memory) .message-list::-webkit-scrollbar-button {
    display: none;
    width: 0;
    height: 0;
  }
}

/* Chat loader spacing: lascia respirare ombra e composer. */
.dalila-loader {
  margin-left: 22px;
}

@media (min-width: 761px) {
  .conversation.has-messages:not(.showing-sources):not(.showing-memory) .message-list > .message-row:has(.message-bubble.is-pending):last-child {
    margin-bottom: 14px;
  }
}

/* Sidebar history scrollbar autohide, usa lo stesso comportamento della chat. */
@media (min-width: 761px) {
  .sidebar .history-list {
    scrollbar-gutter: auto;
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
  }

  .sidebar .history-list:hover,
  .sidebar .history-list.is-scrolling {
    scrollbar-color: color-mix(in srgb, var(--muted) 42%, transparent) transparent;
  }

  .sidebar .history-list::-webkit-scrollbar {
    width: 6px;
  }

  .sidebar .history-list::-webkit-scrollbar-track {
    background: transparent;
  }

  .sidebar .history-list::-webkit-scrollbar-thumb {
    min-height: 42px;
    border-radius: 999px;
    background: transparent;
  }

  .sidebar .history-list:hover::-webkit-scrollbar-thumb,
  .sidebar .history-list.is-scrolling::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--muted) 42%, transparent);
  }

  .sidebar .history-list::-webkit-scrollbar-button {
    display: none;
    width: 0;
    height: 0;
  }
}

/* Storage thumbnails + composer shadow visibility 2026-08-31 */
@media (min-width: 761px) {
  .conversation.has-messages:not(.showing-sources):not(.showing-memory) {
    overflow: visible;
  }
}

.image-library-dialog .storage-selection-toolbar,
.image-assets-dialog .storage-selection-toolbar {
  margin-bottom: 14px;
}

.image-assets-dialog .storage-selection-toolbar {
  margin-top: 14px;
}

/* Profilo account: tipografia e azioni uniformi */
#accountProfileDialog {
  width: min(92vw, 500px);
}

#accountProfileDialog h2 {
  font-size: 22px;
  font-weight: 780;
  letter-spacing: -.02em;
}

#accountProfileDialog .account-profile-data {
  gap: 9px;
  margin-top: 0;
}

#accountProfileDialog .account-profile-data > div {
  padding: 14px 15px;
  border: 1px solid color-mix(in srgb, var(--border) 78%, transparent);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface-soft) 78%, transparent);
}

#accountProfileDialog .account-profile-data dt {
  color: var(--muted);
  font-size: 10px;
  font-weight: 720;
  line-height: 1.2;
  letter-spacing: .045em;
  text-transform: uppercase;
}

#accountProfileDialog .account-profile-data dd {
  margin: 6px 0 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 520;
  line-height: 1.45;
}

#accountProfileDialog .account-profile-storage dd {
  gap: 5px;
}

#accountProfileDialog .account-profile-storage small,
#accountProfileDialog .improvement-consent-control small,
#accountProfileDialog .improvement-consent-note {
  color: var(--muted);
  font-size: 11px;
  font-weight: 450;
  line-height: 1.5;
}

#accountProfileDialog .account-profile-storage small {
  margin-top: 7px;
}

#accountProfileDialog .profile-municipality-actions {
  gap: 8px;
  margin-top: 10px;
}

#accountProfileDialog .account-profile-api-key {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px 14px;
}

#accountProfileDialog .account-profile-api-key dt {
  grid-column: 1 / -1;
}

#accountProfileDialog .account-profile-api-key dd {
  margin: 0;
}

#accountProfileDialog .account-profile-api-key button {
  grid-column: 2;
  grid-row: 2;
}

#accountProfileDialog .account-profile-storage button,
#accountProfileDialog .profile-municipality-actions button,
#accountProfileDialog .account-profile-api-key button {
  min-height: 32px;
  margin-left: 0;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--primary);
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  font-weight: 720;
  line-height: 1;
  text-decoration: none;
  transition: border-color 140ms ease, background-color 140ms ease, color 140ms ease;
}

#accountProfileDialog .account-profile-storage button {
  margin-left: auto;
}

#accountProfileDialog .account-profile-storage button:hover,
#accountProfileDialog .profile-municipality-actions button:hover,
#accountProfileDialog .account-profile-api-key button:hover,
#accountProfileDialog .account-profile-storage button:focus-visible,
#accountProfileDialog .profile-municipality-actions button:focus-visible,
#accountProfileDialog .account-profile-api-key button:focus-visible {
  border-color: color-mix(in srgb, var(--primary) 52%, var(--border));
  background: color-mix(in srgb, var(--primary) 8%, var(--surface));
  outline: 0;
  text-decoration: none;
}

#accountProfileDialog .profile-municipality-actions .is-danger {
  color: var(--danger);
}

#accountProfileDialog .improvement-consent-control {
  gap: 18px;
}

#accountProfileDialog .improvement-consent-control span {
  gap: 6px;
}

#accountProfileDialog .improvement-consent-control strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 720;
  line-height: 1.35;
}

#accountProfileDialog .improvement-consent-note {
  margin-top: 10px;
}

@media (max-width: 520px) {
  #accountProfileDialog {
    padding: 24px 20px;
  }

  #accountProfileDialog .account-profile-api-key {
    grid-template-columns: 1fr;
  }

  #accountProfileDialog .account-profile-api-key button {
    grid-column: 1;
    grid-row: auto;
    justify-self: start;
  }
}

/* Gestione di più API Key */
.api-key-dialog {
  overflow-x: hidden;
}

.api-key-state {
  grid-template-columns: 1fr;
  gap: 10px;
}

.api-key-list-item {
  display: grid;
  gap: 11px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-soft);
}

.api-key-list-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.api-key-list-heading > div {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.api-key-list-heading span,
.api-key-list-meta span {
  color: var(--muted);
  font-size: 10px;
}

.api-key-list-heading code {
  max-width: 100%;
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.api-key-list-heading > strong {
  flex: 0 0 auto;
  color: var(--primary);
  font-size: 11px;
}

.api-key-list-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.api-key-list-meta > div {
  display: grid;
  gap: 4px;
}

.api-key-list-meta span {
  font-size: 9px;
}

.api-key-list-meta strong {
  font-size: 11px;
}

.api-key-list-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.api-key-list-actions button {
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--primary);
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  font-weight: 720;
}

.api-key-list-actions .is-danger {
  color: var(--danger);
}

.api-key-list-actions button:disabled {
  cursor: wait;
  opacity: .55;
}

.api-key-secret,
.api-key-secret > div {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.api-key-secret > div {
  width: 100%;
}

.api-key-secret code {
  width: 0;
  max-width: 100%;
  flex: 1 1 0;
  box-sizing: border-box;
}

.api-key-secret button {
  flex: 0 0 auto;
}

.api-key-actions {
  align-items: center;
  justify-content: space-between;
}

.api-key-limit {
  color: var(--muted);
  font-size: 11px;
}

@media (max-width: 620px) {
  .api-key-list-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .api-key-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .api-key-actions button {
    width: 100%;
  }
}

/* Registrazione vocale dedicata: desktop, browser e PWA condividono lo stesso layout. */
.voice-recording-panel {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  width: 100%;
  min-width: 0;
  gap: 10px;
  padding: 2px;
}

.voice-recording-panel[hidden] {
  display: none;
}

.composer.is-recording-voice > textarea,
.composer.is-recording-voice > .composer-toolbar {
  display: none;
}

.conversation.is-recording-voice > .starter-actions {
  display: none;
}

.voice-recording-panel .voice-waveform {
  position: relative;
  width: 100%;
  height: 54px;
  min-width: 0;
  flex: none;
  overflow: hidden;
  border-radius: 18px;
  background: color-mix(in srgb, var(--danger, #ef4444) 8%, var(--surface-soft));
}

.voice-recording-panel .voice-waveform canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.voice-recording-status {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 12px;
  pointer-events: none;
  color: var(--text);
  font-size: 0.76rem;
  line-height: 1.15;
}

.voice-recording-timer {
  flex: none;
  padding: 4px 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  font-variant-numeric: tabular-nums;
  font-weight: 750;
  backdrop-filter: blur(4px);
}

.voice-recording-status.is-warning {
  color: var(--danger, #ef4444);
}

.voice-recording-action {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface-soft);
  color: var(--text);
  cursor: pointer;
}

.voice-recording-action:hover,
.voice-recording-action:focus-visible {
  border-color: color-mix(in srgb, var(--primary) 42%, var(--border));
  background: color-mix(in srgb, var(--primary) 8%, var(--surface-soft));
}

.voice-recording-action.is-confirm {
  border-color: color-mix(in srgb, var(--primary) 48%, var(--border));
  background: var(--primary);
  color: #fff;
}

.voice-recording-action svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

@media (max-width: 760px) {
  .composer.is-recording-voice {
    padding: 8px;
  }

  .voice-recording-panel {
    grid-template-columns: 46px minmax(0, 1fr) 46px;
    gap: 9px;
  }

  .voice-recording-panel .voice-waveform {
    width: 100%;
    height: 58px;
    flex-basis: auto;
  }

  .voice-recording-status {
    gap: 6px;
    padding: 0 8px;
    font-size: 0.7rem;
  }


  .voice-recording-action {
    width: 46px;
    height: 46px;
  }
}

/* Tabelle Markdown nelle risposte Dalila */
.assistant-table-card {
  margin: 12px 0 10px;
  border: 1px solid color-mix(in srgb, var(--border) 88%, transparent);
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 96%, var(--accent) 4%);
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}
.assistant-table-toolbar { min-height:42px; display:flex; align-items:center; justify-content:space-between; gap:12px; padding:8px 12px; border-bottom:1px solid color-mix(in srgb, var(--border) 86%, transparent); background:color-mix(in srgb, var(--surface) 92%, var(--accent) 8%); }
.assistant-table-title { font-size:.78rem; letter-spacing:.04em; text-transform:uppercase; font-weight:700; opacity:.72; }
.assistant-table-copy { border:0; border-radius:8px; background:transparent; color:var(--accent); font:inherit; font-size:.78rem; cursor:pointer; padding:5px 8px; }
.assistant-table-copy:hover,.assistant-table-copy:focus-visible { background:color-mix(in srgb, var(--accent) 10%, transparent); outline:none; }
.assistant-table-scroll { width:100%; overflow-x:auto; overscroll-behavior-inline:contain; scrollbar-width:thin; }
.assistant-markdown-table { width:100%; min-width:420px; border-collapse:collapse; font-size:.9rem; line-height:1.45; }
.assistant-markdown-table th,.assistant-markdown-table td { padding:10px 13px; border-bottom:1px solid color-mix(in srgb, var(--border) 76%, transparent); vertical-align:middle; white-space:nowrap; }
.assistant-markdown-table th { font-size:.8rem; font-weight:700; background:color-mix(in srgb, var(--surface) 94%, var(--accent) 6%); }
.assistant-markdown-table tbody tr:last-child td { border-bottom:0; }
.assistant-markdown-table tbody tr:hover td { background:color-mix(in srgb, var(--accent) 5%, transparent); }
.assistant-markdown-table [data-align="right"] { text-align:right; }
.assistant-markdown-table [data-align="center"] { text-align:center; }
.assistant-markdown-table [data-align="left"] { text-align:left; }

/* XLSX non usa i modelli PDF/Word. !important evita override dei display storici. */
.report-template-option.is-hidden,.report-template-manager.is-hidden,.report-template-option[hidden],.report-template-manager[hidden] { display:none !important; }
.report-option-grid.is-spreadsheet { grid-template-columns:minmax(0,1fr) !important; }

@media (max-width:620px) {
  .assistant-table-card { margin-left:-2px; margin-right:-2px; border-radius:12px; }
  .assistant-markdown-table { min-width:360px; font-size:.86rem; }
  .assistant-markdown-table th,.assistant-markdown-table td { padding:9px 11px; }
}


/* Blocchi citazione nelle risposte: testo pulito e copiabile, senza i marcatori Markdown >. */
.assistant-quote-card {
  width: min(100%, 900px);
  margin: 10px 0;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--border) 88%, transparent);
  border-radius: 13px;
  background: var(--surface-elevated);
  box-shadow: 0 7px 22px rgba(15, 23, 42, 0.05);
}

.assistant-quote-header {
  display: flex;
  min-height: 40px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 10px 7px 13px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-soft) 92%, var(--primary) 8%);
}

.assistant-quote-title {
  color: var(--text);
  font-size: 12px;
  font-weight: 750;
}

.assistant-quote-copy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 7px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  font-weight: 650;
}

.assistant-quote-copy:hover,
.assistant-quote-copy:focus-visible {
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  color: var(--primary);
  outline: none;
}

.assistant-quote-copy-icon {
  font-size: 15px;
  line-height: 1;
}

.assistant-quote-body {
  padding: 14px 16px 15px;
  color: var(--text);
  font-size: inherit;
  line-height: 1.62;
  white-space: normal;
  overflow-wrap: anywhere;
}

.message-assistant .message-bubble .assistant-quote-body code {
  font-size: .92em;
}

@media (max-width: 700px) {
  .assistant-quote-card {
    width: 100%;
    border-radius: 12px;
  }

  .assistant-quote-body {
    padding: 12px 13px 13px;
  }
}

/* Report Excel: il branding usa esclusivamente le Risorse immagini. */
.report-branding-option.is-hidden,
.report-branding-option[hidden],
[data-report-manage-image-assets].is-hidden,
[data-report-manage-image-assets][hidden] {
  display: none !important;
}

.report-option-grid.is-spreadsheet {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

/* Dialog: lo scroll avviene nel contenuto, quindi resta separato dal bordo arrotondato. */
.account-dialog.has-inset-scroll {
  max-height: min(90dvh, 900px);
  overflow: hidden !important;
  position: relative;
}

.account-dialog.has-inset-scroll > .account-dialog-scroll {
  box-sizing: border-box;
  width: 100%;
  max-height: calc(min(90dvh, 900px) - 56px);
  padding-right: 9px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--muted) 38%, transparent) transparent;
}

.account-dialog.has-inset-scroll > .account-dialog-scroll::-webkit-scrollbar {
  width: 6px;
}

.account-dialog.has-inset-scroll > .account-dialog-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.account-dialog.has-inset-scroll > .account-dialog-scroll::-webkit-scrollbar-thumb {
  min-height: 44px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 36%, transparent);
}

.account-dialog.has-inset-scroll > .account-dialog-scroll::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}

.account-dialog.has-inset-scroll > .account-dialog-close {
  z-index: 5;
}

.report-generation-dialog.has-inset-scroll,
.document-templates-dialog.has-inset-scroll {
  overflow: hidden !important;
  scrollbar-gutter: auto;
}

@media (max-width: 620px) {
  .report-option-grid.is-spreadsheet {
    grid-template-columns: 1fr !important;
  }

  .account-dialog.has-inset-scroll {
    max-height: calc(100dvh - 18px);
  }

  .account-dialog.has-inset-scroll > .account-dialog-scroll {
    max-height: calc(100dvh - 62px);
    padding-right: 7px;
  }
}

.document-templates-dialog.has-inset-scroll .document-template-list {
  max-height: none;
  overflow: visible;
}


/* Guest registration hero - 03/09/2026 */
.registration-banner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 350px);
  min-height: 0;
  align-items: center;
  justify-content: initial;
  gap: 32px;
  margin: 18px 24px 0;
  padding: 28px 46px;
  border: 1px solid color-mix(in srgb, var(--primary) 25%, var(--border));
  border-radius: 20px;
  background:
    radial-gradient(circle at 12% 24%, color-mix(in srgb, var(--primary) 13%, transparent), transparent 28%),
    linear-gradient(112deg, color-mix(in srgb, var(--primary) 7%, var(--surface)) 0%, var(--surface) 58%, color-mix(in srgb, var(--primary) 5%, var(--surface)) 100%);
  box-shadow: 0 14px 40px color-mix(in srgb, var(--text) 5%, transparent);
  color: var(--text);
  font-size: inherit;
  text-align: left;
}

.registration-banner[hidden] { display: none !important; }

.registration-banner-main {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  gap: 24px;
}

.registration-banner-icon {
  display: grid;
  width: 62px;
  height: 62px;
  flex: 0 0 62px;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg, color-mix(in srgb, var(--primary) 72%, #39a6ff), var(--primary));
  box-shadow: 0 10px 24px color-mix(in srgb, var(--primary) 24%, transparent);
  color: #fff;
}

.registration-banner-icon svg {
  width: 34px;
  height: 34px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.registration-banner-copy { min-width: 0; }

.registration-banner h2 {
  margin: 2px 0 8px;
  color: var(--text);
  font-size: clamp(19px, 1.5vw, 25px);
  font-weight: 820;
  letter-spacing: -.025em;
  line-height: 1.18;
}

.registration-banner-copy > p {
  max-width: 780px;
  margin: 0;
  color: color-mix(in srgb, var(--text) 78%, var(--muted));
  font-size: 14px;
  line-height: 1.55;
}

.registration-banner-benefits {
  display: flex;
  flex-wrap: wrap;
  gap: 18px 30px;
  margin-top: 24px;
}

.registration-banner-benefits > span {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: color-mix(in srgb, var(--text) 84%, var(--muted));
  font-size: 12px;
  line-height: 1.35;
}

.registration-banner-benefits i {
  display: grid;
  width: 37px;
  height: 37px;
  flex: 0 0 37px;
  place-items: center;
  border-radius: 12px;
  background: color-mix(in srgb, var(--primary) 11%, var(--surface));
  color: var(--primary);
}

.registration-banner-benefits i svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.registration-banner-benefits b { font-weight: 690; }

.registration-banner-cta {
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 13px;
}

.registration-banner .registration-banner-primary {
  display: inline-flex;
  width: 100%;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 11px 20px;
  border: 1px solid color-mix(in srgb, var(--primary) 72%, #fff);
  border-radius: 13px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--primary) 86%, #3e91ff), var(--primary));
  box-shadow: 0 10px 24px color-mix(in srgb, var(--primary) 24%, transparent);
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
  transition: transform 140ms ease, box-shadow 140ms ease, filter 140ms ease;
}

.registration-banner .registration-banner-primary:hover,
.registration-banner .registration-banner-primary:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 13px 28px color-mix(in srgb, var(--primary) 30%, transparent);
  filter: brightness(1.035);
  outline: 0;
}

.registration-banner-primary svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.registration-banner-cta > p {
  margin: 0;
  color: color-mix(in srgb, var(--text) 78%, var(--muted));
  font-size: 12px;
}

.registration-banner-cta > p button {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}


.registration-banner-api {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 0;
  padding-top: 18px;
  border-top: 1px solid color-mix(in srgb, var(--border) 76%, transparent);
  color: color-mix(in srgb, var(--text) 72%, var(--muted));
}

.registration-banner-api-icon {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--primary) 17%, var(--border));
  border-radius: 11px;
  background: color-mix(in srgb, var(--primary) 7%, var(--surface));
  color: var(--primary);
}

.registration-banner-api-icon svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.registration-banner-api p {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.45;
}

.registration-banner-api b {
  color: color-mix(in srgb, var(--text) 90%, var(--muted));
  font-weight: 760;
}

.registration-banner-api a {
  margin-left: 5px;
  color: var(--primary);
  font-weight: 780;
  text-decoration: none;
}

.registration-banner-api a:hover,
.registration-banner-api a:focus-visible {
  text-decoration: underline;
  outline: 0;
}

.registration-banner-close {
  position: absolute;
  top: 16px;
  right: 16px;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.registration-banner-close:hover {
  background: color-mix(in srgb, var(--text) 6%, transparent);
  color: var(--text);
}

.registration-banner-close svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.8;
}

@media (max-width: 1100px) {
  .registration-banner {
    grid-template-columns: 1fr;
    gap: 22px;
    padding: 24px 34px;
  }

  .registration-banner-cta {
    align-items: flex-start;
    padding-left: 86px;
  }

  .registration-banner .registration-banner-primary {
    width: min(100%, 360px);
  }
}

@media (max-width: 760px) {
  .registration-banner {
    gap: 18px;
    margin: 10px 10px 0;
    padding: 20px 18px;
    border-radius: 17px;
  }

  .registration-banner-main { gap: 14px; }

  .registration-banner-icon {
    width: 48px;
    height: 48px;
    flex-basis: 48px;
  }

  .registration-banner-icon svg { width: 27px; height: 27px; }

  .registration-banner h2 {
    padding-right: 25px;
    font-size: 17px;
  }

  .registration-banner-copy > p { font-size: 12px; }

  .registration-banner-benefits {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 18px;
  }

  .registration-banner-benefits i { width: 32px; height: 32px; flex-basis: 32px; }
  .registration-banner-benefits i svg { width: 18px; height: 18px; }

  .registration-banner-cta {
    align-items: stretch;
    padding-left: 0;
  }

  .registration-banner .registration-banner-primary { width: 100%; }
  .registration-banner-cta > p { text-align: center; }

  .registration-banner-api {
    gap: 10px;
    padding-top: 14px;
  }

  .registration-banner-api-icon {
    width: 31px;
    height: 31px;
    flex-basis: 31px;
  }

  .registration-banner-api-icon svg { width: 17px; height: 17px; }
  .registration-banner-api p { font-size: 10.5px; }
}

@media (min-width: 761px) and (max-height: 760px) {
  .registration-banner {
    margin-top: 8px;
    padding: 14px 28px;
    gap: 24px;
  }

  .registration-banner-icon { width: 44px; height: 44px; flex-basis: 44px; }
  .registration-banner-icon svg { width: 25px; height: 25px; }
  .registration-banner h2 { margin-bottom: 4px; font-size: 17px; }
  .registration-banner-copy > p { font-size: 11px; line-height: 1.4; }
  .registration-banner-benefits { gap: 10px 24px; margin-top: 10px; }
  .registration-banner-benefits i { width: 30px; height: 30px; flex-basis: 30px; }
  .registration-banner-benefits > span { font-size: 10px; }
  .registration-banner .registration-banner-primary { min-height: 42px; font-size: 12px; }
}

/* Markdown strutturale nelle risposte di Dalila */
.message-assistant .assistant-markdown-heading {
  margin: 16px 0 7px;
  color: var(--text);
  font-weight: 750;
  line-height: 1.28;
  letter-spacing: -.015em;
}
.message-assistant .assistant-markdown-heading:first-child { margin-top: 0; }
.message-assistant .assistant-markdown-heading-1 { font-size: 1.32rem; }
.message-assistant .assistant-markdown-heading-2 { font-size: 1.18rem; }
.message-assistant .assistant-markdown-heading-3 { font-size: 1.06rem; }
.message-assistant .assistant-markdown-heading-4 { font-size: .98rem; }
.message-assistant .assistant-markdown-paragraph {
  margin: 0 0 9px;
  line-height: 1.58;
}
.message-assistant .assistant-markdown-paragraph:last-child { margin-bottom: 0; }
.message-assistant .assistant-markdown-list {
  margin: 7px 0 12px 1.35rem;
  padding: 0;
  line-height: 1.55;
}
.message-assistant .assistant-markdown-list li {
  margin: 4px 0;
  padding-left: .18rem;
}
/* v192.36.1: testo ed elenchi annidati dentro un elemento (elenchi CommonMark). */
.message-assistant .assistant-markdown-list li > .assistant-markdown-paragraph { margin: 2px 0 4px; }
.message-assistant .assistant-markdown-list li > .assistant-markdown-paragraph:last-child { margin-bottom: 2px; }
.message-assistant .assistant-markdown-list li > .assistant-markdown-list { margin: 3px 0 4px 1.15rem; }
.message-assistant .assistant-markdown-rule {
  height: 1px;
  margin: 16px 0;
  border: 0;
  background: color-mix(in srgb, var(--border) 86%, transparent);
}
@media (max-width: 620px) {
  .message-assistant .assistant-markdown-heading { margin-top: 13px; }
  .message-assistant .assistant-markdown-heading-1 { font-size: 1.22rem; }
  .message-assistant .assistant-markdown-heading-2 { font-size: 1.12rem; }
  .message-assistant .assistant-markdown-list { margin-left: 1.15rem; }
}

/* Restrizione IP per singola API Key */
.api-key-ip-access {
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.api-key-ip-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.api-key-ip-heading span,
.api-key-ip-access small {
  color: var(--muted);
  font-size: 10px;
}

.api-key-ip-heading strong {
  color: var(--text);
  font-size: 11px;
}

.api-key-ip-access textarea {
  width: 100%;
  min-height: 64px;
  box-sizing: border-box;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  outline: 0;
  resize: vertical;
  background: var(--surface-soft);
  color: var(--text);
  font: 11px/1.45 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.api-key-ip-access textarea:focus {
  border-color: var(--primary);
}

.api-key-ip-access > button {
  justify-self: end;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--primary);
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  font-weight: 720;
}

.api-key-ip-access > button:disabled {
  cursor: wait;
  opacity: .55;
}

/* Manager user detail: sezioni compatte, ricercabili e paginabili */
.manager-collapsible-section { overflow: visible; }
.manager-collapsible-summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; cursor: pointer; list-style: none; user-select: none; }
.manager-collapsible-summary::-webkit-details-marker { display: none; }
.manager-collapsible-summary > div { min-width: 0; }
.manager-collapsible-summary h3 { margin: 0; font-size: 14px; }
.manager-collapsible-summary span { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.manager-collapsible-summary::after { content: '▾'; flex: 0 0 auto; color: var(--muted); font-size: 14px; transition: transform .15s ease; }
.manager-collapsible-section:not([open]) .manager-collapsible-summary::after { transform: rotate(-90deg); }
.manager-collapsible-body { padding-top: 18px; }
.manager-section-search { display: flex; align-items: end; gap: 10px; margin: 0 0 14px; }
.manager-section-search label { flex: 1 1 360px; max-width: 620px; }
.manager-section-search input { width: 100%; }
.manager-section-search .manager-secondary-link { margin-bottom: 8px; }
.manager-section-pagination { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px; padding-top: 16px; color: var(--muted); font-size: 12px; }
.manager-section-page-arrow { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border: 1px solid var(--border); border-radius: 8px; color: var(--accent); text-decoration: none; }
.manager-section-page-arrow.is-disabled { color: var(--muted); opacity: .45; }
.manager-section-page-select { display: inline-flex; align-items: center; gap: 7px; }
.manager-section-page-select select { min-width: 68px; padding: 6px 28px 6px 9px; }
.manager-section-page-total { margin-left: 4px; }
.manager-api-recent-details { margin-top: 22px; border-top: 1px solid var(--border); padding-top: 18px; }
@media (max-width: 720px) {
    .manager-section-search { align-items: stretch; flex-direction: column; }
    .manager-section-search label { flex-basis: auto; max-width: none; }
    .manager-section-search .manager-secondary-link { margin-bottom: 0; }
}

/* Accessibilità: mantiene colori e dimensioni esistenti. */
:is(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--accent, #7c8cff);
  outline-offset: 3px;
}

.composer textarea:focus-visible {
  outline: 0;
  outline-offset: 0;
  box-shadow: none;
}
.message-attachment-link {
  min-width: 0;
  max-width: 100%;
}
.message-attachment-link > span {
  min-width: 0;
  overflow-wrap: anywhere;
}
@media (prefers-reduced-motion: reduce) {
  .sidebar, .sidebar-backdrop, .message-attachment-link {
    transition: none;
    scroll-behavior: auto;
  }
}

/* Focus dei campi nei popup: anello interno, evita il taglio sui bordi. */
.report-generation-dialog textarea:focus,
.report-generation-dialog textarea:focus-visible,
.image-generation-dialog textarea:focus,
.image-generation-dialog textarea:focus-visible {
  border-color: var(--primary);
  outline: 0;
  outline-offset: 0;
  box-shadow: inset 0 0 0 1px var(--primary);
}

/* Fix focus ring tagliato nel campo Istruzioni del popup progetto. */
.project-dialog textarea[data-project-instructions] {
  width: calc(100% - 6px);
  margin-inline: 3px;
}

.project-dialog textarea[data-project-instructions]:focus {
  border-color: color-mix(in srgb, var(--primary) 60%, var(--border));
  box-shadow: var(--focus-ring);
  outline: 0;
}

/* Focus dei menu select nei popup: anello interno, evita il taglio sui bordi. */
dialog[class] select:focus,
dialog[class] select:focus-visible {
  border-color: color-mix(in srgb, var(--primary) 60%, var(--border));
  outline: 0;
  outline-offset: 0;
  box-shadow: inset 0 0 0 1px var(--primary);
}

/* Selettore rapido dello Spazio nella webchat, con utilizzo integrato. */
.sidebar-space-switcher {
  position: relative;
  margin: 0 0 10px;
}
.sidebar-space-current {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) 15px;
  min-width: 0;
  align-items: center;
  column-gap: 9px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--text);
  cursor: pointer;
  list-style: none;
}
.sidebar-space-current::-webkit-details-marker { display: none; }
.sidebar-space-single {
  grid-template-columns: 18px minmax(0, 1fr);
  text-decoration: none;
}
.sidebar-space-current-icon,
.sidebar-space-option-icon {
  display: grid;
  place-items: center;
  align-self: start;
  margin-top: 1px;
}
.sidebar-space-current-icon svg,
.sidebar-space-option-icon svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sidebar-space-current-copy,
.sidebar-space-option-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}
.sidebar-space-current-name,
.sidebar-space-option-name {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-space-current-meta,
.sidebar-space-option-meta {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  font-weight: 500;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-space-usage-track {
  display: block;
  width: 100%;
  height: 3px;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 17%, transparent);
}
.sidebar-space-usage-track i {
  display: block;
  width: var(--sidebar-space-usage, 0%);
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  transition: width .18s ease, background .18s ease;
}
.sidebar-space-usage-track.is-notice i { background: var(--primary); }
.sidebar-space-usage-track.is-warning i { background: #f59e0b; }
.sidebar-space-usage-track.is-critical i { background: #f97316; }
.sidebar-space-usage-track.is-danger i { background: #ef4444; }
.sidebar-space-usage-track.is-unlimited i { width: 0 !important; }
.sidebar-space-usage-track.is-exceeded i { background: #ef4444; }
.sidebar-space-chevron {
  width: 15px !important;
  height: 15px !important;
  align-self: start;
  margin-top: 1px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform .15s ease;
}
.sidebar-space-switcher[open] .sidebar-space-chevron { transform: rotate(180deg); }
.sidebar-space-menu {
  position: absolute;
  z-index: 80;
  bottom: calc(100% + 7px);
  left: 0;
  width: min(282px, calc(100vw - 28px));
  max-height: 340px;
  padding: 6px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
  box-shadow: 0 16px 36px rgba(0, 0, 0, .28);
}
.sidebar-space-menu form { margin: 0; }
.sidebar-space-option {
  display: grid;
  width: 100%;
  min-width: 0;
  grid-template-columns: 18px minmax(0, 1fr) 16px;
  align-items: start;
  column-gap: 9px;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  font: inherit;
}
.sidebar-space-option:hover,
.sidebar-space-option.is-active { background: var(--surface-soft); }
.sidebar-space-active-mark {
  align-self: start;
  padding-top: 1px;
  color: var(--primary);
  font-size: 12px;
  line-height: 1;
}
.sidebar-is-collapsed .sidebar-space-switcher { width: 48px; }
.sidebar-is-collapsed .sidebar-space-current {
  width: 48px;
  grid-template-columns: 1fr;
  justify-items: center;
  padding-right: 0;
  padding-left: 0;
}
.sidebar-is-collapsed .sidebar-space-current-copy,
.sidebar-is-collapsed .sidebar-space-chevron { display: none; }
.sidebar-is-collapsed .sidebar-space-single { grid-template-columns: 1fr; }
.sidebar-is-collapsed .sidebar-space-current-icon { align-self: center; margin-top: 0; }
.sidebar-is-collapsed .sidebar-space-menu { left: 0; }

@media (max-width: 760px) {
  .sidebar-is-collapsed .sidebar-space-switcher { width: auto; }
  .sidebar-is-collapsed .sidebar-space-current {
    width: auto;
    grid-template-columns: 18px minmax(0, 1fr) 15px;
    justify-items: stretch;
    padding-right: 10px;
    padding-left: 10px;
  }
  .sidebar-is-collapsed .sidebar-space-current-copy { display: grid; }
  .sidebar-is-collapsed .sidebar-space-chevron { display: block; }
  .sidebar-is-collapsed .sidebar-space-single { grid-template-columns: 18px minmax(0, 1fr); }
}

/* Il menu del selettore Spazio deve poter uscire dalla colonna laterale. */
@media (min-width: 761px) {
  .sidebar {
    position: relative;
    z-index: 50;
    overflow: visible;
  }

  .sidebar-history {
    overflow: hidden;
  }

  .sidebar-space-switcher {
    z-index: 90;
  }

  .sidebar-space-menu {
    z-index: 100;
  }
}


/* Generatore immagini: riferimenti opzionali compatti, chiusi di default. */
.image-generation-references {
  margin-top: 2px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-soft);
  overflow: hidden;
}

.image-generation-references > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  color: var(--text);
  cursor: pointer;
  list-style: none;
  font-size: 12px;
  font-weight: 750;
  user-select: none;
}

.image-generation-references > summary::-webkit-details-marker { display: none; }
.image-generation-references > summary::before {
  content: '';
  display: inline-block;
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  margin-right: 8px;
  border-radius: 50%;
  background:
    linear-gradient(var(--primary), var(--primary)) center / 8px 1.5px no-repeat,
    linear-gradient(var(--primary), var(--primary)) center / 1.5px 8px no-repeat,
    var(--surface-elevated);
}
.image-generation-references[open] > summary::before {
  background:
    linear-gradient(var(--primary), var(--primary)) center / 8px 1.5px no-repeat,
    var(--surface-elevated);
}
.image-generation-references > summary > span { flex: 1 1 auto; }
.image-generation-references > summary > small {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.image-generation-reference-body {
  display: grid;
  gap: 0;
  padding: 0 12px 12px;
}

.image-generation-reference-slot {
  display: grid;
  gap: 9px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

.image-generation-reference-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.image-generation-reference-heading > div:first-child {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.image-generation-reference-heading strong {
  color: var(--text);
  font-size: 11px;
}

.image-generation-reference-heading small,
.image-generation-resource-picker > p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.image-generation-reference-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.image-generation-reference-actions .secondary-action {
  min-height: 30px;
  padding: 6px 9px;
  white-space: nowrap;
  font-size: 10px;
}

.image-generation-reference-selected {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 7px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-elevated);
}

.image-generation-reference-selected[hidden],
.image-generation-resource-picker[hidden] { display: none !important; }

.image-generation-reference-selected img {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--surface);
}

.image-generation-reference-selected strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
}

.image-generation-reference-selected button {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 10px;
  font-weight: 700;
}

.image-generation-reference-selected button:hover { color: var(--text); }

.image-generation-resource-picker {
  display: grid;
  gap: 8px;
  padding-top: 2px;
}

.image-generation-resource-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  max-height: 190px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

@media (max-width: 640px) {
  .image-generation-reference-heading {
    align-items: flex-start;
    flex-direction: column;
  }
  .image-generation-reference-actions {
    width: 100%;
    justify-content: flex-start;
  }
  .image-generation-reference-actions .secondary-action { flex: 0 1 auto; }
  .image-generation-resource-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Download dei file generati in chat */
.message-attachments {
  gap: 10px;
  margin-top: 10px;
}

.message-attachment-link.is-generated-download {
  display: grid;
  width: min(100%, 480px);
  max-width: 480px;
  min-height: 66px;
  grid-template-columns: 46px minmax(0, 1fr) 36px;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border: 1px solid color-mix(in srgb, var(--border) 86%, var(--primary));
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface-elevated) 82%, var(--surface-soft));
  box-shadow: 0 6px 18px color-mix(in srgb, var(--background) 12%, transparent);
  color: var(--text);
  text-decoration: none;
  transition: transform 140ms ease, border-color 140ms ease, background-color 140ms ease, box-shadow 140ms ease;
}

.message-attachment-link.is-generated-download:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--primary) 50%, var(--border));
  background: color-mix(in srgb, var(--surface-elevated) 90%, var(--primary) 10%);
  box-shadow: 0 10px 24px color-mix(in srgb, var(--background) 18%, transparent);
}

.message-attachment-link.is-generated-download:active {
  transform: translateY(0);
}

.message-attachment-file-icon {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--primary) 22%, var(--border));
  border-radius: 11px;
  background: color-mix(in srgb, var(--primary) 10%, var(--surface-soft));
  color: var(--primary);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: .02em;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
}

.message-attachment-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.message-attachment-link.is-generated-download .message-attachment-name {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-attachment-link.is-generated-download .message-attachment-meta {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  font-weight: 450;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-attachment-download {
  display: grid;
  height: 34px;
  place-items: center;
  justify-self: end;
  border-radius: 10px;
  background: color-mix(in srgb, var(--primary) 9%, transparent);
  color: var(--primary);
  transition: background-color 140ms ease, transform 140ms ease;
}

.message-attachment-download svg {
  width: 18px;
  height: 18px;
}

.message-attachment-link.is-generated-download:hover .message-attachment-download {
  transform: translateY(1px);
  background: color-mix(in srgb, var(--primary) 15%, transparent);
}

@media (max-width: 620px) {
  .message-attachment-link.is-generated-download {
    width: 100%;
    max-width: none;
    gap: 9px;
    padding: 8px 9px;
  }

  .message-attachment-file-icon {
    width: 42px;
    height: 42px;
  }

  .message-attachment-download {
    height: 32px;
  }
}

/* Rifinitura CTA download */
.message-attachment-link.is-generated-download {
  grid-template-columns: 46px minmax(0, 1fr) auto;
}

.message-attachment-download {
  width: auto;
  min-width: 82px;
  padding: 0 10px;
  grid-auto-flow: column;
  gap: 6px;
  font-size: 10px;
  font-weight: 650;
}

.message-attachment-download-label {
  overflow: visible !important;
  text-overflow: clip !important;
  white-space: nowrap !important;
}

@media (max-width: 620px) {
  .message-attachment-link.is-generated-download {
    grid-template-columns: 42px minmax(0, 1fr) 32px;
  }

  .message-attachment-download {
    width: 32px;
    min-width: 32px;
    padding: 0;
  }

  .message-attachment-download-label {
    display: none;
  }
}

/* Riga di stato mostrata sotto un testo parziale durante la ripresa di un
   turno: si allinea al testo della risposta, non al loader a bolla vuota. */
.dalila-partial-status {
  display: flex;
  margin-top: 10px;
  margin-left: 0;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 13px;
}

.dalila-partial-status .dalila-loader-mark {
  width: 26px;
  height: 26px;
  border-radius: 9px;
  box-shadow: none;
}

.dalila-partial-status .dalila-loader-image {
  width: 16px;
  height: 16px;
}


/* Registrazione separata e accesso email, 10/09/2026 */
.topbar-actions .account-register-trigger {
  display:flex;
  min-height:38px;
  align-items:center;
  gap:7px;
  padding:4px 12px 4px 8px;
  border:1px solid color-mix(in srgb,var(--primary) 72%,var(--border));
  border-radius:13px;
  background:var(--primary);
  color:#fff;
  cursor:pointer;
  font:inherit;
  font-size:11px;
  font-weight:780;
  box-shadow:0 7px 18px color-mix(in srgb,var(--primary) 20%,transparent);
  transition:transform 150ms ease,box-shadow 150ms ease,filter 150ms ease;
}
.topbar-actions .account-register-trigger svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.topbar-actions .account-register-trigger:hover,.topbar-actions .account-register-trigger:focus-visible{filter:brightness(1.06);transform:translateY(-1px);outline:0}
.login-dialog.register-dialog{width:min(92vw,460px)}
.auth-dialog-separator{position:relative;display:flex;align-items:center;justify-content:center;margin:5px 0;color:var(--muted);font-size:10px;text-transform:uppercase;letter-spacing:.08em}
.auth-dialog-separator::before,.auth-dialog-separator::after{content:"";height:1px;flex:1;background:var(--border)}
.auth-dialog-separator span{padding:0 10px}
.auth-email-form,.registration-dialog-form{display:grid;gap:10px;width:100%}
.auth-email-form input,.registration-dialog-form>input[type="email"]{width:100%;min-height:44px;padding:0 13px;border:1px solid var(--border);border-radius:11px;background:var(--surface);color:var(--text);font:inherit;font-size:12px;outline:none}
.auth-email-form input:focus,.registration-dialog-form>input[type="email"]:focus{border-color:color-mix(in srgb,var(--primary) 62%,var(--border));box-shadow:0 0 0 3px color-mix(in srgb,var(--primary) 10%,transparent)}
.auth-email-form button,.email-registration-submit{min-height:44px;border:0;border-radius:11px;background:var(--text);color:var(--background);font:inherit;font-size:12px;font-weight:800;cursor:pointer}
.registration-dialog-form .social-login{width:100%;justify-content:center;margin:0;cursor:pointer;font:inherit}
.registration-legal-check{display:flex;align-items:flex-start;gap:9px;margin-top:5px;color:var(--muted);font-size:10px;line-height:1.5;text-align:left}
.registration-legal-check input{width:15px;height:15px;margin:1px 0 0;flex:0 0 auto;accent-color:var(--primary)}
.registration-legal-check a,.auth-dialog-switch button{color:var(--primary);text-decoration:none}
.auth-dialog-switch{margin:3px 0 0!important;font-size:10px!important;text-align:center}
.auth-dialog-switch button{padding:0;border:0;background:transparent;cursor:pointer;font:inherit;font-weight:760}
@media(max-width:560px){.topbar-actions .account-register-trigger{padding:4px 9px}.topbar-actions .account-register-trigger svg{display:none}.topbar-actions .account-register-trigger span{font-size:10px}}
@media(prefers-reduced-motion:reduce){.account-register-trigger{transition:none!important}}


/* Chat reading viewport: keep the beginning of a streamed reply stable. */
.conversation {
  position: relative;
}

.message-list.is-stream-reading {
  overflow-anchor: none;
}

.chat-scroll-latest {
  position: absolute;
  left: 50%;
  bottom: var(--chat-scroll-latest-bottom, 96px);
  z-index: 14;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: color-mix(in srgb, var(--surface-elevated) 94%, transparent);
  color: var(--text);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
  backdrop-filter: blur(12px);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity 140ms ease, transform 140ms ease, border-color 140ms ease;
}

.chat-scroll-latest[hidden] {
  display: none !important;
}

.chat-scroll-latest.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}

.chat-scroll-latest:hover,
.chat-scroll-latest:focus-visible {
  border-color: color-mix(in srgb, var(--primary) 62%, var(--border));
}

.chat-scroll-latest svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Streaming status: animated dots instead of a moving viewport. */
.message-assistant .message-bubble.is-fluid-streaming::after {
  width: auto;
  height: auto;
  margin-left: .38em;
  border-radius: 0;
  background: transparent;
  content: '...';
  color: var(--muted);
  font-size: .78em;
  font-weight: 800;
  letter-spacing: .08em;
  vertical-align: .08em;
  animation: dalila-writing-dots 1s ease-in-out infinite;
}

@keyframes dalila-writing-dots {
  0%, 100% { opacity: .28; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-1px); }
}

@media (max-width: 760px) {
  .chat-scroll-latest {
    width: 36px;
    height: 36px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .message-assistant .message-bubble.is-fluid-streaming::after {
    animation: none;
  }
}


/* Shared image attachment card: sent messages and retained history. */
.message-attachments .chat-image-card {
  width: 288px;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(112, 139, 176, .22);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 3px 12px rgba(31, 56, 91, .05);
  color: #243b5a;
  text-align: left;
}
.chat-image-card .chat-image-preview {
  position: relative;
  display: block;
  width: 100%;
  height: 160px;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  overflow: hidden;
  background: #edf2f8;
  cursor: zoom-in;
}
.chat-image-card .chat-image-preview img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: center top;
}
.chat-image-zoom {
  position: absolute;
  right: 9px;
  bottom: 9px;
  padding: 4px 8px;
  border-radius: 7px;
  background: rgba(20, 37, 59, .75);
  color: #fff;
  font-weight: 500;
  line-height: 1.4;
  font-size: 11px;
  opacity: 0;
  transition: opacity .15s ease;
  pointer-events: none;
}
.chat-image-preview:hover .chat-image-zoom,
.chat-image-preview:focus-visible .chat-image-zoom { opacity: 1; }
.chat-image-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
}
.chat-image-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 500;
  color: #435773;
}
.chat-image-card .chat-image-download {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 34px;
  padding: 0 9px;
  border: 1px solid #dbe6f5;
  border-radius: 8px;
  background: #f2f6fc;
  color: #285da4;
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
}
.chat-image-card .chat-image-download:hover { background: #e5eefb; border-color: #b9cee9; }
.chat-image-card .chat-image-download:focus-visible,
.chat-image-card .chat-image-preview:focus-visible { outline: 2px solid #377bdd; outline-offset: -3px; }
@media (hover: none) {
  .chat-image-zoom { opacity: 1; }
  .chat-image-card .chat-image-download { min-height: 44px; }
}
@media (max-width: 480px) {
  .message-attachments .chat-image-card { width: 260px; }
  .chat-image-card .chat-image-preview { height: 148px; }
}

/* ------------------------------------------------------------------------ */
/* Memoria dell'utente (v35): pannello e badge sul messaggio                 */
/* ------------------------------------------------------------------------ */
.memory-dialog {
  box-sizing: border-box;
  width: min(92vw, 640px);
  height: min(88dvh, 820px);
  max-height: min(88dvh, 820px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.memory-dialog:not([open]) { display: none; }
.memory-dialog > p { flex: 0 0 auto; margin: 0 0 12px; }
.memory-toolbar {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 8px 0 10px;
  border-top: 1px solid var(--border);
}
.memory-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.memory-switch input { width: 16px; height: 16px; accent-color: var(--primary); }
.memory-count { color: var(--muted); font-size: 11.5px; }
.memory-forget-all {
  margin-left: auto;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--danger, #b42318);
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  font-weight: 700;
}
.memory-forget-all:disabled { cursor: default; opacity: .45; }
.memory-add {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  margin: 0 0 12px;
}
.memory-add input,
.memory-add select,
.memory-add button {
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-soft);
  color: var(--text);
  font: inherit;
  font-size: 12px;
}
.memory-add input { min-width: 0; }
.memory-add button {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}
.memory-add button:disabled { opacity: .5; cursor: default; }
.memory-list {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 6px;
  scrollbar-gutter: stable;
}
.memory-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: 12px;
  background: var(--surface-soft);
}
.memory-card-context { border-left-color: var(--success, #2c9758); }
.memory-card-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px;
  color: var(--muted);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.memory-content { margin: 0; font-size: 13px; line-height: 1.5; color: var(--text); overflow-wrap: anywhere; }
.memory-editor {
  box-sizing: border-box;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--primary);
  border-radius: 9px;
  background: var(--surface-elevated, transparent);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  resize: vertical;
}
.memory-card-actions { display: flex; gap: 4px; }
.memory-card-actions button {
  padding: 4px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 11px;
}
.memory-card-actions button:hover,
.memory-card-actions button:focus-visible { background: var(--surface-elevated, rgba(0, 0, 0, .06)); color: var(--primary); outline: 0; }
.memory-card-actions button.is-danger:hover,
.memory-card-actions button.is-danger:focus-visible { color: var(--danger, #b42318); }
.memory-dialog.is-disabled .memory-list { opacity: .6; }
.memory-dialog .storage-status.is-error { color: var(--danger, #b42318); }

/* Badge di memoria sotto la risposta */
.message-memory {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  max-width: min(100%, 760px);
  margin-top: 6px;
  padding: 3px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 10.5px;
  line-height: 1.4;
  text-align: left;
}
.message-memory::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
  flex: 0 0 auto;
}
.message-memory-forgotten::before { background: var(--muted); }
.message-memory-refused::before { background: var(--danger, #b42318); }
.message-memory:hover,
.message-memory:focus-visible { color: var(--primary); outline: 0; border-color: var(--primary); }

@media (max-width: 620px) {
  .memory-dialog { width: 96vw; height: min(92dvh, 820px); max-height: min(92dvh, 820px); }
  .memory-add { grid-template-columns: 1fr; }
  .memory-forget-all { margin-left: 0; }
}

/* Messaggio in coda mentre Dalila risponde */
.message-row.is-queued .message-bubble { opacity: .55; border: 1px dashed var(--border); }
.message-queued-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 10.5px;
}
.message-queued-note button {
  padding: 2px 7px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 10.5px;
}
.message-queued-note button:hover,
.message-queued-note button:focus-visible { color: var(--primary); border-color: var(--primary); outline: 0; }

/* Gestione della memoria account */
.memory-details { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.4; }
.memory-add { grid-template-columns: minmax(0, 1fr) auto; }
.memory-filters { display: flex; gap: 8px; margin-bottom: 12px; flex-shrink: 0; }
.memory-filters input { flex: 1; min-width: 0; }
.memory-filters input, .memory-filters select, .memory-edit-fields input, .memory-edit-fields select {
    padding: 7px 9px; border: 1px solid var(--border); border-radius: 8px;
    background: var(--surface-soft); color: var(--text); font: inherit; font-size: 12px; min-width: 0;
}
.memory-edit-fields { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; }
.memory-edit-fields textarea { grid-column: 1 / -1; }
.memory-dialog button:disabled { opacity: .5; cursor: default; }
.memory-dialog input:focus-visible, .memory-dialog select:focus-visible, .memory-dialog textarea:focus-visible {
    outline: 2px solid var(--primary); outline-offset: 2px;
}
@media (max-width: 560px) {
    .memory-dialog { width: 96vw; height: 92dvh; max-height: 92dvh; overflow-y: auto; }
    .memory-dialog > p { font-size: 12px; }
    .memory-add, .memory-edit-fields { grid-template-columns: minmax(0, 1fr); }
    .memory-filters { flex-wrap: wrap; }
    .memory-list { flex-basis: 120px; }
}

/* Sezioni richiudibili della memoria account */
.memory-section {
  flex: 0 0 auto;
  min-width: 0;
  border-top: 1px solid var(--border);
}
.memory-section > summary {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 28px;
  padding: 13px 26px 13px 0;
  color: var(--text);
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.memory-section > summary::-webkit-details-marker { display: none; }
.memory-section > summary::after {
  content: '';
  position: absolute;
  top: 50%;
  right: 5px;
  width: 7px;
  height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-65%) rotate(45deg);
  transition: transform .16s ease;
}
.memory-section[open] > summary::after { transform: translateY(-35%) rotate(225deg); }
.memory-section > summary:hover,
.memory-section > summary:focus-visible { color: var(--primary); outline: 0; }
.memory-section > summary span { font-size: 13px; font-weight: 750; }
.memory-section > summary small {
  align-self: center;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 400;
}
.memory-section .memory-add { margin: 0 0 14px; }
.memory-section-search[open] {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 150px;
  overflow: hidden;
}
.memory-section-search > summary { flex: 0 0 auto; }
.memory-search-content {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  padding-bottom: 2px;
  overflow: hidden;
}
.memory-search-content .memory-list { flex: 1 1 auto; }
.memory-section:not([open]) + .storage-footer { margin-top: auto; }
@media (max-width: 560px) {
  .memory-section > summary { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .memory-section > summary small { padding-right: 4px; }
  .memory-section-search[open] { min-height: 120px; }
}


/* Ricerca live nelle conversazioni, 21/09/2026 */
.sidebar-search-trigger {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: var(--muted);
}

.sidebar-header .brand-image-full {
  max-width: 100%;
}

.sidebar-search-trigger:hover,
.sidebar-search-trigger:focus-visible {
  color: var(--text);
}


.conversation-search-dialog {
  width: min(94vw, 680px);
  max-height: min(82vh, 720px);
  padding: 24px;
  overflow: hidden;
}

.conversation-search-input-wrap {
  display: flex;
  min-height: 46px;
  align-items: center;
  gap: 10px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface-soft);
}

.conversation-search-input-wrap:focus-within {
  border-color: color-mix(in srgb, var(--primary) 55%, var(--border));
}

.conversation-search-input-wrap svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  color: var(--muted);
}

.conversation-search-input-wrap input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

.conversation-search-input-wrap input::placeholder {
  color: var(--muted);
}

.conversation-search-input-wrap input::-webkit-search-cancel-button {
  cursor: pointer;
}

.conversation-search-status {
  min-height: 18px;
  margin: 9px 2px 5px !important;
  color: var(--muted) !important;
  font-size: 10.5px !important;
}

.conversation-search-results {
  display: grid;
  max-height: min(56vh, 470px);
  gap: 5px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 2px 2px 2px 0;
}

.conversation-search-result {
  display: grid;
  width: 100%;
  gap: 4px;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.conversation-search-result:hover,
.conversation-search-result:focus-visible {
  border-color: color-mix(in srgb, var(--primary) 26%, var(--border));
  background: var(--surface-soft);
  outline: 0;
}

.conversation-search-result strong {
  overflow: hidden;
  font-size: 13px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-search-result small {
  overflow: hidden;
  color: var(--muted);
  font-size: 9.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-search-snippet {
  display: -webkit-box;
  overflow: hidden;
  color: color-mix(in srgb, var(--text) 78%, var(--muted));
  font-size: 11.5px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

@media (max-width: 700px) {
  .conversation-search-dialog {
    width: calc(100vw - 22px);
    max-height: 86vh;
    padding: 20px 16px 16px;
  }

  .conversation-search-results {
    max-height: 62vh;
  }
}

/* Ricerca chat: mantiene solo il focus esterno, senza bordo blu interno. */
.conversation-search-input-wrap:focus-within {
  border-color: var(--border);
  box-shadow: var(--focus-ring);
}

.conversation-search-input-wrap input:focus,
.conversation-search-input-wrap input:focus-visible {
  outline: 0;
  outline-offset: 0;
  box-shadow: none;
}

/* Tasto invio che diventa tasto di stop mentre Dalila risponde.
   Stessa forma, stessa dimensione, stesso fondo: cambia solo il glifo,
   come gia' fa il tasto vocale fra microfono e stop. */
.send-button .send-icon-stop {
  display: none;
  fill: currentColor;
  stroke: none;
}

.send-button.is-stopping .send-icon-send {
  display: none;
}

.send-button.is-stopping .send-icon-stop {
  display: block;
}

/* Nota sotto una risposta fermata dall'utente. */
.message-stopped-note {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 11px;
}

/* Identita' dell'assistente nel Manager (Organizzazioni > dettaglio).
   Riusa il pannello comprimibile e il form della scheda anagrafica: qui
   serve solo separare gli Spazi fra loro, perche' un'organizzazione puo'
   averne piu' di uno e i form si confonderebbero. */
.manager-assistant-space + .manager-assistant-space {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.manager-assistant-space-head {
  /* .knowledge-form porta gia' il proprio padding laterale: intestazione e
     riga di ripristino lo replicano per restare allineate ai campi. */
  padding: 0 15px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.manager-assistant-space-head h4 {
  margin: 0;
  font-size: 0.98rem;
}

.manager-assistant-space-head span {
  font-size: 0.82rem;
}

.manager-assistant-form textarea {
  min-height: 170px;
  font-family: inherit;
}

.manager-assistant-revert {
  margin-top: 10px;
  padding: 0 15px 4px;
}

.manager-assistant-section > .manager-alert {
  margin: 0 15px 14px;
}


/* Chat temporanea (v68): pulsante accanto al tema, banner e azioni non disponibili. */
.temporary-chat-toggle {
  color: var(--muted);
}

.temporary-chat-toggle .temporary-chat-bubble,
.temporary-chat-banner .temporary-chat-bubble {
  stroke-dasharray: 3 2.4;
}

.temporary-chat-toggle.is-active {
  border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
  background: var(--primary-soft-strong);
  color: var(--text);
}

.temporary-chat-toggle.is-active .temporary-chat-bubble {
  stroke-dasharray: none;
}

.temporary-chat-toggle:disabled,
.theme-toggle:disabled {
  cursor: not-allowed;
  opacity: .45;
  transform: none;
}

.temporary-chat-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px 18px;
  border-bottom: 1px solid color-mix(in srgb, var(--primary) 22%, var(--border));
  background: color-mix(in srgb, var(--primary) 8%, var(--background));
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
}

.temporary-chat-banner[hidden] {
  display: none;
}

.temporary-chat-banner svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  color: var(--primary);
}

.temporary-chat-banner p {
  max-width: 760px;
  margin: 0;
}

.temporary-chat-banner b {
  color: var(--text);
  font-weight: 700;
}

:root.temporary-chat-active .main-content {
  background:
    radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--primary) 9%, transparent), transparent 38%),
    var(--background);
}

:root.temporary-chat-active [data-message-action="remember"],
:root.temporary-chat-active [data-message-action="branch"],
:root.temporary-chat-active [data-share-conversation],
:root.temporary-chat-active [data-conversation-mode="cowork"] {
  display: none !important;
}

@media (max-width: 760px) {
  .temporary-chat-banner {
    padding: 6px 12px;
    font-size: 11px;
  }

  .mobile-keyboard-open .temporary-chat-banner p {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
  }
}

/* Selettore del modello nel composer (v131): stessi stili del selettore
   geografico (municipality-*), solo le differenze qui. */
.model-selector.is-manual { color: var(--text); border-color: color-mix(in srgb, var(--primary) 26%, var(--border)); }
.model-selector.is-manual svg:first-child { color: var(--primary); }
.model-menu { max-height: min(62vh, 440px); overflow-y: auto; overscroll-behavior: contain; }
.model-menu .scope-option > span:nth-child(2) { min-width: 0; overflow-wrap: anywhere; }
.model-menu .model-option-hint { display: block; margin-top: 1px; color: var(--muted); font-size: 10px; }
.model-notice { color: var(--muted); }
/* Barra per azienda (v133): l'agente per primo, poi GPT, Claude, Gemini... */
/* v192.36.1: spaziatura piu' stretta (con Aruba sei aziende entrano nei
   340px del menu); le schede riempiono la barra quando c'e' spazio. Se le
   aziende non entrano (Preferiti, piu' provider) la barra scorre: sfumatura
   sul lato con altre schede e rotella verticale = scorrimento orizzontale
   (dalila-model-selector.js). */
.model-menu .model-tabs { display: flex; gap: 2px; margin: 0 2px 6px; padding: 3px; overflow-x: auto; scroll-padding-inline: 24px; scrollbar-width: none; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-soft); }
.model-menu .model-tabs::-webkit-scrollbar { display: none; }
.model-menu .model-tabs.has-more-end { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); }
.model-menu .model-tabs.has-more-start { -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to left, #000 calc(100% - 28px), transparent); }
.model-menu .model-tabs.has-more-start.has-more-end { -webkit-mask-image: linear-gradient(to right, transparent, #000 28px, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to right, transparent, #000 28px, #000 calc(100% - 28px), transparent); }
.model-menu .model-tabs .model-tab { flex: 1 0 auto; width: auto; padding: 4px 7px; border-radius: 6px; color: var(--muted); font-size: 11px; font-weight: 650; line-height: 1.3; text-align: center; white-space: nowrap; }
.model-menu .model-tabs .model-tab:hover { background: transparent; color: var(--text); }
.model-menu .model-tabs .model-tab[aria-pressed="true"] { background: var(--surface-elevated); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.14); }
.model-menu .model-tabs .model-tab:focus-visible { outline: 2px solid color-mix(in srgb, var(--primary) 55%, transparent); outline-offset: 1px; }
/* Livello di ragionamento del modello scelto (v136). */
.model-menu .model-reasoning { margin: 6px 2px 2px; padding-top: 8px; border-top: 1px solid var(--border); }
.model-menu .model-reasoning-head { display: flex; align-items: baseline; gap: 6px; margin: 0 4px 6px; }
.model-menu .model-reasoning-head .context-menu-title { margin: 0; }
.model-menu .model-reasoning-value[hidden] { display: none; }
.model-menu .model-reasoning-head .model-reasoning-reset { margin-left: auto; }
.model-menu .model-reasoning-value { margin-left: auto; color: var(--muted); font-size: 11px; white-space: nowrap; }
.model-menu .model-reasoning-head .model-reasoning-reset { width: auto; padding: 0; border-radius: 0; background: transparent; color: var(--primary); font-size: 11px; font-weight: 650; white-space: nowrap; }
.model-menu .model-reasoning-head .model-reasoning-reset:hover { background: transparent; text-decoration: underline; }
.model-menu .model-reasoning-head .model-reasoning-reset[hidden] { display: none; }
/* Controllo segmentato su una sola riga: segmenti di uguale larghezza. */
.model-menu .model-segments { display: flex; gap: 2px; padding: 3px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-soft); }
.model-menu .model-segments .model-segment { position: relative; flex: 1 1 auto; width: auto; min-width: 0; padding: 6px 5px; border-radius: 6px; color: var(--muted); font-size: 11px; font-weight: 650; line-height: 1.2; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.model-menu .model-segments .model-segment:hover { background: transparent; color: var(--text); }
.model-menu .model-segments .model-segment[aria-pressed="true"] { background: var(--surface-elevated); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.14); }
.model-menu .model-segments .model-segment.is-default::after { content: ""; position: absolute; left: 50%; bottom: 2px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--primary); opacity: .75; }
.model-menu .model-segments .model-segment:focus-visible { outline: 2px solid color-mix(in srgb, var(--primary) 55%, transparent); outline-offset: 1px; }
.reasoning-toggle[hidden] { display: none !important; }
@media (max-width: 520px) {
  .model-selector { max-width: 112px; }
  /* Con anche il selettore geografico (Spazio personale) resta solo l'icona:
     la riga del composer non deve uscire dal box. */
  .composer-context-actions:has([data-municipality-context]) .model-selector [data-model-label] { display: none; }
}

/* ===================================================================
   Conversazione vocale (v138): tasto con le onde accanto al microfono e
   pannello centrale con il simbolo di Dalila. Colori dai token del tema,
   quindi corretti sia in chiaro sia in scuro.
   =================================================================== */
.voice-chat-button[hidden] { display: none; }
.voice-chat-button svg { stroke-width: 2; }

html.voice-chat-open,
html.voice-chat-open body { overflow: hidden; }

.voice-chat-stage {
  --voice-level: 0;
  --voice-accent: var(--primary);
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: max(24px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--background) 90%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  backdrop-filter: blur(14px) saturate(1.1);
  color: var(--text);
  opacity: 0;
  transition: opacity 220ms ease;
}
.voice-chat-stage[hidden] { display: none; }
.voice-chat-stage.is-visible { opacity: 1; }

.voice-chat-inner {
  display: flex;
  width: min(520px, 100%);
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}

.voice-chat-orb {
  position: relative;
  display: grid;
  width: 184px;
  height: 184px;
  margin-bottom: 10px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  cursor: default;
  -webkit-tap-highlight-color: transparent;
}
.voice-chat-orb:not(:disabled) { cursor: pointer; }
.voice-chat-orb:disabled { opacity: 1; }
.voice-chat-orb:focus-visible { outline: 2px solid var(--primary); outline-offset: 6px; }

.voice-chat-ring,
.voice-chat-core {
  position: absolute;
  border-radius: 50%;
}

.voice-chat-ring {
  inset: 0;
  border: 1.5px solid color-mix(in srgb, var(--voice-accent) 42%, transparent);
  background: radial-gradient(circle, color-mix(in srgb, var(--voice-accent) 10%, transparent) 0%, transparent 70%);
  transform: scale(calc(0.86 + var(--voice-level) * 0.3));
  transition: transform 90ms linear, opacity 200ms ease, border-color 200ms ease;
}
.voice-chat-ring-one { animation: voice-chat-ring 2.6s ease-in-out infinite; }
.voice-chat-ring-two {
  inset: -18px;
  opacity: 0.55;
  border-color: color-mix(in srgb, var(--voice-accent) 22%, transparent);
  transform: scale(calc(0.84 + var(--voice-level) * 0.42));
  animation: voice-chat-ring 2.6s ease-in-out -1.3s infinite;
}

.voice-chat-core {
  display: grid;
  width: 112px;
  height: 112px;
  place-items: center;
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  box-shadow: 0 16px 48px color-mix(in srgb, var(--voice-accent) 22%, transparent), var(--shadow);
  transform: scale(calc(1 + var(--voice-level) * 0.08));
  transition: transform 80ms linear, box-shadow 200ms ease;
}
.voice-chat-logo { width: 58px; height: 58px; object-fit: contain; }

/* In ascolto: respiro lento. Mentre l'utente parla gli anelli seguono la voce. */
.voice-chat-stage[data-state="listening"] .voice-chat-core,
.voice-chat-stage[data-state="muted"] .voice-chat-core,
.voice-chat-stage[data-state="paused"] .voice-chat-core,
.voice-chat-stage[data-state="connecting"] .voice-chat-core {
  animation: voice-chat-breathe 2.4s ease-in-out infinite;
}
.voice-chat-stage[data-state="hearing"] .voice-chat-ring { border-color: color-mix(in srgb, var(--voice-accent) 70%, transparent); }

/* Elaborazione: un anello gira, l'altro si attenua. */
.voice-chat-stage[data-state="transcribing"] .voice-chat-ring-one,
.voice-chat-stage[data-state="thinking"] .voice-chat-ring-one {
  border-color: transparent;
  border-top-color: var(--voice-accent);
  border-right-color: color-mix(in srgb, var(--voice-accent) 45%, transparent);
  background: none;
  animation: voice-chat-spin 1s linear infinite;
  transform: scale(0.92);
}
.voice-chat-stage[data-state="transcribing"] .voice-chat-ring-two,
.voice-chat-stage[data-state="thinking"] .voice-chat-ring-two { opacity: 0.2; animation: none; }

/* Dalila parla: il simbolo lampeggia e pulsa con la voce. */
.voice-chat-stage[data-state="speaking"] .voice-chat-core {
  animation: voice-chat-speaking 0.9s ease-in-out infinite;
  box-shadow: 0 0 0 calc(4px + var(--voice-level) * 18px) color-mix(in srgb, var(--voice-accent) 16%, transparent), 0 16px 48px color-mix(in srgb, var(--voice-accent) 32%, transparent);
}
.voice-chat-stage[data-state="speaking"] .voice-chat-logo { animation: voice-chat-blink 0.9s ease-in-out infinite; }
.voice-chat-stage[data-state="speaking"] .voice-chat-ring { border-color: color-mix(in srgb, var(--voice-accent) 60%, transparent); }

.voice-chat-stage[data-state="muted"] .voice-chat-ring,
.voice-chat-stage[data-state="paused"] .voice-chat-ring { opacity: 0.25; animation: none; }
.voice-chat-stage[data-state="error"] { --voice-accent: var(--danger); }
.voice-chat-stage[data-state="error"] .voice-chat-ring { animation: none; opacity: 0.35; }

.voice-chat-status {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.voice-chat-stage[data-state="error"] .voice-chat-status { color: var(--danger); }

.voice-chat-hint {
  margin: -8px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}
.voice-chat-hint[hidden],
.voice-chat-caption[hidden] { display: none; }

.voice-chat-caption {
  display: -webkit-box;
  max-width: 100%;
  min-height: 1.5em;
  margin: 2px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  overflow-wrap: anywhere;
}
.voice-chat-caption[data-who="user"] { color: var(--text); font-style: italic; }
.voice-chat-caption[data-who="user"]::before { content: "“"; }
.voice-chat-caption[data-who="user"]::after { content: "”"; }
.voice-chat-caption[data-who="error"] { color: var(--danger); }

.voice-chat-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
}

.voice-chat-control {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 8px;
  padding: 0 18px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-elevated);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 500;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}
.voice-chat-control:hover { background: var(--surface-soft); }
.voice-chat-control:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.voice-chat-control svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}
.voice-chat-control .voice-chat-icon-muted { display: none; }
.voice-chat-control.is-muted { border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); color: var(--danger); }
.voice-chat-control.is-muted .voice-chat-icon-mic { display: none; }
.voice-chat-control.is-muted .voice-chat-icon-muted { display: block; }
.voice-chat-control.is-end {
  border-color: transparent;
  background: var(--primary);
  color: #fff;
}
.voice-chat-control.is-end:hover { background: var(--primary-hover); }

@keyframes voice-chat-ring {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}
@keyframes voice-chat-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.035); }
}
@keyframes voice-chat-speaking {
  0%, 100% { transform: scale(calc(1 + var(--voice-level) * 0.08)); }
  50% { transform: scale(calc(1.05 + var(--voice-level) * 0.08)); }
}
@keyframes voice-chat-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}
@keyframes voice-chat-spin {
  to { transform: scale(0.92) rotate(360deg); }
}

@media (max-width: 640px) {
  .voice-chat-orb { width: 156px; height: 156px; }
  .voice-chat-core { width: 96px; height: 96px; }
  .voice-chat-logo { width: 50px; height: 50px; }
  .voice-chat-control { padding: 0 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .voice-chat-ring,
  .voice-chat-core,
  .voice-chat-logo { animation: none !important; transition: none; }
  .voice-chat-stage[data-state="speaking"] .voice-chat-logo { opacity: 1; }
}
/* Installation help and mobile dialogs use the same theme as the application. */
.pwa-install-dialog { width: min(440px, calc(100vw - 24px)); max-height: calc(var(--dalila-viewport-height, 100dvh) - 24px); margin: auto; inset: 0; border-radius: 22px; overflow: auto; }
.pwa-install-dialog ol { margin: 16px 0 24px; padding-left: 24px; color: var(--muted); line-height: 1.6; }
.pwa-install-dialog li + li { margin-top: 10px; }
.pwa-install-dialog > button { min-height: 44px; padding: 10px 20px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-soft); color: var(--text); cursor: pointer; }
.pwa-install-dialog > button:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
@media (max-width: 760px) {
  .account-dialog input:not([type="checkbox"]):not([type="radio"]),
  .account-dialog textarea,
  .account-dialog select { font-size: max(16px, 1em); }
  .account-dialog { overscroll-behavior: contain; }
}
@media (pointer: coarse) {
  .account-dialog-close, .image-lightbox-close { min-width: 44px; min-height: 44px; }
}

/* Bound the guest card so the composer remains reachable on short screens. */
@media (max-width: 760px), (max-height: 600px) {
  .registration-banner { flex-shrink: 0; max-height: min(280px, calc(var(--dalila-viewport-height, 100dvh) * .30)); overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; }
  .registration-banner-main, .registration-banner-copy, .registration-banner-benefits > span { min-width: 0; }
  .registration-banner-benefits { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .registration-banner-benefits b { overflow-wrap: anywhere; }
}

/* File scelto per la prossima revisione (visualizzatore condiviso). */
.revision-target {
  display: flex;
  align-items: center;
  gap: 8px;
  box-sizing: border-box;
  width: 100%;
  margin: 0 0 8px;
  padding: 6px 8px 6px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-elevated);
  color: var(--text);
  font-size: 0.82rem;
}

.revision-target[hidden] {
  display: none;
}

.revision-target-label {
  flex: 0 0 auto;
  color: var(--muted);
}

.revision-target-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.revision-target-action,
.revision-target-remove {
  flex: 0 0 auto;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
}

.revision-target-remove {
  width: 28px;
  padding: 0;
  font-size: 1rem;
  line-height: 1;
}

.revision-target-action:focus-visible,
.revision-target-remove:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.message-revision-target {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.78rem;
}

.message-attachment-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
}

.spreadsheet-edit-report {
  margin-top: 10px;
  font-size: 0.84rem;
}

.spreadsheet-edit-report ul {
  margin: 0 0 6px;
  padding-left: 18px;
}

.spreadsheet-edit-report p {
  margin: 4px 0;
  color: var(--muted);
}

.spreadsheet-edit-report details {
  margin-top: 6px;
  color: var(--muted);
}

.spreadsheet-edit-report summary {
  cursor: pointer;
}

/* Modifica PDF: immagini da inserire e resoconto della revisione. */
.pdf-edit-asset-list {
  display: grid;
  gap: 8px;
}

.pdf-edit-asset-list:empty {
  display: none;
}

.pdf-edit-report .pdf-edit-warning {
  color: var(--danger);
}

.spreadsheet-edit-checks {
  margin: 8px 0 0;
  padding-left: 18px;
  font-size: 0.82rem;
}

.spreadsheet-edit-compare {
  margin-top: 10px;
}

.cowork-file-item {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.cowork-file-item > .cowork-file,
.cowork-file-item > .cowork-inline-artifact {
  flex: 1 1 auto;
  min-width: 0;
}

/* Selettore del modello: ricerca, preferiti, dettagli, Cowork, mobile. */
.model-menu { width: 340px; }
.model-menu .model-search { position: relative; margin: 0 2px 6px; }
.model-menu .model-search svg { position: absolute; top: 50%; left: 9px; width: 14px; height: 14px; transform: translateY(-50%); fill: none; stroke: var(--muted); stroke-linecap: round; stroke-width: 1.8; pointer-events: none; }
.model-menu .model-search input { width: 100%; height: 32px; padding: 0 10px 0 29px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text); font: inherit; font-size: 12px; }
.model-menu .model-search input:focus-visible { outline: 2px solid color-mix(in srgb, var(--primary) 55%, transparent); outline-offset: 0; }
.model-menu .model-tabs .model-tab.is-muted { opacity: .5; }
.model-menu .model-tabs .model-tab[hidden] { display: none; }
.model-menu .model-option-row { display: flex; align-items: stretch; gap: 2px; }
.model-menu .model-option-row[hidden] { display: none; }
.model-menu .model-option-row > .scope-option { flex: 1 1 auto; min-width: 0; align-items: flex-start; }
.model-menu .model-option-row > .scope-option > svg { margin-top: 1px; }
.model-menu .model-option-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.model-menu .model-option-name { overflow-wrap: anywhere; }
.model-menu .model-option-description { color: var(--muted); font-size: 10.5px; line-height: 1.35; }
.model-menu .model-option-meta { color: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.model-menu .model-option-caps { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 2px; }
.model-menu .model-cap { padding: 1px 6px; border: 1px solid var(--border); border-radius: 999px; color: var(--muted); font-size: 9.5px; line-height: 1.5; white-space: nowrap; }
.model-menu .model-cap.is-orchestrated { border-style: dashed; }
.model-menu .model-option-cowork { color: var(--danger); font-size: 10px; }
.model-menu .model-option-cowork[hidden] { display: none; }
.model-menu .scope-option.is-unavailable { opacity: .55; cursor: not-allowed; }
.model-menu .scope-option:focus-visible { outline: 2px solid color-mix(in srgb, var(--primary) 55%, transparent); outline-offset: -2px; }
.model-menu button.model-favorite { flex: 0 0 auto; width: 30px; padding: 0; display: grid; place-items: center; color: var(--muted); }
.model-menu .model-favorite svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; }
.model-menu .model-favorite.is-on { color: #e7a817; }
.model-menu .model-favorite.is-on svg { fill: currentColor; }
.model-menu .model-favorite:focus-visible { outline: 2px solid color-mix(in srgb, var(--primary) 55%, transparent); outline-offset: -2px; }
.model-menu .model-empty { margin: 8px 6px; }
.model-menu .model-empty[hidden] { display: none; }
.model-menu.is-sheet { z-index: 60; width: auto; border-radius: 16px; }
@media (max-width: 760px) {
  .model-menu .model-search input { height: 38px; font-size: 16px; }
  .model-menu button.model-favorite { width: 40px; }
}

/* Combina modelli (v173): menu nel composer e risposta unita in chat. */
.moa-menu { width: min(340px, calc(100vw - 32px)); max-height: min(64vh, 480px); overflow-y: auto; overscroll-behavior: contain; }
.moa-selector.is-active { background: color-mix(in srgb, var(--primary) 14%, transparent); color: var(--text); }
.moa-selector.is-active svg:first-child { color: var(--primary); }
.moa-menu .moa-switch { display: flex; align-items: center; gap: 9px; margin: 4px 6px 10px; cursor: pointer; font-size: 12px; font-weight: 650; }
.moa-menu .moa-switch input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.moa-menu .moa-switch-track { position: relative; width: 32px; height: 18px; flex: 0 0 auto; border-radius: 999px; background: var(--border-strong, var(--border)); transition: background 160ms ease; }
.moa-menu .moa-switch-track i { position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform 160ms ease; }
.moa-menu .moa-switch input:checked + .moa-switch-track { background: var(--primary); }
.moa-menu .moa-switch input:checked + .moa-switch-track i { transform: translateX(14px); }
.moa-menu .moa-switch input:focus-visible + .moa-switch-track { outline: 2px solid color-mix(in srgb, var(--primary) 55%, transparent); outline-offset: 2px; }
.moa-menu .moa-options { display: grid; gap: 2px; margin: 0 2px 6px; }
.moa-menu .moa-option { display: flex; align-items: center; gap: 9px; padding: 7px 9px; border-radius: 8px; cursor: pointer; font-size: 12px; }
.moa-menu .moa-option:hover { background: var(--surface-soft); }
.moa-menu .moa-option input { width: 15px; height: 15px; margin: 0; accent-color: var(--primary); }
.moa-menu .moa-option span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.moa-menu .moa-option small { color: var(--muted); font-size: 10px; white-space: nowrap; }
.moa-menu .moa-option:has(input:disabled) { opacity: .5; cursor: not-allowed; }
.moa-menu .moa-synthesizer { width: calc(100% - 12px); margin: 0 6px 6px; padding: 7px 9px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-soft); color: var(--text); font: inherit; font-size: 12px; }
.moa-menu .moa-hint { display: block; min-height: 14px; margin: 0 6px 6px; color: var(--muted); font-size: 11px; }
.moa-menu .moa-hint:empty { display: none; }
.moa-menu .moa-compare-link { display: block; margin: 4px 6px 2px; color: var(--primary); font-size: 11px; font-weight: 650; text-decoration: none; }
.moa-menu .moa-compare-link:hover { text-decoration: underline; }

.message-moa { width: fit-content; max-width: min(100%, 760px); margin-top: 8px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-soft); font-size: 12px; }
.message-moa summary { padding: 6px 11px; color: var(--muted); cursor: pointer; font-weight: 650; list-style: none; }
.message-moa summary::-webkit-details-marker { display: none; }
.message-moa summary::before { content: '⫿'; margin-right: 7px; color: var(--primary); }
.message-moa[open] summary { border-bottom: 1px solid var(--border); color: var(--text); }
.message-moa-draft { padding: 10px 12px; border-top: 1px solid var(--border); }
.message-moa-draft:first-of-type { border-top: 0; }
.message-moa-draft > strong { display: block; margin-bottom: 4px; font-size: 11px; color: var(--primary); }
.message-moa-draft-body { font-size: 13px; line-height: 1.5; }
.message-moa-draft-body p:last-child { margin-bottom: 0; }

.message-moa-progress { display: grid; gap: 6px; font-size: 13px; }
.message-moa-progress > p { margin: 0 0 2px; color: var(--muted); }
.message-moa-progress-item { display: flex; align-items: center; gap: 8px; }
.message-moa-progress-item i { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: var(--border-strong, var(--border)); }
.message-moa-progress-item.is-writing i { background: var(--primary); animation: moa-pulse 1s infinite ease-in-out; }
.message-moa-progress-item.is-done i { background: var(--success, #39d98a); }
.message-moa-progress-item.is-error i { background: var(--danger); }
.message-moa-progress-item small { color: var(--muted); font-size: 11px; }
@keyframes moa-pulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }

/* Combina modelli in Cowork (v174): scelta dell'approccio prima del lavoro. */
.message-moa-options { display: grid; gap: 10px; font-size: 13px; }
.message-moa-options-title { margin: 0; font-weight: 650; }
.message-moa-options-reason { margin: 0; padding: 8px 12px; border-left: 3px solid var(--primary); border-radius: 0 10px 10px 0; background: color-mix(in srgb, var(--primary) 7%, transparent); color: var(--muted); }
.message-moa-option { display: grid; gap: 6px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-soft); }
.message-moa-option.is-recommended { border-color: color-mix(in srgb, var(--primary) 55%, var(--border)); background: color-mix(in srgb, var(--primary) 8%, var(--surface-soft)); }
.message-moa-option > strong { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.message-moa-option p { margin: 0; }
.message-moa-option ol { margin: 0; padding-left: 18px; color: var(--muted); font-size: 12px; }
.message-moa-option small { color: var(--muted); font-size: 11px; }
.message-moa-badge { padding: 1px 8px; border-radius: 999px; background: color-mix(in srgb, var(--primary) 18%, transparent); color: var(--primary); font-size: 10px; font-weight: 700; }
.message-moa-choose { justify-self: start; padding: 7px 12px; border: 1px solid var(--border); border-radius: 9px; background: transparent; color: var(--text); cursor: pointer; font: inherit; font-size: 12px; font-weight: 650; }
.message-moa-choose.is-primary { border-color: var(--primary); background: var(--primary); color: #fff; }
.message-moa-choose.is-cancel { color: var(--muted); }
.message-moa-choose:disabled { opacity: .55; cursor: not-allowed; }
.message-moa-chosen > strong { color: var(--text); }

/* v175: composer più pulito. Un solo "+" (allegati, foto, strumenti, Combina);
   il tasto "Combina N" compare accanto al "+" solo quando la modalità è attiva. */
.attachment-button .attachment-plus-icon { display: block; stroke-width: 2; }
.attachment-menu .attachment-menu-moa { position: relative; }
.attachment-menu .attachment-menu-moa > span { flex: 1; }
.attachment-menu .attachment-menu-state { padding: 1px 7px; border-radius: 999px; background: color-mix(in srgb, var(--primary) 16%, transparent); color: var(--primary); font-size: 10px; font-weight: 700; white-space: nowrap; }
.attachment-menu .attachment-menu-state[hidden] { display: none; }
.attachment-menu button:disabled { opacity: .5; cursor: not-allowed; }
.attachment-actions .moa-context { position: static; }
.attachment-actions .moa-selector[hidden] { display: none; }
.attachment-actions .moa-menu { left: 0; right: auto; }
/* Mobile e PWA: il tasto attivo sta nella riga delle modalità (Chat/Cowork), che ha spazio libero. */
.compact-composer .composer .moa-context { order: -2; }
.compact-composer .composer .attachment-actions .moa-menu { bottom: calc(100% + 8px); }
@media (max-width: 760px) {
  .attachment-actions .moa-menu { left: 12px; right: auto; }
}

/* v175: "Confronta i modelli" in fondo al menu del modello (si apre in una nuova scheda). */
.model-menu .model-compare-link { display: flex; align-items: center; gap: 8px; margin: 8px 2px 0; padding: 9px 9px 3px; border-top: 1px solid var(--border); color: var(--primary); font-size: 12px; font-weight: 650; text-decoration: none; }
.model-menu .model-compare-link svg { width: 16px; height: 16px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.7; }
.model-menu .model-compare-link span:first-of-type { flex: 1; }
.model-menu .model-compare-link:hover span:first-of-type { text-decoration: underline; }
.model-menu .model-compare-arrow { color: var(--muted); font-size: 12px; }

/* v176 – Whitelabel per Organizzazione.
   Colori: variabili del tema sovrascritte da <style id="dalilaBranding"> (partials/branding-head).
   Logo: stesse classi brand-dark / brand-light del logo Dalila; qui solo la base di contrasto
   quando il logo ha lo stesso tono della superficie (logo scuro nel tema scuro e viceversa). */
.brand-custom { object-fit: contain; }
.brand-plate-light,
.brand-plate-dark { box-sizing: border-box; padding: 2px; border-radius: 6px; }
.brand-plate-light { background: rgba(255, 255, 255, .94); }
.brand-plate-dark { background: #10213f; }
.brand-image-full.brand-plate-light,
.brand-image-full.brand-plate-dark { padding: 4px 8px; border-radius: 8px; }

/* v191.11: comparsa graduale del testo in streaming (da trasparente a pieno). */
.message-assistant .message-bubble .dalila-fluid-fade {
  animation: dalila-fluid-fade 520ms ease-out both;
}

@keyframes dalila-fluid-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .message-assistant .message-bubble .dalila-fluid-fade {
    animation: none;
  }
}

/* v191.13: promemoria di una chat ripresa dopo un po' (sotto l'ultima risposta). */
.conversation-recap {
  max-width: min(680px, 100%);
  margin: 4px 0 18px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-soft);
  color: var(--text);
  animation: dalila-recap-in 360ms ease-out both;
}

.conversation-recap-label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.conversation-recap p {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
}

@keyframes dalila-recap-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

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

/* v192.7 – Blocchi YAML: vista Tabella / YAML, Copia e Scarica. */
.message-assistant .assistant-code-block.has-yaml-actions .assistant-code-block-header { justify-content: flex-start; gap: 6px; }
.message-assistant .assistant-code-block.has-yaml-actions .assistant-code-language { margin-right: auto; }
.message-assistant .assistant-code-view-toggle {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-soft) 70%, transparent);
}
.message-assistant .assistant-code-view-toggle button {
  border: 0;
  border-radius: 6px;
  padding: 3px 10px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  cursor: pointer;
}
.message-assistant .assistant-code-view-toggle button[aria-pressed="true"] {
  background: var(--surface-elevated);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.18);
}
.message-assistant .assistant-code-view-toggle button:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.message-assistant .assistant-yaml-view {
  padding: 12px 14px 14px;
  background: var(--surface);
  color: var(--text);
  white-space: normal;
  font-size: 0.9rem;
  line-height: 1.45;
}
.message-assistant .assistant-yaml-view[hidden],
.message-assistant .assistant-code-block pre[hidden] { display: none; }
.message-assistant .assistant-yaml-view .assistant-table-scroll {
  border: 1px solid color-mix(in srgb, var(--border) 88%, transparent);
  border-radius: 10px;
  background: var(--surface-elevated);
}
.message-assistant .assistant-yaml-view .assistant-table-scroll + .assistant-table-scroll,
.message-assistant .assistant-yaml-view .assistant-table-scroll + .assistant-yaml-section { margin-top: 12px; }
.message-assistant .assistant-yaml-section { margin-top: 16px; }
.message-assistant .assistant-yaml-section:first-child { margin-top: 0; }
.message-assistant .assistant-yaml-section.depth-1,
.message-assistant .assistant-yaml-section.depth-2 {
  margin-top: 12px;
  padding-left: 12px;
  border-left: 2px solid color-mix(in srgb, var(--primary) 32%, transparent);
}
.message-assistant .assistant-yaml-title {
  margin: 0 0 8px;
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text);
}
.message-assistant .assistant-yaml-section.depth-1 > .assistant-yaml-title,
.message-assistant .assistant-yaml-section.depth-2 > .assistant-yaml-title { font-size: 0.86rem; color: var(--muted); }
.message-assistant .assistant-yaml-table { min-width: 0; table-layout: auto; }
.message-assistant .assistant-yaml-table th[scope="row"] {
  width: 34%;
  font-size: 0.84rem;
  font-weight: 600;
  text-align: left;
  color: var(--muted);
  white-space: nowrap;
}
.message-assistant .assistant-yaml-table td { white-space: normal; overflow-wrap: anywhere; color: var(--text); }
.message-assistant .assistant-yaml-table td[data-align="right"] { text-align: left; font-variant-numeric: tabular-nums; }
.message-assistant .assistant-yaml-multiline {
  margin: 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-soft) 72%, transparent);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.45;
  white-space: pre;
  overflow-x: auto;
  max-width: 100%;
}
.message-assistant .assistant-yaml-list { margin: 0; padding-left: 18px; }
.message-assistant .assistant-yaml-list li + li { margin-top: 2px; }
.message-assistant .assistant-yaml-empty { color: var(--muted); }
.message-assistant .assistant-yaml-inline-map { display: grid; grid-template-columns: max-content 1fr; gap: 2px 10px; margin: 0; }
.message-assistant .assistant-yaml-inline-map dt { color: var(--muted); font-weight: 600; }
.message-assistant .assistant-yaml-inline-map dd { margin: 0; }
@media (max-width: 620px) {
  .message-assistant .assistant-yaml-view { padding: 10px; }
  .message-assistant .assistant-yaml-table th[scope="row"] { width: auto; white-space: normal; }
}
.message-assistant .assistant-yaml-table { table-layout: fixed; }
.message-assistant .assistant-yaml-table thead th { white-space: normal; }
.message-assistant .assistant-yaml-text { white-space: pre-wrap; }
.message-assistant .assistant-yaml-text + .assistant-yaml-text,
.message-assistant .assistant-yaml-table td > .assistant-code-block + .assistant-yaml-text,
.message-assistant .assistant-yaml-table td > .assistant-yaml-text + .assistant-code-block { margin-top: 8px; }
.message-assistant .assistant-yaml-table td > .assistant-code-block { width: 100%; margin: 6px 0; }

/* v192.29 – Tabelle nelle risposte (Markdown e vista Tabella dello YAML):
 * mai piu' larghe dello spazio visibile, nessuna barra orizzontale.
 *  - Il testo va a capo dentro le celle; le parole restano intere. Solo URL e
 *    codici lunghi (24+ caratteri senza spazi, marcati da fitAssistantTable)
 *    si spezzano dove serve.
 *  - Se la tabella non entra comunque (molte colonne su telefono) diventa una
 *    lista di schede: una per riga, con l'etichetta della colonna accanto a
 *    ogni valore (classe is-stacked, decisa misurando, mai per user agent).
 * Sostituisce le larghezze minime (420px, 360px su mobile) e white-space:nowrap.
 * overflow-x:auto resta solo come rete di sicurezza. */
.assistant-table-scroll { overflow-x: auto; }
.assistant-markdown-table,
.message-assistant .assistant-yaml-table {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  table-layout: auto;
}
.assistant-markdown-table th,
.assistant-markdown-table td,
.message-assistant .assistant-yaml-table th[scope="row"] {
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
  vertical-align: top;
}
.assistant-markdown-table code { white-space: normal; }
.assistant-table-long { overflow-wrap: anywhere; word-break: break-all; }
.assistant-markdown-table.is-stacked,
.assistant-markdown-table.is-stacked tbody,
.assistant-markdown-table.is-stacked tr,
.assistant-markdown-table.is-stacked td { display: block; width: 100%; }
.assistant-markdown-table.is-stacked thead { display: none; }
.assistant-markdown-table.is-stacked tr {
  padding: 10px 13px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 76%, transparent);
}
.assistant-markdown-table.is-stacked tbody tr:last-child { border-bottom: 0; }
.assistant-markdown-table.is-stacked tbody tr:hover td { background: transparent; }
.assistant-markdown-table.is-stacked td {
  display: grid;
  grid-template-columns: minmax(0, 38%) minmax(0, 1fr);
  gap: 10px;
  padding: 4px 0;
  border-bottom: 0;
  text-align: left !important;
}
.assistant-markdown-table.is-stacked td::before {
  content: attr(data-label);
  font-size: .8rem;
  font-weight: 600;
  color: var(--muted);
  overflow-wrap: break-word;
}
.assistant-markdown-table.is-stacked td:first-child { display: block; padding-bottom: 6px; font-weight: 700; }
.assistant-markdown-table.is-stacked td:first-child::before { content: none; }
@media (max-width: 620px) {
  .assistant-markdown-table,
  .message-assistant .assistant-yaml-table { min-width: 0; }
  .assistant-markdown-table th,
  .assistant-markdown-table td { padding: 8px 9px; }
  .assistant-markdown-table.is-stacked tr { padding: 9px 11px; }
  .assistant-markdown-table.is-stacked td { padding: 3px 0; }
}

/* ==========================================================================
   v192.32 – Blocchi di solo testo (TEXT, plaintext, markdown): righe a capo,
   nessuno scorrimento orizzontale, sfondo chiaro. Il testo copiato e' identico.
   I blocchi di codice veri restano invariati.
   ========================================================================== */
.message-assistant .assistant-code-block.is-prose {
  background: var(--surface-soft);
}
.message-assistant .assistant-code-block.is-prose pre {
  overflow-x: visible;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: normal;
}
.message-assistant .assistant-code-block.is-prose code {
  min-width: 0;
  white-space: inherit;
}

/* v192.33 – Scelta del PDF da modificare (piu' PDF allegati). */
.pdf-edit-chooser { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 4px; max-width: 100%; }
.pdf-edit-chooser-item {
  display: block; width: 100%; min-height: 40px; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-soft); color: var(--text);
  font: inherit; text-align: left; cursor: pointer;
  overflow-wrap: anywhere;
}
.pdf-edit-chooser-item:hover:not(:disabled), .pdf-edit-chooser-item:focus-visible { border-color: var(--primary); outline: 0; }
.pdf-edit-chooser-item:disabled { cursor: progress; opacity: .7; }
.pdf-edit-chooser-item.is-done { opacity: .6; }
.pdf-edit-chooser-item.is-done::before { content: "\2713  "; color: var(--success, var(--primary)); }
.pdf-edit-chooser-status:empty { display: none; }

/* v192.40: modifica di piu' foto nel popup "Modifica immagine". */
.image-edit-dialog .generated-image[hidden],
.image-edit-batch-section[hidden],
.image-edit-batch-mode[hidden] {
  display: none;
}

.image-edit-batch-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.image-edit-batch-grid:empty {
  display: none;
}

.image-edit-batch-item {
  position: relative;
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-elevated);
  color: var(--text);
}

.image-edit-batch-item img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 7px;
  object-fit: cover;
  background: var(--surface);
}

.image-edit-batch-item span {
  overflow: hidden;
  padding: 0 2px 2px;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
  font-weight: 700;
}

.image-edit-batch-remove {
  position: absolute;
  top: 9px;
  right: 9px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-elevated) 88%, transparent);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}

.image-edit-batch-remove:hover:not(:disabled),
.image-edit-batch-remove:focus-visible {
  border-color: var(--primary);
  outline: 0;
}

.image-edit-batch-remove:disabled {
  cursor: progress;
  opacity: .55;
}

.image-edit-batch-mode {
  display: grid;
  gap: 8px;
}

.image-edit-batch-result-label {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

@media (max-width: 640px) {
  .image-edit-batch-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* v192.47-48: versione, link a Privacy e Termini, titolare sotto. */
.sidebar-meta-text {
  display: grid;
  min-width: 0;
  gap: 0;
  line-height: 1.25;
}

.sidebar-meta-version {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.sidebar-meta-owner {
  color: var(--muted);
  font-size: 7.5px;
  letter-spacing: .01em;
  opacity: .8;
}

.sidebar-meta-legal {
  display: inline-grid;
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  opacity: .75;
  transition: color .15s ease, background-color .15s ease, opacity .15s ease;
}

.sidebar-meta-legal svg {
  display: block;
  width: 8px !important;
  height: 8px !important;
  min-width: 0;
  flex: none;
}

.sidebar-meta-legal:hover,
.sidebar-meta-legal:focus-visible {
  background: color-mix(in srgb, var(--muted) 14%, transparent);
  color: var(--text);
  opacity: 1;
}

.sidebar-meta-legal:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.legal-dialog {
  width: min(420px, 92vw);
}

/* v192.50: su telefono e PWA il popup legale e' una scheda centrata, non il
   foglio dal basso degli altri popup: la regola mobile di .account-dialog
   (margin: auto 0 0; width: 100vw) combinata con una larghezza ridotta lo
   lasciava schiacciato a sinistra e tagliato dalle aree sicure. */
@media (max-width: 760px) {
  .account-dialog.legal-dialog {
    box-sizing: border-box;
    width: calc(100vw - 32px - env(safe-area-inset-left) - env(safe-area-inset-right));
    max-width: 420px;
    max-height: calc(var(--dalila-viewport-height, 100dvh) - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    margin: auto;
    padding: 22px 18px 18px;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 20px;
  }

  .account-dialog.legal-dialog h2 {
    margin-right: 48px;
    font-size: 18px;
  }
}

.legal-dialog p {
  color: var(--muted);
}

.legal-dialog-links {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.legal-dialog-links a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-soft, transparent);
  color: var(--text);
  font-weight: 650;
  text-decoration: none;
  transition: border-color .15s ease, background-color .15s ease;
}

.legal-dialog-links a:hover,
.legal-dialog-links a:focus-visible {
  border-color: color-mix(in srgb, var(--primary) 55%, var(--border));
  background: color-mix(in srgb, var(--primary) 8%, var(--surface-soft, transparent));
}

.legal-dialog-links a svg {
  flex: 0 0 auto;
  color: var(--muted);
}

/* v192.54: forma del pulsante Invia scelta nel Whitelabel (data-brand-send-shape su <html>).
   Il colore resta quello primario del tema/branding; senza attributo vale la forma di Dalila. */
html[data-brand-send-shape] .send-button { border-radius: 11px; clip-path: none; }
html[data-brand-send-shape="circle"] .send-button { border-radius: 50%; }
html[data-brand-send-shape="rounded"] .send-button { border-radius: 11px; }
html[data-brand-send-shape="square"] .send-button { border-radius: 3px; }
html[data-brand-send-shape="pill"] .send-button { width: 52px; border-radius: 999px; }
html[data-brand-send-shape="leaf"] .send-button { border-radius: 4px 50% 4px 50%; }
html[data-brand-send-shape="triangle"] .send-button,
html[data-brand-send-shape="diamond"] .send-button,
html[data-brand-send-shape="hexagon"] .send-button,
html[data-brand-send-shape="octagon"] .send-button { border-radius: 0; box-shadow: none; }
html[data-brand-send-shape="triangle"] .send-button { width: 42px; height: 38px; padding-top: 10px; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
html[data-brand-send-shape="triangle"] .send-button svg { width: 15px; height: 15px; }
html[data-brand-send-shape="diamond"] .send-button { width: 40px; height: 40px; clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
html[data-brand-send-shape="hexagon"] .send-button { width: 38px; clip-path: polygon(25% 3%, 75% 3%, 100% 50%, 75% 97%, 25% 97%, 0 50%); }
html[data-brand-send-shape="octagon"] .send-button { clip-path: polygon(30% 0, 70% 0, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0 70%, 0 30%); }
/* Il focus resta visibile anche con le forme ritagliate. */
html[data-brand-send-shape="triangle"] .send-button:focus-visible,
html[data-brand-send-shape="diamond"] .send-button:focus-visible,
html[data-brand-send-shape="hexagon"] .send-button:focus-visible,
html[data-brand-send-shape="octagon"] .send-button:focus-visible { clip-path: none; border-radius: 8px; }

/* v192.54.4: Privacy e Termini nel riquadro di accesso. */
.auth-dialog-legal a { color: var(--primary); font-weight: 600; text-decoration: none; }
.auth-dialog-legal a:hover { text-decoration: underline; }

/* Webchat: segnalazione discreta "Sei uno sviluppatore?" verso Sviluppatori → Integrazioni e guide. */
.developer-hint {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  max-width: 100%;
  margin: 12px auto 0;
  padding: 2px 2px 2px 10px;
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-elevated) 70%, transparent);
}

.developer-hint[hidden] {
  display: none;
}

.developer-hint a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  text-decoration: none;
}

.developer-hint a span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.developer-hint a:hover,
.developer-hint a:focus-visible {
  color: var(--primary);
}

.developer-hint a u {
  color: var(--primary);
  font-weight: 650;
  text-decoration: none;
}

.developer-hint svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.developer-hint button {
  display: grid;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.developer-hint button:hover,
.developer-hint button:focus-visible {
  background: var(--surface-hover);
  color: var(--text);
}

.developer-hint button svg {
  width: 12px;
  height: 12px;
}

.conversation.has-messages .developer-hint,
.conversation.is-project-chat .developer-hint {
  display: none;
}

@media (max-width: 760px) {
  .developer-hint {
    margin-top: 8px;
  }

  .developer-hint {
    border-radius: 14px;
  }

  .developer-hint a {
    font-size: 10.5px;
    text-align: left;
  }

  .developer-hint a span {
    white-space: normal;
  }

  .demo-intro.is-returning .developer-hint {
    margin-top: 2px;
  }
}
