/* Visita guidata: pulsante «?», sfondo scurito col buco sull'elemento spiegato, fumetto. */

.guida-visita-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid var(--brand-blue, #0059a6);
  background: var(--brand-blue, #0059a6);
  color: #fff;
  font: 800 1.05rem/1 "Segoe UI", Arial, sans-serif;
  cursor: pointer;
  flex: 0 0 auto;
  box-shadow: 0 2px 8px rgba(0, 89, 166, 0.28);
}

.guida-visita-btn:hover {
  background: var(--accent-2, #1479c9);
  border-color: var(--accent-2, #1479c9);
}

.guida-visita-btn:focus-visible,
.gv-fumetto button:focus-visible {
  outline: 3px solid var(--brand-orange, #ed6f20);
  outline-offset: 2px;
}

/* Nella barra, accanto a Scadenziario / Non conformità / Schede di sicurezza: «? Come si usa», arancione. */
.toolbar .guida-visita-come {
  width: auto;
  height: 38px;
  padding: 0 14px 0 6px;
  gap: 8px;
  border-radius: 999px;
  border-color: var(--brand-orange, #ed6f20);
  background: var(--brand-orange, #ed6f20);
  box-shadow: 0 3px 10px rgba(237, 111, 32, 0.35);
  font-size: 0.92rem;
  font-weight: 700;
  white-space: nowrap;
}

.toolbar .guida-visita-come:hover {
  background: #d85f14;
  border-color: #d85f14;
}

.toolbar .guida-visita-come .guida-mark {
  width: 26px;
  height: 26px;
  font-size: 1rem;
  background: #fff;
  color: var(--brand-orange, #ed6f20);
}

/* Finestra aperta dalla visita per spiegarne i campi: al centro, sotto lo strato della visita. */
dialog.gv-dialogo[open] {
  position: fixed;
  inset: 0;
  margin: auto;
  z-index: 5400;
  overflow: auto;
}

/* Pagine di accesso: «?» e «Serve aiuto…» sulla stessa riga. */
.login-guida-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 16px auto 0;
}

.login-guida-row .login-guida-link {
  margin: 0;
}

.login-guida-row .guida-visita-btn {
  width: auto;
  height: auto;
  padding: 0;
  gap: 6px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: inherit;
  font: inherit;
  font-size: 0.86rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.login-guida-row .guida-visita-btn .guida-mark {
  background: var(--brand-orange, #ed6f20);
  color: #fff;
  text-decoration: none;
}

/* ── Strato della visita ── */
.gv-strato {
  position: fixed;
  inset: 0;
  z-index: 5500;
  cursor: default;
}

.gv-strato[hidden] {
  display: none;
}

.gv-strato.gv-centro {
  background: rgba(11, 25, 44, 0.58);
}

.gv-buco {
  position: fixed;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  border-radius: 10px;
  box-shadow: 0 0 0 4px rgba(237, 111, 32, 0.95), 0 0 0 200vmax rgba(11, 25, 44, 0.58);
  pointer-events: none;
  transition: left 0.18s ease, top 0.18s ease, width 0.18s ease, height 0.18s ease;
}

.gv-buco[hidden] {
  display: none;
}

.gv-fumetto {
  position: fixed;
  left: 12px;
  top: 12px;
  width: 380px;
  max-width: calc(100vw - 24px);
  padding: 14px 16px 12px;
  background: #fff;
  color: var(--text, #1e2b36);
  text-align: left;
  border-radius: 12px;
  border: 1px solid var(--line, #d4deea);
  box-shadow: 0 18px 48px rgba(11, 25, 44, 0.35);
  font-family: "Segoe UI", "Trebuchet MS", "Helvetica Neue", Arial, sans-serif;
  font-size: 0.92rem;
  line-height: 1.45;
}

.gv-fumetto:focus {
  outline: none;
}

/* «hidden» deve vincere sullo stile dei pulsanti (.btn è inline-block). */
.gv-fumetto [hidden] {
  display: none !important;
}

.gv-freccia {
  position: absolute;
  width: 14px;
  height: 14px;
  background: #fff;
  border: 1px solid var(--line, #d4deea);
  transform: rotate(45deg);
  display: none;
}

.gv-fumetto.gv-sotto .gv-freccia {
  display: block;
  top: -8px;
  border-right: 0;
  border-bottom: 0;
}

.gv-fumetto.gv-sopra .gv-freccia {
  display: block;
  bottom: -8px;
  border-left: 0;
  border-top: 0;
}

.gv-testa {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}

.gv-conta {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted, #5d6f80);
  letter-spacing: 0.02em;
}

.gv-x {
  border: 0;
  background: transparent;
  color: var(--muted, #5d6f80);
  font: 700 1rem/1 Arial, sans-serif;
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
}

.gv-x:hover {
  background: #eef2f7;
  color: var(--text, #1e2b36);
}

.gv-titolo {
  margin: 0 0 6px;
  font-size: 1.04rem;
  font-weight: 700;
  color: var(--brand-navy, #0b2a4a);
  text-shadow: none;
}

/* Su schermi bassi scorre solo il testo: il fumetto resta dentro la finestra con i pulsanti in vista. */
.gv-testo {
  max-height: calc(100vh - 190px);
  overflow-y: auto;
}

.gv-testo p {
  margin: 0 0 6px;
}

.gv-testo p:last-child {
  margin-bottom: 0;
}

.gv-piede {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line, #d4deea);
}

.gv-piede .gv-tasti {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.gv-fumetto .btn {
  padding: 7px 12px;
  font-size: 0.86rem;
}

.gv-completa {
  border: 0;
  background: transparent;
  padding: 4px 0;
  color: var(--brand-blue, #0059a6);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.gv-aiuto-tasti {
  margin: 8px 0 0;
  font-size: 0.78rem;
  color: var(--muted, #5d6f80);
}

@media (prefers-reduced-motion: reduce) {
  .gv-buco {
    transition: none;
  }
}
