.qa-utility-button,
.qa-account-button,
.qa-sync-button {
  appearance: none;
  border: 1px solid rgba(37,115,179,.2);
  background: #fff;
  color: #174f7d;
  min-width: 44px;
  height: 44px;
  border-radius: 999px;
  box-shadow: 0 8px 22px rgba(20,55,80,.16);
  font: 700 14px/1 system-ui, sans-serif;
  cursor: pointer;
}

/* Il menu storico viene rimosso da tutte le navbar. */
#menuBtn,
#dropdownMenu,
#menuDropdown,
.menu-btn,
.menu-dropdown {
  display: none !important;
}

.qa-utility-button {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 10020;
  padding: 0 13px;
  font-size: 18px;
}

.qa-account-dock {
  position: fixed;
  right: 18px;
  top: 18px;
  z-index: 10020;
  display: flex;
  align-items: center;
  gap: 8px;
}

.qa-account-button,
.qa-sync-button { padding: 0 14px; display: inline-flex; align-items: center; gap: 8px; }
.qa-account-button { max-width: 190px; }
.qa-google-account-button {
  width: auto;
  max-width: none;
  border: 0;
  background: #f2f2f2;
  color: #1f1f1f;
  font: 500 14px/20px Roboto, Arial, sans-serif;
}
.qa-user-account-button { background: #f2f2f2; color: #1f1f1f; border-color: transparent; }
.qa-avatar-slot {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  overflow: hidden;
  border-radius: 50%;
  background: #fff;
  color: #174f7d;
  font-weight: 800;
}
.qa-user-avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; }
.qa-account-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qa-sync-button[disabled] { opacity: .62; cursor: wait; }

.qa-login-hint {
  position: absolute;
  top: 54px;
  right: 0;
  width: max-content;
  max-width: min(270px, calc(100vw - 24px));
  padding: 10px 34px 10px 13px;
  border: 1px solid #d8d8d8;
  border-radius: 12px;
  background: #fff;
  color: #333;
  box-shadow: 0 9px 24px rgba(0,0,0,.15);
  font: 600 13px/1.35 system-ui, sans-serif;
}
.qa-login-hint::before {
  content: "";
  position: absolute;
  right: 24px;
  top: -7px;
  width: 12px;
  height: 12px;
  border: 1px solid #d8d8d8;
  border-right: 0;
  border-bottom: 0;
  background: #fff;
  transform: rotate(45deg);
}
.qa-login-hint-close {
  position: absolute;
  top: 5px;
  right: 7px;
  width: 25px;
  height: 25px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #555;
  font: 700 18px/1 system-ui, sans-serif;
  cursor: pointer;
}

.qa-sync-toast {
  position: fixed;
  right: 18px;
  top: 76px;
  z-index: 10030;
  max-width: min(360px, calc(100vw - 36px));
  padding: 12px 16px;
  border-radius: 12px;
  background: #173d5a;
  color: #fff;
  box-shadow: 0 12px 30px rgba(0,0,0,.22);
  font: 600 14px/1.4 system-ui, sans-serif;
}

.qa-sync-dialog {
  border: 0;
  border-radius: 18px;
  padding: 0;
  width: min(500px, calc(100vw - 28px));
  box-shadow: 0 22px 70px rgba(0,0,0,.30);
}
.qa-sync-dialog::backdrop { background: rgba(8,22,34,.58); backdrop-filter: blur(3px); }
.qa-sync-dialog-inner { padding: 24px; background: #fff; color: #243442; font-family: system-ui, sans-serif; }
.qa-sync-dialog h2 { margin: 0 0 10px; color: #174f7d; }
.qa-sync-dialog p { margin: 0 0 20px; line-height: 1.55; }
.qa-sync-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.qa-sync-actions button { min-height: 42px; padding: 0 16px; border-radius: 999px; cursor: pointer; font-weight: 700; }
.qa-sync-primary { border: 0; background: #2573b3; color: #fff; }
.qa-sync-secondary { border: 1px solid #cbd8e1; background: #fff; color: #174f7d; }

.qa-auth-panel { max-width: 620px; margin: 36px auto; padding: clamp(24px, 5vw, 44px); text-align: center; }
.qa-auth-panel .qa-auth-icon { width: 64px; height: 64px; margin: 0 auto 18px; border-radius: 18px; display: grid; place-items: center; background: #edf5fb; color: #174f7d; font-size: 30px; }
.qa-auth-panel h1 { margin: 0 0 12px; }
.qa-auth-panel p { line-height: 1.65; }
.qa-auth-panel #qa-google-button { display: flex; justify-content: center; min-height: 44px; margin: 24px 0 14px; }
.qa-auth-status { margin-top: 18px; padding: 14px; border-radius: 12px; background: #edf5fb; color: #174f7d; }

.qa-google-login-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 40px;
  padding: 9px 12px;
  border: 0;
  border-radius: 20px;
  background: #f2f2f2;
  color: #1f1f1f;
  font: 500 14px/20px Roboto, Arial, sans-serif;
  cursor: pointer;
}
.qa-google-mark {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  border-radius: 2px;
  background: #fff;
}
.qa-google-mark svg { display: block; width: 18px; height: 18px; }
.qa-auth-icon .qa-google-mark { width: 34px; height: 34px; }
.qa-auth-icon .qa-google-mark svg { width: 30px; height: 30px; }
.qa-google-login-button:disabled { opacity: .65; cursor: wait; }

.qa-back-to-top {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: calc(76px + env(safe-area-inset-bottom));
  z-index: 10015;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(37,115,179,.24);
  border-radius: 14px;
  background: rgba(255,255,255,.94);
  color: #174f7d;
  box-shadow: 0 7px 20px rgba(20,55,80,.16);
  font: 750 22px/1 system-ui, sans-serif;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity .2s ease, transform .2s ease, visibility .2s ease;
}
.qa-back-to-top.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }
.qa-back-to-top:hover { background: #edf5fb; }

html[data-theme="dark"] .qa-utility-button,
html[data-theme="dark"] .qa-sync-button,
html[data-theme="dark"] .qa-sync-dialog-inner { background: #19232d; color: #edf4f8; border-color: #34434f; }
html[data-theme="dark"] .qa-user-account-button { background: #f2f2f2; color: #1f1f1f; border-color: transparent; }
html[data-theme="dark"] .qa-back-to-top { background: rgba(36,49,60,.96); color: #dcecf7; border-color: #4a5d6c; }
html[data-theme="dark"] .qa-back-to-top:hover { background: #30414f; }
html[data-theme="dark"] .qa-sync-dialog h2 { color: #8bc8f3; }
html[data-theme="dark"] .qa-auth-status { background: #202d38; color: #cce9ff; }
html[data-theme="dark"] .qa-google-login-button,
html[data-theme="dark"] .qa-google-account-button { background: #f2f2f2; color: #1f1f1f; border-color: transparent; }
html[data-theme="dark"] .qa-login-hint { background: #fff; color: #333; border-color: #d8d8d8; }
html[data-theme="dark"] .qa-login-hint::before { background: #fff; border-color: #d8d8d8; }

@media (max-width: 760px) {
  .qa-account-dock { top: calc(12px + env(safe-area-inset-top)); right: max(10px, env(safe-area-inset-right)); }
  .qa-account-label { display: none; }
  .qa-account-button, .qa-sync-button { width: 42px; height: 42px; padding: 0; justify-content: center; }
  .qa-google-account-button { width: auto; min-width: 42px; padding: 0 13px; background: #f2f2f2; border: 0; }
  .qa-google-account-button .qa-account-label { display: block; }
  .qa-utility-button { right: max(12px, env(safe-area-inset-right)); bottom: calc(14px + env(safe-area-inset-bottom)); }
  .qa-back-to-top {
    right: max(12px, env(safe-area-inset-right));
    bottom: calc(68px + env(safe-area-inset-bottom));
    width: 44px;
    height: 44px;
    font-size: 21px;
  }
  .qa-login-hint { top: 50px; font-size: 12px; }
}

@media (max-width: 390px) {
  .qa-google-account-button { max-width: calc(100vw - 20px); font-size: 13px; }
  .qa-back-to-top { width: 42px; height: 42px; }
}
