/* ==========================================================================
   Appunti — tema in stile macOS (chiaro/scuro automatico)
   ========================================================================== */

:root {
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI Variable Text', 'Segoe UI', Inter, Roboto, 'Helvetica Neue', sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --menubar-h: 28px;

  --accent: #0a7aff;
  --accent-sel: #0a64d8;
  --danger: #ff3b30;

  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #98989d;
  --border: rgba(0, 0, 0, 0.1);
  --hover: rgba(0, 0, 0, 0.055);
  --pressed: rgba(0, 0, 0, 0.1);

  --content-bg: #ffffff;
  --toolbar-bg: #ffffff;
  --titlebar-bg: #f6f6f6;
  --window-bg: #ffffff;
  --sidebar-bg: rgba(232, 232, 237, 0.78);
  --sidebar-solid: #ececf0;
  --row-alt: #f5f5f7;
  --banner-bg: rgba(10, 122, 255, 0.06);
  --field-bg: #ffffff;
  --btn-bg: #ffffff;
  --btn-border: rgba(0, 0, 0, 0.16);
  --seg-on: #ffffff;
  --menu-bg: rgba(242, 242, 245, 0.8);
  --menu-solid: #f2f2f5;
  --menu-border: rgba(0, 0, 0, 0.18);
  --menubar-bg: rgba(246, 246, 248, 0.55);
  --menubar-text: #000000;
  --menubar-bg-solid: #f6f6f8;
  --dock-bg: rgba(255, 255, 255, 0.32);
  --dock-border: rgba(255, 255, 255, 0.45);
  --dz-bg: rgba(0, 0, 0, 0.02);
  --dz-border: rgba(0, 0, 0, 0.2);
  --ql-bg: rgba(246, 246, 248, 0.92);
  --ql-body-bg: #e9e9ed;
  --tl-inactive: #d6d6db;
  --shadow-window: 0 24px 70px rgba(0, 0, 0, 0.32), 0 0 0 0.5px rgba(0, 0, 0, 0.28);
  --shadow-window-inactive: 0 12px 34px rgba(0, 0, 0, 0.18), 0 0 0 0.5px rgba(0, 0, 0, 0.2);
  --shadow-pop: 0 12px 40px rgba(0, 0, 0, 0.22), 0 0 0 0.5px var(--menu-border);
  color-scheme: light;
}

/* Tema scuro: data-theme="dark" lo imposta js/theme.js (sistema o scelta manuale) */
:root[data-theme="dark"] {
  --accent: #0a84ff;
  --accent-sel: #0a5fd0;
  --danger: #ff453a;
  --text: #f5f5f7;
  --text-2: #a1a1a6;
  --text-3: #6e6e73;
  --border: rgba(255, 255, 255, 0.1);
  --hover: rgba(255, 255, 255, 0.07);
  --pressed: rgba(255, 255, 255, 0.13);
  --content-bg: #1e1e20;
  --toolbar-bg: #262628;
  --titlebar-bg: #2a2a2c;
  --window-bg: #1e1e20;
  --sidebar-bg: rgba(44, 44, 48, 0.78);
  --sidebar-solid: #2c2c30;
  --row-alt: #252527;
  --banner-bg: rgba(10, 132, 255, 0.12);
  --field-bg: #2c2c2e;
  --btn-bg: #3a3a3c;
  --btn-border: rgba(255, 255, 255, 0.14);
  --seg-on: #636366;
  --menu-bg: rgba(40, 40, 44, 0.8);
  --menu-solid: #2c2c30;
  --menu-border: rgba(255, 255, 255, 0.16);
  --menubar-bg: rgba(24, 24, 28, 0.45);
  --menubar-text: #ffffff;
  --menubar-bg-solid: #1c1c1f;
  --dock-bg: rgba(40, 40, 46, 0.42);
  --dock-border: rgba(255, 255, 255, 0.18);
  --dz-bg: rgba(255, 255, 255, 0.03);
  --dz-border: rgba(255, 255, 255, 0.22);
  --ql-bg: rgba(36, 36, 40, 0.94);
  --ql-body-bg: #161618;
  --tl-inactive: #4a4a4e;
  --shadow-window: 0 24px 70px rgba(0, 0, 0, 0.55), 0 0 0 0.5px rgba(255, 255, 255, 0.16);
  --shadow-window-inactive: 0 12px 34px rgba(0, 0, 0, 0.4), 0 0 0 0.5px rgba(255, 255, 255, 0.1);
  color-scheme: dark;
}

/* --- base ------------------------------------------------------------------ */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  font-family: var(--font);
  font-size: 13px;
  color: var(--text);
  background: #2a1660;
  background-size: cover;
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: default;
}

input,
textarea,
.ql-text,
.info dd {
  user-select: text;
  -webkit-user-select: text;
}

:focus-visible {
  outline: 3px solid rgba(10, 122, 255, 0.5);
  outline-offset: 1px;
}

.svg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.svg svg {
  display: block;
  width: 100%;
  height: 100%;
}

.app {
  position: fixed;
  inset: 0;
}

/* --- sfondi scrivania --------------------------------------------------------- */

.wp-etna,
.wp-etna-preview {
  background:
    radial-gradient(110% 80% at 88% 108%, #ffb057 0%, transparent 55%),
    radial-gradient(90% 75% at 8% 100%, #ef3e5c 0%, transparent 60%),
    radial-gradient(80% 70% at 72% 0%, #6b3cf0 0%, transparent 62%),
    linear-gradient(160deg, #26145c 0%, #8a2c8f 55%, #f0643c 100%);
}

.wp-ionio,
.wp-ionio-preview {
  background:
    radial-gradient(70% 60% at 18% 18%, #7fe7ff 0%, transparent 55%),
    radial-gradient(80% 70% at 85% 85%, #1d3fb8 0%, transparent 60%),
    radial-gradient(60% 55% at 70% 30%, #19c1b0 0%, transparent 55%),
    linear-gradient(180deg, #0ea5e9 0%, #1e3a8a 100%);
}

.wp-alba,
.wp-alba-preview {
  background:
    radial-gradient(70% 60% at 15% 85%, #ffd2a8 0%, transparent 60%),
    radial-gradient(70% 60% at 85% 15%, #cbb4ff 0%, transparent 60%),
    radial-gradient(60% 50% at 60% 60%, #ffaecb 0%, transparent 60%),
    linear-gradient(160deg, #ffe6d3 0%, #e1d6ff 100%);
}

.wp-notte,
.wp-notte-preview {
  background:
    radial-gradient(70% 60% at 82% 10%, #4a2499 0%, transparent 60%),
    radial-gradient(70% 60% at 10% 92%, #0c4a6e 0%, transparent 60%),
    radial-gradient(40% 40% at 50% 55%, #1f1650 0%, transparent 70%),
    linear-gradient(180deg, #08081a 0%, #1b1035 100%);
}

.wp-zagara,
.wp-zagara-preview {
  background:
    radial-gradient(70% 60% at 20% 15%, #fff5b8 0%, transparent 55%),
    radial-gradient(70% 60% at 85% 25%, #ffb347 0%, transparent 55%),
    radial-gradient(80% 70% at 50% 100%, #2fa36b 0%, transparent 65%),
    linear-gradient(150deg, #f9d976 0%, #3aa77a 100%);
}

body[class*='wp-'] {
  background-size: cover;
  background-attachment: fixed;
}

/* --- schermata di blocco ------------------------------------------------------ */

.lock {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 8vh 16px 4vh;
  color: #fff;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.25);
  animation: fade 0.5s ease-out;
}

.lock-card {
  margin: auto 0; /* centrata in verticale, il footer resta in fondo */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: min(340px, 100%);
}

/* Logo ingegneriAttiva (public/js/brand.js) */
.ia-mark {
  display: inline-block;
  line-height: 0;
}

.ia-mark svg {
  display: block;
  width: auto;
  height: 100%;
  overflow: visible;
}

.ia-wordmark {
  font-weight: 500;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.ia-wordmark b {
  font-weight: 700;
}

.lock-avatar {
  height: 112px;
  color: #fff;
  filter: drop-shadow(0 8px 22px rgba(0, 0, 0, 0.28));
}

.lock-card h1 {
  margin: 10px 0 0;
  font-size: 20px;
  font-weight: 600;
}

.lock-sub {
  margin: 0 0 16px;
  font-size: 12px;
  opacity: 0.88;
  text-align: center;
}

.lock-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
}

/* Pulsante "Accedi con Microsoft" secondo le linee guida ufficiali (tema chiaro):
   logo originale 21px, 12px di margine, testo Segoe UI semibold 15px, bordo #8C8C8C. */
.ms-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  height: 41px;
  padding: 0 12px;
  border: 1px solid #8c8c8c;
  border-radius: 2px;
  background: #fff;
  color: #5e5e5e;
  font-family: 'Segoe UI', 'Segoe UI Web (West European)', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  text-shadow: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
  transition: transform 0.15s, box-shadow 0.2s;
}

.ms-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
}

.ms-btn:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
}

.ms-logo {
  width: 21px;
  height: 21px;
}

.lock-actions .lock-hint {
  max-width: 320px;
  line-height: 1.45;
}

.lock-hint {
  margin: 2px 0 0;
  font-size: 12px;
  opacity: 0.85;
  text-align: center;
}

/* Intoppo passeggero (accesso annullato, sessione scaduta): una riga discreta, non un allarme */
.lock-error {
  margin: 10px 0 0;
  padding: 7px 14px;
  border: 0.5px solid rgba(255, 255, 255, 0.3);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  font-size: 13px;
  text-align: center;
  text-shadow: none;
}

/* Errore vero (Microsoft non risponde): qui il rosso ci sta */
.lock-error.serious {
  border-color: rgba(255, 120, 110, 0.6);
  background: rgba(255, 59, 48, 0.38);
}

.lock-error:empty {
  display: none;
}

/* --- avviso sulla schermata di accesso (beta chiusa, account non d'Ateneo…) -----------------
   Non è un errore di chi accede: una scheda di vetro con icona, spiegazione e a chi scrivere. */

.lock-card.has-notice {
  width: min(400px, 100%);
}

.lock-card.has-notice .lock-avatar {
  height: 84px;
}

.lock-card.has-notice .lock-sub {
  margin-bottom: 14px;
}

.lock-notice {
  --tone-a: #ffd36b;
  --tone-b: #ff9500;
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 22px 22px 18px;
  overflow: hidden;
  border: 0.5px solid rgba(255, 255, 255, 0.38);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.15);
  -webkit-backdrop-filter: blur(28px) saturate(1.6);
  backdrop-filter: blur(28px) saturate(1.6);
  box-shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  text-align: center;
  text-shadow: none;
  animation: notice-rise 0.6s cubic-bezier(0.2, 0.9, 0.3, 1.15) 0.35s both;
}

/* riflesso che attraversa il vetro quando la scheda compare */
.lock-notice::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(115deg, transparent 32%, rgba(255, 255, 255, 0.22) 46%, transparent 60%);
  transform: translateX(-110%);
  animation: notice-shine 1.5s ease-out 0.8s both;
}

.lock-notice.tone-blue {
  --tone-a: #7fd0ff;
  --tone-b: #0a7aff;
}

.lock-notice.tone-violet {
  --tone-a: #d6a4ff;
  --tone-b: #7c3aed;
}

.lock-notice.tone-teal {
  --tone-a: #7ef0df;
  --tone-b: #0f9b9b;
}

.lock-notice-icon {
  position: relative;
  width: 60px;
  height: 60px;
  display: grid;
  place-items: center;
  margin-bottom: 6px;
  border-radius: 50%;
  background: linear-gradient(160deg, var(--tone-a), var(--tone-b));
  box-shadow: 0 10px 24px -8px var(--tone-b), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  animation: notice-pop 0.55s cubic-bezier(0.2, 0.9, 0.3, 1.5) 0.55s both;
}

/* alone che "respira" intorno all'icona */
.lock-notice-icon i {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid var(--tone-a);
  opacity: 0;
  animation: notice-halo 2.8s ease-out 1.2s infinite;
}

.lock-notice-icon .svg {
  width: 30px;
  height: 30px;
  color: #fff;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.25));
}

.lock-notice h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.lock-notice p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.5;
  opacity: 0.92;
}

.lock-notice-contact {
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 8px 14px;
  border: 0.5px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 12.5px;
  text-decoration: none;
  transition: background-color 0.2s, transform 0.15s;
}

.lock-notice-contact:hover {
  background: rgba(255, 255, 255, 0.28);
  transform: translateY(-1px);
}

.lock-notice-contact .svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.lock-notice-contact span:not(.svg) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lock-card.has-notice .lock-actions {
  margin-top: 16px;
}

/* "Entra con un altro account": secondario, per chi ne ha davvero un altro */
.lock-other {
  margin-top: 14px;
  color: #fff;
  font-size: 13px;
  opacity: 0.85;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(255, 255, 255, 0.5);
  animation: fade 0.6s ease 0.9s both;
}

.lock-other:hover {
  opacity: 1;
}

@keyframes notice-rise {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.96);
  }
}

@keyframes notice-pop {
  from {
    opacity: 0;
    transform: scale(0.5);
  }
}

@keyframes notice-shine {
  to {
    transform: translateX(110%);
  }
}

@keyframes notice-halo {
  0% {
    opacity: 0.7;
    transform: scale(0.9);
  }
  70%,
  100% {
    opacity: 0;
    transform: scale(1.35);
  }
}

@media (prefers-reduced-motion: reduce) {
  .lock-notice,
  .lock-notice::before,
  .lock-notice-icon,
  .lock-notice-icon i,
  .lock-other {
    animation: none;
  }
}

/* Telefono: domanda ed email su due righe, così l'indirizzo si legge sempre per intero */
@media (max-width: 480px) {
  .lock-notice-contact {
    border-radius: 16px;
    text-align: left;
  }

  .lock-notice-contact span:not(.svg) {
    display: flex;
    flex-direction: column;
    gap: 1px;
    white-space: normal;
    overflow-wrap: anywhere;
  }
}

@media (max-height: 640px) {
  .lock-card.has-notice .lock-avatar {
    height: 56px;
  }

  .lock-notice {
    padding: 16px 18px 14px;
  }
}

.lock-footer {
  font-size: 12px;
  opacity: 0.85;
  text-align: center;
}

/* --- scrivania ---------------------------------------------------------------- */

.desktop {
  position: fixed;
  inset: 0;
}

.menubar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 7500;
  height: var(--menubar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  background: var(--menubar-bg);
  -webkit-backdrop-filter: blur(30px) saturate(1.8);
  backdrop-filter: blur(30px) saturate(1.8);
  color: var(--menubar-text);
}

.menubar-left,
.menubar-right {
  display: flex;
  align-items: center;
  gap: 1px;
  min-width: 0;
}

.menubar-item {
  height: 22px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 9px;
  border: 0;
  border-radius: 5px;
  background: none;
  color: inherit;
  font-size: 13px;
  white-space: nowrap;
}

.menubar-item:hover,
.menubar-item.open {
  background: var(--pressed);
}

/* Primo menu: solo il logo ingegneriAttiva, grande quanto la barra lo permette */
.menubar-brand {
  display: inline-flex;
  align-items: center;
}

.menubar-item:has(.menubar-brand) {
  height: 26px;
  padding: 0 7px;
}

.menubar-ia {
  height: 22px;
}

.menubar-glyph {
  width: 15px;
  height: 15px;
}

.menubar-clock {
  padding: 0 8px;
  font-size: 13px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.desktop-icons {
  position: absolute;
  top: var(--menubar-h);
  left: 0;
  right: 0;
  bottom: 86px;
  z-index: 1;
}

.desk-icon {
  position: absolute;
  top: 0;
  left: 0;
  width: 96px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 2px;
  outline: none;
  transition: transform 0.22s ease;
  touch-action: none;
}

.desk-icon.dragging {
  transition: none;
  z-index: 5;
  opacity: 0.85;
}

.desk-icon-img {
  width: 72px;
  height: 62px;
  padding: 4px;
  border-radius: 7px;
  border: 1px solid transparent;
}

.desk-icon-img .svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.25));
}

.desk-icon-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 100%;
  padding: 1px 5px;
  border-radius: 4px;
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.25;
  text-align: center;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.75);
}

.desk-icon-label span {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.desk-icon-label small {
  font-size: 11px;
  font-weight: 400;
  opacity: 0.88;
}

.desk-icon.selected .desk-icon-img {
  background: rgba(0, 0, 0, 0.25);
  border-color: rgba(255, 255, 255, 0.28);
}

.desk-icon.selected .desk-icon-label {
  background: var(--accent-sel);
  text-shadow: none;
}

.desktop-icons.compact {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  align-content: start;
  gap: 8px;
  padding: 14px 16px;
  overflow-y: auto;
}

.desktop-icons.compact .desk-icon {
  position: static;
  width: auto;
  transform: none !important;
}

.desktop-windows {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

/* --- finestre ------------------------------------------------------------------- */

.window {
  position: absolute;
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  background: var(--window-bg);
  box-shadow: var(--shadow-window-inactive);
  overflow: hidden;
  pointer-events: auto;
  outline: none;
}

.window.active {
  box-shadow: var(--shadow-window);
}

.window.opening {
  animation: win-open 0.2s ease-out;
}

.window.closing {
  animation: win-close 0.16s ease-in forwards;
  pointer-events: none;
}

.window.minimizing {
  transform: var(--min-transform, scale(0.1));
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.5, 0, 0.75, 0), opacity 0.3s;
  pointer-events: none;
}

.window.minimized {
  display: none;
}

.window.restoring {
  animation: win-restore 0.28s cubic-bezier(0.2, 0.8, 0.3, 1);
}

.window.animating {
  transition: left 0.25s ease, top 0.25s ease, width 0.25s ease, height 0.25s ease;
}

.window.maximized {
  border-radius: 0;
}

.window.dragging {
  cursor: default;
}

.titlebar {
  flex-shrink: 0;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 84px;
  background: var(--titlebar-bg);
  border-bottom: 0.5px solid var(--border);
}

.window-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}

.window.active .window-title {
  color: var(--text);
}

.traffic {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 6;
  display: flex;
  gap: 8px;
}

.finder .traffic {
  top: 20px;
  left: 18px;
}

.tl {
  position: relative;
  width: 12px;
  height: 12px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.18);
  background: var(--tl-inactive);
}

.window.active .tl-close,
.traffic:hover .tl-close {
  background: #ff5f57;
}

.window.active .tl-min,
.traffic:hover .tl-min {
  background: #febc2e;
}

.window.active .tl-max,
.traffic:hover .tl-max {
  background: #28c840;
}

.tl:disabled {
  background: var(--tl-inactive) !important;
}

.tl::after {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  color: rgba(0, 0, 0, 0.55);
  opacity: 0;
}

.traffic:hover .tl::after {
  opacity: 1;
}

.tl-close::after {
  content: '×';
  font-size: 12px;
}

.tl-min::after {
  content: '−';
}

.tl-max::after {
  content: '+';
}

.tl:disabled::after {
  content: none;
}

.window-body {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.finder .window-body {
  overflow: hidden;
}

.resize {
  position: absolute;
  z-index: 5;
}

.resize-e {
  top: 0;
  right: -3px;
  bottom: 0;
  width: 7px;
  cursor: ew-resize;
}

.resize-w {
  top: 0;
  left: -3px;
  bottom: 0;
  width: 7px;
  cursor: ew-resize;
}

.resize-s {
  left: 0;
  right: 0;
  bottom: -3px;
  height: 7px;
  cursor: ns-resize;
}

.resize-se {
  right: -4px;
  bottom: -4px;
  width: 14px;
  height: 14px;
  cursor: nwse-resize;
}

.resize-sw {
  left: -4px;
  bottom: -4px;
  width: 14px;
  height: 14px;
  cursor: nesw-resize;
}

/* --- Finder --------------------------------------------------------------------- */

.window.finder {
  background: var(--sidebar-bg);
  -webkit-backdrop-filter: blur(40px) saturate(1.7);
  backdrop-filter: blur(40px) saturate(1.7);
}

.finder-layout {
  display: flex;
  height: 100%;
}

.sidebar {
  width: 210px;
  flex-shrink: 0;
  padding: 54px 10px 12px;
  overflow-y: auto;
  border-right: 0.5px solid var(--border);
}

.side-section {
  margin-bottom: 14px;
}

.side-heading {
  padding: 0 8px 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
}

.side-item {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  height: 27px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: none;
  font-size: 13px;
  text-align: left;
}

.side-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-item:hover {
  background: var(--hover);
}

.side-item.active {
  background: var(--pressed);
}

.side-icon {
  width: 16px;
  height: 16px;
  color: var(--accent);
}

.side-hint {
  margin: 2px 8px;
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-3);
}

.tag-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.side-tag .tag-dot {
  margin: 0 3px;
}

.finder-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--content-bg);
}

.toolbar {
  flex-shrink: 0;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px 0 8px;
  background: var(--toolbar-bg);
  border-bottom: 0.5px solid var(--border);
}

.sidebar-hidden .toolbar {
  padding-left: 84px;
}

.sidebar-hidden .sidebar {
  display: none;
}

/* Chiusura della barra laterale: servono solo sul telefono (vedi schermi piccoli) */
.sidebar-scrim,
.sidebar-close {
  display: none;
}

.nav-btns {
  display: flex;
}

.tool-btn {
  height: 28px;
  min-width: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 6px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--text-2);
  font-size: 13px;
}

.tool-btn:hover:not(:disabled) {
  background: var(--hover);
}

.tool-btn:disabled {
  opacity: 0.35;
}

.tool-btn .svg {
  width: 18px;
  height: 18px;
}

.tool-upload {
  color: var(--accent);
  font-weight: 600;
  padding: 0 9px;
}

.toolbar-heading {
  min-width: 0;
  margin-left: 2px;
  line-height: 1.2;
}

.toolbar-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 700;
}

.toolbar-subtitle {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  color: var(--text-2);
}

.toolbar-spacer {
  flex: 1;
}

.segmented {
  display: flex;
  padding: 2px;
  border-radius: 7px;
  background: var(--hover);
}

.seg-btn {
  width: 30px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 5px;
  background: none;
  color: var(--text-2);
}

.seg-btn .svg {
  width: 16px;
  height: 16px;
}

.seg-btn.on {
  background: var(--seg-on);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}

.search-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
  width: 170px;
  height: 28px;
  padding: 0 8px;
  border-radius: 7px;
  background: var(--hover);
  color: var(--text-2);
}

.search-wrap .svg {
  width: 14px;
  height: 14px;
}

.tool-search {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.finder-banner {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
  padding: 8px 16px;
  font-size: 12px;
  color: var(--text-2);
  background: var(--banner-bg);
  border-bottom: 0.5px solid var(--border);
}

.finder-banner .svg {
  width: 15px;
  height: 15px;
  color: var(--accent);
}

.finder-banner strong {
  color: var(--text);
  font-weight: 600;
}

.banner-note {
  color: var(--text-3);
}

.finder-content {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 14px;
  outline: none;
  transition: background 0.15s, box-shadow 0.15s;
}

.finder-content:has(> .items-list) {
  padding: 0;
}

.finder-content.drop-ok {
  background: rgba(10, 122, 255, 0.07);
  box-shadow: inset 0 0 0 3px var(--accent);
}

.finder-content.drop-no {
  box-shadow: inset 0 0 0 3px rgba(255, 59, 48, 0.55);
}

.items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  align-content: start;
  gap: 8px 4px;
}

.items-grid .item {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 4px;
  border-radius: 8px;
  text-align: center;
}

.item-icon {
  width: 76px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: 7px;
}

.item-icon .svg {
  width: 100%;
  height: 100%;
}

.item.doc .item-icon .svg svg {
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.15));
}

.thumb {
  max-width: 100%;
  max-height: 100%;
  border-radius: 3px;
  object-fit: cover;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  background: #fff;
}

.item-name {
  max-width: 100%;
  margin-top: 4px;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.28;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.item-name .tag-dot {
  width: 8px;
  height: 8px;
  margin-right: 4px;
}

.item-sub {
  max-width: 100%;
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  color: var(--text-2);
}

.items-grid .item.selected .item-icon {
  background: var(--pressed);
}

.items-grid .item.selected .item-name {
  background: var(--accent-sel);
  color: #fff;
}

.window:not(.active) .items-grid .item.selected .item-name {
  background: var(--pressed);
  color: var(--text);
}

.items-list {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}

.items-list th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 6px 10px;
  background: var(--content-bg);
  border-bottom: 0.5px solid var(--border);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-2);
  text-align: left;
  white-space: nowrap;
}

.items-list td {
  max-width: 260px;
  padding: 4px 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-2);
}

.items-list tbody tr:nth-child(even) {
  background: var(--row-alt);
}

.items-list td.cell-name {
  max-width: 340px;
  color: var(--text);
}

.row-icon {
  display: inline-block;
  width: 20px;
  height: 18px;
  margin-right: 8px;
  vertical-align: middle;
}

.row-icon .svg {
  width: 100%;
  height: 100%;
}

.row-name {
  vertical-align: middle;
}

.cell-name .tag-dot {
  margin-left: 6px;
  vertical-align: middle;
}

.items-list tr.selected,
.items-list tbody tr.selected:nth-child(even) {
  background: var(--accent-sel);
}

.items-list tr.selected td {
  color: #fff;
}

.window:not(.active) .items-list tr.selected {
  background: var(--pressed);
}

.window:not(.active) .items-list tr.selected td {
  color: var(--text);
}

.tag-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.empty {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 30px;
  text-align: center;
  color: var(--text-2);
}

.empty strong {
  font-size: 15px;
  color: var(--text);
}

.empty span {
  max-width: 380px;
  line-height: 1.45;
}

.empty .btn {
  margin-top: 8px;
}

.empty-icon {
  width: 92px;
  height: 74px;
  margin-bottom: 6px;
}

.empty-glyph {
  width: 46px;
  height: 46px;
  margin-bottom: 6px;
  color: var(--accent);
}

.loading {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-2);
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.finder-footer {
  flex-shrink: 0;
  height: 28px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  border-top: 0.5px solid var(--border);
  background: var(--content-bg);
  font-size: 11px;
  color: var(--text-2);
}

.pathbar {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 1px;
  overflow-x: auto;
  scrollbar-width: none;
}

.pathbar::-webkit-scrollbar {
  display: none;
}

.crumb {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 4px;
  border: 0;
  border-radius: 4px;
  background: none;
  font-size: 11px;
  white-space: nowrap;
}

.crumb:hover {
  background: var(--hover);
}

.crumb-icon {
  width: 16px;
  height: 13px;
}

.crumb-sep {
  width: 10px;
  height: 10px;
  opacity: 0.5;
}

.statusbar {
  white-space: nowrap;
}

/* --- pulsanti e campi ------------------------------------------------------------- */

.btn {
  height: 28px;
  padding: 0 14px;
  border: 0.5px solid var(--btn-border);
  border-radius: 7px;
  background: var(--btn-bg);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.06);
}

.btn:hover:not(:disabled) {
  filter: brightness(0.97);
}

.btn:active:not(:disabled) {
  filter: brightness(0.92);
}

.btn:disabled {
  opacity: 0.45;
}

.btn-primary {
  border-color: transparent;
  background: linear-gradient(180deg, #2f8fff, #0a6cff);
  color: #fff;
}

.btn-danger {
  border-color: transparent;
  background: var(--danger);
  color: #fff;
}

.btn-danger-ghost {
  color: var(--danger);
}

.field {
  width: 100%;
  height: 30px;
  padding: 0 9px;
  border: 0.5px solid var(--btn-border);
  border-radius: 7px;
  background: var(--field-bg);
  outline: none;
}

textarea.field {
  height: auto;
  padding: 7px 9px;
  line-height: 1.4;
  resize: vertical;
}

.field:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(10, 122, 255, 0.3);
}

/* --- menu ----------------------------------------------------------------------- */

.menu {
  position: fixed;
  z-index: 10000;
  min-width: 210px;
  max-width: 340px;
  padding: 5px;
  border-radius: 9px;
  background: var(--menu-bg);
  -webkit-backdrop-filter: blur(30px) saturate(1.8);
  backdrop-filter: blur(30px) saturate(1.8);
  box-shadow: var(--shadow-pop);
  font-size: 13px;
  animation: fade 0.1s ease-out;
}

.menu-item {
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 4px 10px;
  border: 0;
  border-radius: 5px;
  background: none;
  color: var(--text);
  text-align: left;
}

.menu-label {
  position: relative;
  padding-left: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu-item.checked .menu-label::before {
  content: '✓';
  position: absolute;
  left: 0;
}

.menu-shortcut {
  color: var(--text-3);
  white-space: nowrap;
}

.menu-item:hover:not(:disabled) {
  background: var(--accent);
  color: #fff;
}

.menu-item:hover:not(:disabled) .menu-shortcut {
  color: rgba(255, 255, 255, 0.8);
}

.menu-item:disabled {
  color: var(--text-3);
}

.menu-item.danger {
  color: var(--danger);
}

.menu-item.danger:hover {
  background: var(--danger);
  color: #fff;
}

.menu-sep {
  height: 1px;
  margin: 5px 8px;
  background: var(--border);
}

.menu-heading {
  padding: 3px 10px 3px 24px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: var(--text-2);
}

/* --- notifiche --------------------------------------------------------------------- */

.notifications {
  position: fixed;
  top: calc(var(--menubar-h) + 8px);
  right: 12px;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 340px;
  max-width: calc(100vw - 24px);
}

.notification {
  display: flex;
  gap: 11px;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--menu-bg);
  -webkit-backdrop-filter: blur(30px) saturate(1.8);
  backdrop-filter: blur(30px) saturate(1.8);
  box-shadow: var(--shadow-pop);
  animation: notif-in 0.35s cubic-bezier(0.2, 0.8, 0.3, 1);
}

.notification.leaving {
  animation: notif-out 0.25s ease-in forwards;
}

.notification-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 9px;
  background: linear-gradient(180deg, #5ac8fa, #0a64d8);
  box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.25), 0 2px 6px rgba(0, 0, 0, 0.15);
  color: #fff;
}

.notification-icon svg {
  width: 20px;
  height: 20px;
}

/* Icona di un'app (es. tour, Finder): già colorata, niente sfondo */
.notification-icon.custom {
  background: none;
  box-shadow: none;
}

.notification-icon.custom svg {
  width: 34px;
  height: 34px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.notification-success .notification-icon {
  background: linear-gradient(180deg, #5be07a, #13a54a);
}

.notification-error .notification-icon {
  background: linear-gradient(180deg, #ff7a70, #e0261b);
}

.notification-warning .notification-icon {
  background: linear-gradient(180deg, #ffd36b, #ff9500);
}

.notification-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  font-size: 13px;
}

.notification-text strong {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.notification-text span {
  color: var(--text-2);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* --- alert -------------------------------------------------------------------------- */

.alert-overlay {
  position: fixed;
  inset: 0;
  z-index: 9500;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.18);
  animation: fade 0.15s;
}

.alert {
  width: 290px;
  padding: 20px 18px 16px;
  border-radius: 14px;
  background: var(--menu-solid);
  text-align: center;
  box-shadow: var(--shadow-window);
  animation: pop 0.18s ease-out;
}

.alert-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 12px;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffd36b, #ff9500);
  position: relative;
}

.alert-icon::after {
  content: '!';
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 32px;
  font-weight: 800;
}

.alert h3 {
  margin: 0 0 6px;
  font-size: 14px;
  word-break: break-word;
}

.alert p {
  margin: 0 0 16px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-2);
}

.alert-actions {
  display: flex;
  gap: 8px;
}

.alert-actions .btn {
  flex: 1;
}

/* --- caricamento --------------------------------------------------------------------- */

.upload-form {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 20px 16px;
}

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 18px;
  border: 1.5px dashed var(--dz-border);
  border-radius: 12px;
  background: var(--dz-bg);
  color: var(--text-2);
  text-align: center;
  transition: background 0.15s, border-color 0.15s;
}

.dropzone:hover,
.dropzone.over {
  border-color: var(--accent);
  background: rgba(10, 122, 255, 0.07);
}

.dropzone strong {
  color: var(--text);
}

.dropzone:has(.dz-file) {
  flex-direction: row;
  gap: 14px;
  text-align: left;
}

.dz-glyph {
  width: 30px;
  height: 30px;
  margin-bottom: 4px;
  color: var(--accent);
}

.dz-file-icon {
  width: 40px;
  height: 50px;
}

.dz-file {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.dz-file strong {
  word-break: break-all;
}

.dz-error {
  color: var(--danger);
}

.dz-change {
  font-size: 11px;
  color: var(--accent);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.group-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
}

.dest {
  display: grid;
  gap: 6px;
}

.dest-level {
  display: grid;
  grid-template-columns: 64px 1fr;
  align-items: center;
  gap: 8px;
}

.dest-level span {
  font-size: 12px;
  color: var(--text-2);
  text-align: right;
}

.field-hint {
  margin: 0;
  font-size: 11px;
  color: var(--text-3);
}

.field-hint:empty {
  display: none;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  height: 26px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 11px;
  border: 0.5px solid var(--btn-border);
  border-radius: 13px;
  background: var(--btn-bg);
  font-size: 12px;
}

.chip.on {
  border-color: transparent;
  background: var(--accent);
  color: #fff;
}

.chip.on .tag-dot {
  box-shadow: 0 0 0 1.5px #fff;
}

.consent {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-2);
}

.consent input {
  margin: 2px 0 0;
  accent-color: var(--accent);
}

.progress {
  height: 6px;
  border-radius: 3px;
  background: var(--hover);
  overflow: hidden;
}

.progress-bar {
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width 0.2s;
}

.form-error {
  margin: 0;
  font-size: 12px;
  color: var(--danger);
}

.form-error:empty {
  display: none;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: auto;
}

/* --- info ------------------------------------------------------------------------- */

.info,
.info-form {
  padding: 18px;
}

.info-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 0.5px solid var(--border);
}

.info-icon {
  width: 58px;
  height: 50px;
}

.info-head h2 {
  margin: 0 0 2px;
  font-size: 15px;
  word-break: break-word;
}

.info-head span {
  font-size: 12px;
  color: var(--text-2);
}

.info-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
}

.info-row {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 10px;
  font-size: 12px;
  line-height: 1.4;
}

.info-row dt {
  color: var(--text-2);
  text-align: right;
}

.info-row dd {
  margin: 0;
  word-break: break-word;
}

.info-teachers {
  margin: 0;
  padding: 0;
  list-style: none;
}

.info-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 0.5px solid var(--border);
}

.info-form label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 10px;
  font-size: 12px;
  color: var(--text-2);
}

/* --- Quick Look ----------------------------------------------------------------------- */

.ql-overlay {
  position: fixed;
  inset: 0;
  z-index: 8000;
  display: grid;
  place-items: center;
  padding: calc(var(--menubar-h) + 16px) 20px 96px;
  background: rgba(0, 0, 0, 0.28);
  animation: fade 0.15s;
  transition: opacity 0.18s;
}

.ql-overlay.closing {
  opacity: 0;
}

.quicklook {
  width: min(980px, 100%);
  height: 100%;
  max-height: 900px;
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  background: var(--ql-bg);
  -webkit-backdrop-filter: blur(30px);
  backdrop-filter: blur(30px);
  box-shadow: var(--shadow-window);
  overflow: hidden;
  animation: pop 0.2s ease-out;
}

.ql-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 10px;
  border-bottom: 0.5px solid var(--border);
}

.ql-nav {
  display: flex;
}

.ql-heading {
  flex: 1;
  min-width: 0;
  padding: 0 8px;
  text-align: center;
}

.ql-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
}

.ql-meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  color: var(--text-2);
}

.ql-meta .tag-dot {
  width: 8px;
  height: 8px;
  margin-right: 5px;
}

.ql-btn {
  height: 28px;
  min-width: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 6px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--text-2);
  font-size: 12px;
  text-decoration: none;
}

.ql-btn:hover:not(:disabled) {
  background: var(--hover);
}

.ql-btn:disabled {
  opacity: 0.35;
}

.ql-btn .svg {
  width: 16px;
  height: 16px;
}

.ql-download {
  padding: 0 10px;
  background: var(--hover);
  color: var(--text);
  font-weight: 500;
}

.ql-body {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ql-body-bg);
  overflow: auto;
}

.ql-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

.ql-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.ql-text {
  align-self: stretch;
  width: 100%;
  margin: 0;
  padding: 16px 20px;
  overflow: auto;
  background: var(--content-bg);
  font: 12px/1.55 var(--mono);
  white-space: pre-wrap;
  word-break: break-word;
}

.ql-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  max-width: 420px;
  padding: 30px;
  text-align: center;
  color: var(--text-2);
}

.ql-placeholder strong {
  color: var(--text);
  word-break: break-all;
}

.ql-placeholder p {
  margin: 4px 0;
  line-height: 1.45;
}

.ql-file-icon {
  width: 96px;
  height: 120px;
}

/* --- Spotlight ---------------------------------------------------------------------- */

.spot-overlay {
  position: fixed;
  inset: 0;
  z-index: 8500;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 18vh 16px 0;
}

.spotlight {
  width: min(660px, 100%);
  border-radius: 14px;
  background: var(--menu-bg);
  -webkit-backdrop-filter: blur(40px) saturate(1.8);
  backdrop-filter: blur(40px) saturate(1.8);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35), 0 0 0 0.5px var(--menu-border);
  overflow: hidden;
  animation: pop 0.15s ease-out;
}

.spot-bar {
  height: 56px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
}

.spot-glyph {
  width: 22px;
  height: 22px;
  color: var(--text-2);
}

.spot-input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 22px;
  font-weight: 300;
}

.spot-results {
  max-height: 52vh;
  overflow: auto;
  padding: 6px;
  border-top: 0.5px solid var(--border);
}

.spot-group {
  padding: 8px 10px 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
}

.spot-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  text-align: left;
}

.spot-item.active {
  background: var(--accent);
  color: #fff;
}

.spot-icon {
  width: 34px;
  height: 30px;
}

.spot-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.spot-text strong,
.spot-text span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.spot-text strong {
  font-weight: 500;
}

.spot-text span {
  font-size: 11px;
  color: var(--text-2);
}

.spot-item.active .spot-text span {
  color: rgba(255, 255, 255, 0.85);
}

.spot-hint {
  padding: 14px 12px;
  color: var(--text-2);
}

/* --- Dock ------------------------------------------------------------------------------ */

.dock {
  position: fixed;
  left: 50%;
  bottom: 8px;
  z-index: 7000;
  max-width: calc(100vw - 16px);
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 6px 8px;
  border: 0.5px solid var(--dock-border);
  border-radius: 20px;
  background: var(--dock-bg);
  -webkit-backdrop-filter: blur(30px) saturate(1.8);
  backdrop-filter: blur(30px) saturate(1.8);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  transform: translateX(-50%);
}

.dock-item {
  position: relative;
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  padding: 0;
  border: 0;
  background: none;
  transform-origin: bottom center;
  transition: transform 0.2s cubic-bezier(0.3, 0.7, 0.4, 1.4), margin 0.2s;
}

.dock-icon {
  width: 100%;
  height: 100%;
}

/* Icone delle app in due versioni (icons.js): quella scura in modalità scura, come su iOS */
.ai-dark {
  display: none;
}

:root[data-theme='dark'] .ai-dark {
  display: inline;
}

:root[data-theme='dark'] .ai-light {
  display: none;
}

.dock-icon svg {
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.25));
}

.dock-dot {
  position: absolute;
  bottom: -5px;
  left: 50%;
  width: 4px;
  height: 4px;
  margin-left: -2px;
  border-radius: 50%;
  background: var(--text);
  opacity: 0;
}

.dock-dot.on {
  opacity: 0.75;
}

.dock-tooltip {
  position: absolute;
  bottom: calc(100% + 14px);
  left: 50%;
  padding: 4px 10px;
  border-radius: 7px;
  background: var(--menu-bg);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-pop);
  color: var(--text);
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) scale(0.8);
  transition: opacity 0.12s;
}

.dock-sep {
  width: 1px;
  align-self: stretch;
  margin: 4px 4px;
  background: var(--text-3);
  opacity: 0.6;
}

.dock-minimized {
  display: contents;
}

.dock-min-frame {
  width: 100%;
  height: 100%;
  display: flex;
  padding: 7px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

@media (hover: hover) {
  .dock-item:hover {
    margin: 0 8px;
    transform: scale(1.28) translateY(-6px);
  }

  .dock-item:hover + .dock-item,
  .dock-item:has(+ .dock-item:hover) {
    transform: scale(1.12) translateY(-2px);
  }

  .dock-item:hover .dock-tooltip {
    opacity: 1;
  }
}

/* --- finestre di servizio --------------------------------------------------------------- */

.pane {
  padding: 18px 20px;
}

.pane-intro {
  margin: 0 0 14px;
  font-size: 12px;
  color: var(--text-2);
}

.wp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 12px;
}

.wp-swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: none;
  font-size: 12px;
}

.wp-preview {
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: 8px;
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.2);
  transition: box-shadow 0.15s;
}

.wp-swatch.on .wp-preview {
  box-shadow: 0 0 0 3px var(--accent);
}

.about {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 22px 24px;
  text-align: center;
}

.about-icon {
  width: 80px;
  height: 80px;
}

.about h2 {
  margin: 10px 0 0;
  font-size: 18px;
}

.about p {
  margin: 4px 0;
  font-size: 12px;
  line-height: 1.45;
}

.about-version {
  margin-bottom: 10px !important;
  color: var(--text-2);
}

.about-small {
  margin-top: 12px !important;
  font-size: 11px !important;
  color: var(--text-2);
}

kbd {
  display: inline-block;
  padding: 1px 6px;
  border: 0.5px solid var(--btn-border);
  border-radius: 5px;
  background: var(--btn-bg);
  box-shadow: 0 1px 0 var(--btn-border);
  font: inherit;
  font-size: 11px;
  white-space: nowrap;
}

/* --- scrivania vuota e rilascio cartelle ------------------------------------------------ */

.desktop-empty {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(380px, calc(100% - 32px));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 26px 24px 22px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.16);
  border: 0.5px solid rgba(255, 255, 255, 0.35);
  -webkit-backdrop-filter: blur(24px) saturate(1.5);
  backdrop-filter: blur(24px) saturate(1.5);
  color: #fff;
  text-align: center;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  transform: translate(-50%, -58%);
  animation: fade 0.4s ease-out;
}

/* Sfondo chiaro: vetro più scuro, così il testo bianco resta leggibile */
body.wp-alba:not(.admin-look) .desktop-empty {
  background: rgba(52, 28, 72, 0.38);
  border-color: rgba(255, 255, 255, 0.25);
}

.desktop-empty strong {
  font-size: 16px;
}

.desktop-empty span {
  font-size: 13px;
  line-height: 1.45;
  opacity: 0.92;
}

.desktop-empty .btn {
  margin-top: 8px;
  text-shadow: none;
}

.desktop-empty-icon {
  width: 72px;
  height: 58px;
  opacity: 0.85;
}

body.dragging-folder .desktop-icons {
  outline: 2px dashed rgba(255, 255, 255, 0.55);
  outline-offset: -10px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
}

.desktop-icons.drop-target {
  outline: 2px dashed #fff;
  outline-offset: -10px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.12);
}

/* --- finestra Anteprima ------------------------------------------------------------------ */

.preview-window .titlebar {
  gap: 8px;
}

.window-subtitle {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--text-3);
  white-space: nowrap;
}

.window-subtitle:empty {
  display: none;
}

.window-subtitle::before {
  content: '— ';
}

.preview-window .window-body {
  overflow: hidden;
}

/* --- visualizzatore PDF ---------------------------------------------------------------- */

.pdfv {
  --pdfv-canvas: #8e8e93;
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--content-bg);
}

/* Tema scuro: data-theme="dark" lo imposta js/theme.js (sistema o scelta manuale) */
:root[data-theme="dark"] .pdfv {
  --pdfv-canvas: #3a3a3c;
}

.pdfv-toolbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  padding: 5px 10px;
  overflow-x: auto;
  scrollbar-width: none;
  background: var(--toolbar-bg);
  border-bottom: 0.5px solid var(--border);
}

.pdfv-toolbar::-webkit-scrollbar {
  display: none;
}

.pdfv-group {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.pdfv-group + .pdfv-group {
  padding-left: 6px;
  border-left: 0.5px solid var(--border);
}

.pdfv-spacer {
  flex: 1;
}

.pdfv-spacer + .pdfv-group {
  border-left: 0;
}

.pdfv-btn {
  width: 30px;
  height: 28px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--text-2);
}

.pdfv-btn:hover:not(:disabled) {
  background: var(--hover);
  color: var(--text);
}

.pdfv-btn.on {
  background: var(--pressed);
  color: var(--accent);
}

.pdfv-btn:disabled {
  opacity: 0.35;
}

.pdfv-btn .svg {
  width: 17px;
  height: 17px;
}

.pdfv-page {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 4px;
  font-size: 12px;
  color: var(--text-2);
  white-space: nowrap;
}

.pdfv-page-input {
  width: 42px;
  height: 24px;
  padding: 0 4px;
  border: 0.5px solid var(--btn-border);
  border-radius: 6px;
  background: var(--field-bg);
  text-align: center;
  font-variant-numeric: tabular-nums;
  outline: none;
}

.pdfv-page-input:focus,
.pdfv-zoom:focus,
.pdfv-find-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(10, 122, 255, 0.3);
}

.pdfv-zoom {
  height: 24px;
  max-width: 150px;
  padding: 0 4px;
  border: 0.5px solid var(--btn-border);
  border-radius: 6px;
  background: var(--field-bg);
  font-size: 12px;
  outline: none;
}

.pdfv-findbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 6px;
  padding: 6px 10px;
  background: var(--banner-bg);
  border-bottom: 0.5px solid var(--border);
  font-size: 12px;
}

.pdfv-find-glyph {
  width: 14px;
  height: 14px;
  color: var(--text-2);
}

.pdfv-find-input {
  width: 220px;
  max-width: 50vw;
  height: 26px;
  padding: 0 8px;
  border: 0.5px solid var(--btn-border);
  border-radius: 6px;
  background: var(--field-bg);
  outline: none;
}

.pdfv-find-input.not-found {
  background: rgba(255, 59, 48, 0.12);
  border-color: var(--danger);
}

.pdfv-find-count {
  min-width: 60px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.pdfv-check {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-2);
  white-space: nowrap;
}

.pdfv-check input {
  margin: 0;
  accent-color: var(--accent);
}

.pdfv-progress {
  flex-shrink: 0;
  height: 2px;
}

.pdfv-progress-bar {
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width 0.2s, opacity 0.4s;
}

.pdfv-progress.done .pdfv-progress-bar {
  width: 100% !important;
  opacity: 0;
}

.pdfv-body {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
}

.pdfv-sidebar {
  display: none;
  width: 156px;
  flex-shrink: 0;
  padding: 12px 10px;
  overflow-y: auto;
  background: var(--sidebar-solid);
  border-right: 0.5px solid var(--border);
}

.pdfv.with-thumbs .pdfv-sidebar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.pdfv-thumb {
  width: 110px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 0;
  border-radius: 6px;
  background: none;
  font-size: 11px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.pdfv-thumb-page {
  width: 100%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

.pdfv-thumb-page canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.pdfv-thumb:hover .pdfv-thumb-page {
  box-shadow: 0 0 0 2px var(--text-3);
}

.pdfv-thumb.current .pdfv-thumb-page {
  box-shadow: 0 0 0 3px var(--accent);
}

.pdfv-thumb.current span {
  padding: 0 6px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
}

.pdfv-main {
  position: relative;
  flex: 1;
  min-width: 0;
  background: var(--pdfv-canvas);
}

.pdfv-container {
  position: absolute;
  inset: 0;
  overflow: auto;
  outline: none;
  user-select: text;
  -webkit-user-select: text;
}

.pdfv .pdfViewer {
  padding: 14px 0 24px;
}

.pdfv .pdfViewer .page {
  border: 0;
  margin: 0 auto 14px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

.pdfv .pdfViewer.scrollHorizontal .page,
.pdfv .pdfViewer.scrollWrapped .page,
.pdfv .pdfViewer .spread .page {
  margin: 0 7px 14px;
}

.pdfv-status {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #fff;
  font-size: 13px;
  pointer-events: none;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.pdfv-status .spinner {
  border-color: rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
}

.pdfv-sheet {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.25);
}

.pdfv-sheet-card {
  width: min(380px, 100%);
  max-height: 100%;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
  border-radius: 12px;
  background: var(--menu-solid);
  box-shadow: var(--shadow-window);
  animation: pop 0.18s ease-out;
}

.pdfv-sheet-card > span,
.pdfv-password > span {
  color: var(--text-2);
  line-height: 1.45;
}

.pdfv-password {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pdfv-sheet-card .pdfv-error {
  color: var(--danger);
}

.pdfv-sheet-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.pdfv.is-fullscreen,
.pdfv.is-fullscreen .pdfv-main {
  background: #000;
}

.pdfv.is-fullscreen .pdfv-sidebar {
  display: none;
}

.ql-open span {
  font-weight: 500;
}

/* Stampa: solo le pagine renderizzate dal visualizzatore. */
#print-root {
  display: none;
}

@media print {
  @page {
    margin: 0;
  }

  html,
  body {
    height: auto !important;
    overflow: visible !important;
    background: #fff !important;
  }

  body > *:not(#print-root) {
    display: none !important;
  }

  #print-root {
    display: block;
  }

  #print-root img {
    display: block;
    width: 100%;
    height: auto;
    break-after: page;
    page-break-after: always;
  }
}

/* --- schermi piccoli -------------------------------------------------------------------- */

@media (max-width: 720px) {
  .window {
    left: 0 !important;
    top: var(--menubar-h) !important;
    width: 100% !important;
    height: calc(100% - var(--menubar-h) - var(--dock-space, 78px)) !important;
    border-radius: 0 0 14px 14px;
  }

  .resize,
  .tl-max {
    display: none;
  }

  .finder .sidebar {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 4;
    width: 230px;
    background: var(--sidebar-solid);
    box-shadow: 8px 0 30px rgba(0, 0, 0, 0.25);
  }

  .finder .finder-layout {
    position: relative;
  }

  /* Velo dietro la barra aperta: toccandolo la barra si chiude */
  .finder .finder-layout:not(.sidebar-hidden) .sidebar-scrim {
    display: block;
    position: absolute;
    inset: 0;
    z-index: 3;
    background: rgba(0, 0, 0, 0.28);
    animation: fade 0.2s;
  }

  .finder .finder-layout:not(.sidebar-hidden) .sidebar-close {
    position: absolute;
    top: 12px;
    left: 190px;
    z-index: 5;
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--hover);
    color: var(--text-2);
  }

  .finder .sidebar-close .svg {
    width: 15px;
    height: 15px;
  }

  .finder .toolbar {
    padding-left: 76px;
  }

  .search-wrap {
    width: 104px;
  }

  .tool-upload span:not(.svg),
  .segmented,
  .toolbar-subtitle {
    display: none;
  }

  .items-grid {
    grid-template-columns: repeat(auto-fill, minmax(94px, 1fr));
  }

  .menubar-left .menubar-item:nth-child(n + 3),
  .menubar-user span:not(.svg) {
    display: none;
  }

  .dock {
    gap: 2px;
    padding: 5px 6px;
    border-radius: 16px;
  }

  .dock-item {
    width: 44px;
    height: 44px;
  }

  .dock-sep {
    margin: 4px 2px;
  }

  .quicklook {
    border-radius: 12px;
  }

  .ql-overlay {
    padding: calc(var(--menubar-h) + 8px) 8px var(--dock-space, 72px);
  }

  .ql-download span,
  .ql-open span,
  .pdfv-rotate,
  .pdfv-print {
    display: none;
  }

  .pdfv-zoom {
    max-width: 96px;
  }

  .pdfv-toolbar {
    flex-wrap: wrap;
    row-gap: 4px;
    overflow: visible;
  }

  .pdfv-spacer {
    display: none;
  }

  .pdfv-group + .pdfv-group {
    padding-left: 2px;
    border-left: 0;
  }
}

@media (max-width: 420px) {
  .menubar-clock {
    font-size: 12px;
  }

  .dock-sep,
  .statusbar,
  .toolbar .tool-btn[aria-label='Ottieni informazioni'] {
    display: none;
  }

  .search-wrap {
    width: 84px;
  }
}

/* --- animazioni ------------------------------------------------------------------------- */

@keyframes fade {
  from {
    opacity: 0;
  }
}

@keyframes pop {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes win-open {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
}

@keyframes win-close {
  to {
    opacity: 0;
    transform: scale(0.95);
  }
}

@keyframes win-restore {
  from {
    opacity: 0;
    transform: translateY(40%) scale(0.2);
  }
}

@keyframes notif-in {
  from {
    opacity: 0;
    transform: translateX(110%);
  }
}

@keyframes notif-out {
  to {
    opacity: 0;
    transform: translateX(110%);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* --- logo dell'associazione in filigrana sulla scrivania ---------------------------------- */

.desktop-watermark {
  position: absolute;
  right: 36px;
  bottom: 104px;
  z-index: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: #fff;
  opacity: 0.22;
  mix-blend-mode: soft-light;
  pointer-events: none;
  user-select: none;
}

.desktop-watermark .ia-mark {
  height: 150px;
}

/* Sfondo chiaro: logo scuro, altrimenti il bianco sparirebbe */
body.wp-alba:not(.admin-look) .desktop-watermark {
  color: #3a1d4f;
  opacity: 0.14;
  mix-blend-mode: multiply;
}

.desktop-watermark .ia-wordmark {
  font-size: 24px;
}

@media (max-width: 640px) {
  .desktop-watermark {
    right: 50%;
    bottom: 96px;
    transform: translateX(50%);
  }

  .desktop-watermark .ia-mark {
    height: 96px;
  }

  .desktop-watermark .ia-wordmark {
    font-size: 17px;
  }
}
