/* Segretario AI — widget flottante */
.wa-root {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1055;
  font-family: inherit;
}
.wa-toggle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 0;
  background: #1e88e5;
  color: #fff;
  box-shadow: 0 8px 24px rgba(30, 136, 229, 0.35);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  transition: transform .15s ease, box-shadow .15s ease;
}
.wa-toggle-emoji { font-size: 26px; line-height: 1; }
.wa-toggle-photo {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.wa-avatar { font-size: 20px; margin-right: 2px; }
.wa-avatar-img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,.55);
}
.wa-tagline { display:block; font-size:11px; opacity:.9; font-weight:400; }
.wa-pending {
  margin: 8px 0 12px;
  padding: 10px;
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: 10px;
}
.wa-pending-actions { display:flex; gap:8px; margin-top:8px; }
.wa-pending.is-done { opacity:.75; }
.wa-toggle:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(30, 136, 229, 0.45);
}
.wa-root.is-open .wa-toggle {
  display: none;
}
.wa-panel {
  width: min(380px, calc(100vw - 28px));
  height: min(520px, calc(100vh - 100px));
  background: #fff;
  border: 1px solid #e3e8ef;
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(20, 40, 70, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.wa-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  background: #1e88e5;
  color: #fff;
}
.wa-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
}
.wa-header-actions {
  display: flex;
  gap: 4px;
}
/* Roster dashboard */
.wa-roster-card { border: 1px solid #e3e8ef; }
.wa-roster-grid {
  display: grid;
  gap: 10px;
}
.wa-roster-grid--compact {
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
}
.wa-roster-grid--detail {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.wa-roster-item {
  border-radius: 10px;
  padding: 0;
  min-height: 100%;
  overflow: hidden;
  display: flex;
  align-items: stretch;
}
.wa-roster-item--compact {
  flex-direction: column;
  align-items: center;
  text-align: center;
  border-top: 4px solid #1e88e5;
  border-left: 0;
  padding: 14px 10px 12px;
  gap: 8px;
}
.wa-roster-item--detail {
  border-left: 4px solid #1e88e5;
}
.wa-roster-item.has-body { min-height: 0; }
.wa-roster-item.is-standby { opacity: .78; }
.wa-roster-face-wrap {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  overflow: hidden;
  flex: 0 0 72px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, .12);
  background: rgba(255,255,255,.55);
  display: flex;
  align-items: center;
  justify-content: center;
}
.wa-roster-face {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center top;
  display: block;
}
.wa-roster-face--emoji {
  font-size: 32px;
  line-height: 1;
  width: auto;
  height: auto;
}
.wa-roster-compact-copy { min-width: 0; width: 100%; }
.wa-roster-name {
  font-size: 13px;
  font-weight: 700;
  color: #243447;
  line-height: 1.2;
}
.wa-roster-body-wrap {
  flex: 0 0 148px;
  width: 148px;
  align-self: stretch;
  min-height: 260px;
  background-color: #dfe6ee;
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  overflow: hidden;
  padding: 0;
  border: 0;
}
.wa-roster-emoji-wrap {
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, rgba(255,255,255,.72), rgba(0,0,0,.04));
}
.wa-roster-body-link {
  cursor: zoom-in;
  border-radius: 0;
  padding: 0;
}
.wa-roster-body-link:focus {
  outline: 2px solid rgba(30,136,229,.45);
  outline-offset: -2px;
}
.wa-roster-body {
  display: none;
}
.wa-roster-copy { flex: 1; padding: 10px 12px; min-width: 0; }
.wa-roster-head {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-bottom: 4px;
}
.wa-roster-emoji { font-size: 28px; line-height: 1.2; }
.wa-roster-role { font-size: 11px; color: #667; margin-top: 2px; }
.wa-roster-list {
  margin: 4px 0 0;
  padding-left: 16px;
  font-size: 11px;
  color: #334;
}
.wa-roster-att-label {
  margin-top: 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: #789;
}
.wa-roster-att { color: #456; }
.wa-code {
  display: block;
  margin: 8px 0 4px;
  padding: 8px;
  background: #263238;
  color: #eceff1;
  border-radius: 8px;
  font-size: 11px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 220px;
  overflow: auto;
}
.wa-copy-btn {
  margin: 0 0 8px;
  font-size: 11px !important;
  padding: 2px 8px !important;
}
.wa-icon-btn {
  background: transparent;
  border: 0;
  color: #fff;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
}
.wa-icon-btn:hover {
  background: rgba(255,255,255,.18);
  color: #fff;
  text-decoration: none;
}
.wa-chat {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  background: #f7f9fc;
}
.wa-msg-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-bottom: 10px;
}
.wa-msg-row.user { flex-direction: row-reverse; }
.wa-msg-row.system { display: block; }
.wa-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 auto;
  border: 1px solid #d7dee8;
  background: #fff;
}
.wa-msg {
  max-width: 82%;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}
.wa-msg.user {
  background: #1e88e5;
  color: #fff;
}
.wa-msg.assistant {
  background: #fff;
  border: 1px solid #e6ebf2;
  color: #222;
}
.wa-msg.assistant a {
  color: #1565c0;
  text-decoration: underline;
  font-weight: 600;
}
.wa-msg.assistant a:hover { color: #0d47a1; }
.wa-msg.system {
  background: transparent;
  color: #789;
  padding: 0;
  font-size: 12px;
}
.wa-tools {
  font-size: 11px;
  color: #8a97a8;
  margin-top: 4px;
}
.wa-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid #e8edf3;
  background: #fff;
}
.wa-form textarea {
  width: 100%;
  border: 1px solid #d7dee8;
  border-radius: 8px;
  padding: 8px;
  font-size: 13px;
  resize: none;
}
.wa-status {
  min-height: 16px;
  padding: 0 10px 8px;
  font-size: 11px;
  color: #8a97a8;
}
.wa-root.is-busy .wa-form {
  opacity: .65;
  pointer-events: none;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}
@media (max-width: 576px) {
  .wa-root { right: 10px; bottom: 10px; }
  .wa-panel { width: calc(100vw - 20px); height: min(70vh, 560px); }
}
/* E0 — notice strip (fuori dallo storico messaggi) */
.wa-notices {
  max-height: 140px;
  overflow-y: auto;
  padding: 6px 8px;
  border-bottom: 1px solid #e8eef3;
  background: #f7fafc;
}
.wa-notice {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 12px;
  line-height: 1.35;
  padding: 6px 8px;
  margin-bottom: 4px;
  border-radius: 6px;
  border-left: 3px solid #90a4ae;
  background: #fff;
}
.wa-notice.is-urgent { border-left-color: #e53935; background: #fdecea; }
.wa-notice.is-approve { border-left-color: #1e88e5; background: #e3f2fd; }
.wa-notice.is-info { border-left-color: #78909c; }
.wa-notice-meta { font-weight: 600; color: #37474f; }
.wa-notice-actions { margin-left: auto; flex-shrink: 0; }
.wa-notice-actions button {
  border: 0;
  background: transparent;
  color: #607d8b;
  font-size: 11px;
  cursor: pointer;
  padding: 0 2px;
}
.wa-toggle.has-urgent::after {
  content: '';
  position: absolute;
  top: 4px;
  right: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #e53935;
  box-shadow: 0 0 0 2px #fff;
}
.wa-toggle { position: relative; }

/* Roster lightbox */
.wa-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, .78);
  cursor: zoom-out;
}
.wa-lightbox.is-open { display: flex; }
.wa-lightbox img {
  max-width: min(94vw, 720px);
  max-height: 92vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 18px 50px rgba(0,0,0,.45);
  background: #0f172a;
  cursor: default;
}
.wa-lightbox-close {
  position: absolute;
  top: 14px;
  right: 18px;
  border: 0;
  background: rgba(255,255,255,.92);
  color: #234;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
