/* Area admin (public/js/admin/*), "Scrivi all'associazione" (contact.js), banner del sito,
   finestre di dialogo con campi (formDialog) e schermata di account sospeso. */

/* --- account admin: sfondo "sala di controllo" ed etichetta ----------------------------- */

body.admin-look {
  background:
    radial-gradient(60% 50% at 85% 10%, rgba(255, 69, 58, 0.35), transparent 70%),
    radial-gradient(50% 45% at 10% 90%, rgba(255, 159, 10, 0.22), transparent 70%),
    radial-gradient(70% 60% at 40% 40%, rgba(94, 92, 230, 0.25), transparent 75%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 48px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 48px),
    linear-gradient(160deg, #10131c 0%, #1a1424 55%, #22121a 100%);
  background-attachment: fixed;
}

body.admin-look .desktop-empty,
body.admin-look .desk-label {
  color: #fff;
}

.menubar-admin-title {
  font-weight: 700;
  color: #ff453a;
}

/* --- Dock: badge numerici e gruppo admin ------------------------------------------------- */

.dock-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  z-index: 2;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #ff3b30;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  animation: pop 0.25s ease-out;
}

.dock-admin {
  display: contents;
}

.dock-admin-launcher {
  display: none;
}

/* Schermi non abbastanza larghi per tutte le app: un solo "Area admin" */
@media (max-width: 1280px) {
  .dock-admin {
    display: none;
  }

  .dock-admin-launcher {
    display: block;
  }
}

/* --- banner in alto (manutenzione e annunci) ---------------------------------------------- */

/* In alto a sinistra: a destra ci sono le notifiche temporanee, che non devono coprirle. */
.site-banners {
  position: fixed;
  top: calc(var(--menubar-h) + 8px);
  left: 12px;
  z-index: 1; /* sulla scrivania: sotto le finestre (z-index 2), sopra le icone */
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: min(600px, calc(100vw - 380px));
  pointer-events: none;
}

@media (max-width: 760px) {
  .site-banners {
    width: calc(100vw - 24px);
  }
}

.site-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px 9px 12px;
  border-radius: 12px;
  background: var(--menu-bg);
  -webkit-backdrop-filter: blur(30px) saturate(1.8);
  backdrop-filter: blur(30px) saturate(1.8);
  box-shadow: var(--shadow-pop);
  color: var(--text);
  font-size: 13px;
  pointer-events: auto;
  animation: adm-drop 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}

.site-banner.important {
  background: linear-gradient(90deg, rgba(255, 69, 58, 0.92), rgba(255, 149, 0, 0.92));
  color: #fff;
}

.site-banner.maintenance {
  background: linear-gradient(90deg, rgba(255, 204, 0, 0.95), rgba(255, 159, 10, 0.95));
  color: #3a2a00;
}

.site-banner.preview {
  margin-top: 10px;
  animation: none;
}

.site-banner.leaving {
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.25s, transform 0.25s;
}

.site-banner-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

.site-banner-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.site-banner-text span {
  opacity: 0.85;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.site-banner-close {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  padding: 4px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.08);
  color: inherit;
}

.site-banner-close .svg {
  width: 14px;
  height: 14px;
}

@keyframes adm-drop {
  from {
    opacity: 0;
    transform: translateY(-14px) scale(0.97);
  }
}

/* --- finestre di dialogo con campi --------------------------------------------------------- */

.form-dialog {
  width: min(380px, calc(100vw - 32px));
  text-align: left;
}

.form-dialog.wide {
  width: min(520px, calc(100vw - 32px));
}

.form-dialog h3 {
  margin: 0 0 6px;
  text-align: center;
}

.form-dialog > p {
  margin: 0 0 12px;
  color: var(--text-2);
  font-size: 12.5px;
  text-align: center;
}

.form-dialog-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 600;
}

.form-dialog-row small {
  color: var(--text-2);
  font-weight: 400;
}

.form-dialog-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 13px;
}

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

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

/* --- struttura delle app admin ------------------------------------------------------------- */

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

.adm {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  background: var(--content-bg, var(--window-bg));
}

.adm-header {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  padding: 12px 16px;
  border-bottom: 0.5px solid var(--border);
  background: var(--toolbar-bg);
}

.adm-header-icon {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.2));
}

.adm-header-text {
  min-width: 140px;
}

.adm-header-text h2 {
  margin: 0;
  font-size: 15px;
}

.adm-header-text small {
  color: var(--text-2);
  font-size: 11.5px;
}

.adm-tools {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.adm-search {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 8px;
  border: 0.5px solid var(--btn-border);
  border-radius: 7px;
  background: var(--field-bg);
}

.adm-search .svg {
  width: 14px;
  height: 14px;
  color: var(--text-2);
}

.adm-search-input {
  width: 190px;
  border: 0;
  background: none;
  color: var(--text);
  outline: none;
  font-size: 12.5px;
}

.adm-select {
  width: auto;
  height: 28px;
  font-size: 12.5px;
}

.adm-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 16px;
}

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

.adm-spacer {
  flex: 1;
}

.adm-note {
  margin: 8px 0 0;
  color: var(--text-2);
  font-size: 12px;
}

.adm-note.danger {
  color: var(--danger);
}

.adm-empty {
  padding: 40px 16px;
}

/* --- indicatori ---------------------------------------------------------------------------- */

.adm-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.adm-kpis.small {
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
}

.adm-kpi {
  --tone: #0a84ff;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  border: 0;
  border-radius: 14px;
  background: var(--row-alt);
  box-shadow: inset 0 0 0 0.5px var(--border);
  color: var(--text);
  text-align: left;
  overflow: hidden;
  animation: hx-pop 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}

.adm-kpi::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--tone);
}

.adm-kpi.clickable {
  transition: transform 0.18s, box-shadow 0.18s;
}

.adm-kpi.clickable:hover {
  transform: translateY(-2px);
  box-shadow: inset 0 0 0 0.5px var(--border), 0 8px 18px rgba(0, 0, 0, 0.12);
}

.adm-kpi-label {
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 600;
}

.adm-kpi strong {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--tone);
}

.adm-kpis.small .adm-kpi strong {
  font-size: 19px;
}

.adm-kpi small {
  color: var(--text-2);
  font-size: 11px;
}

.tone-blue { --tone: #0a84ff; }
.tone-green { --tone: #28b44c; }
.tone-orange { --tone: #ff9500; }
.tone-red { --tone: #ff3b30; }
.tone-purple { --tone: #af52de; }
.tone-gray { --tone: #8e8e93; }

.adm-attention {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  padding: 10px;
  border-radius: 14px;
  background: rgba(255, 59, 48, 0.07);
}

.adm-attention .adm-kpi {
  flex: 0 1 200px;
}

.adm-attention-label {
  align-self: center;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #ff3b30;
}

.adm-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.adm-card {
  min-width: 0;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--window-bg);
  box-shadow: inset 0 0 0 0.5px var(--border), 0 1px 3px rgba(0, 0, 0, 0.05);
}

.adm-card > header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  margin-bottom: 10px;
}

.adm-card h3 {
  margin: 0;
  font-size: 13.5px;
}

.adm-card > header small {
  color: var(--text-2);
  font-size: 11.5px;
}

/* --- grafici ------------------------------------------------------------------------------- */

.adm-chart {
  display: block;
  width: 100%;
}

.adm-chart svg {
  display: block;
  width: 100%;
  height: 160px;
  overflow: visible;
}

.adm-chart text {
  fill: var(--text-2);
  font-size: 10px;
}

.adm-axis,
.adm-grid {
  stroke: var(--border);
  stroke-width: 1;
}

.adm-grid {
  stroke-dasharray: 3 4;
}

.adm-grid-label {
  font-size: 9px !important;
}

.adm-bar {
  transform-box: fill-box;
  transform-origin: bottom;
  animation: adm-grow 0.6s cubic-bezier(0.2, 0.8, 0.3, 1) both;
  animation-delay: calc(var(--i) * 12ms);
}

.adm-bar:hover {
  filter: brightness(1.2);
}

.adm-line {
  stroke-dasharray: 1;
  animation: adm-draw 1.2s cubic-bezier(0.6, 0, 0.3, 1) both;
}

.adm-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 6px;
  font-size: 12px;
}

.adm-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-2);
}

.adm-legend i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.adm-legend b {
  color: var(--text);
}

@keyframes adm-grow {
  from {
    transform: scaleY(0);
  }
}

@keyframes adm-draw {
  from {
    stroke-dashoffset: 1;
  }
}

.adm-heat {
  display: grid;
  grid-template-columns: 30px repeat(24, minmax(0, 1fr));
  gap: 2px;
  font-size: 9.5px;
  color: var(--text-2);
}

.adm-heat-h {
  text-align: center;
}

.adm-heat-d {
  align-self: center;
}

.adm-heat-c {
  aspect-ratio: 1;
  border-radius: 3px;
  background: rgba(10, 132, 255, calc(0.06 + var(--v) * 0.94));
  transition: transform 0.15s;
}

.adm-heat-c:hover {
  transform: scale(1.5);
  position: relative;
  z-index: 1;
}

.adm-hbars {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.adm-hbars li {
  animation: hx-pop 0.4s ease-out both;
  animation-delay: calc(var(--i) * 40ms);
}

.adm-hbars li.clickable {
  cursor: pointer;
}

.adm-hbars li.clickable:hover .adm-hbar-text span {
  color: var(--accent);
}

.adm-hbar-text {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
}

.adm-hbar-text span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.adm-hbars small {
  display: block;
  color: var(--text-2);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.adm-hbar-track {
  height: 6px;
  margin-top: 3px;
  border-radius: 3px;
  background: var(--row-alt);
  overflow: hidden;
}

.adm-hbar-track i {
  display: block;
  height: 100%;
  border-radius: 3px;
  animation: adm-fill 0.8s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}

@keyframes adm-fill {
  from {
    width: 0 !important;
  }
}

.adm-donut {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}

.adm-donut > .svg {
  width: 130px;
  height: 130px;
  flex-shrink: 0;
}

.adm-donut svg {
  width: 100%;
  height: 100%;
}

.adm-donut circle {
  transition: stroke-width 0.2s;
}

.adm-donut circle:hover {
  stroke-width: 22;
}

.adm-donut-n {
  fill: var(--text);
  font-size: 18px;
  font-weight: 700;
}

.adm-donut-l {
  fill: var(--text-2);
  font-size: 9px;
}

.adm-donut ul {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 12.5px;
}

.adm-donut li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.adm-donut li i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.adm-donut li b {
  margin-left: auto;
}

/* --- tabelle --------------------------------------------------------------------------------- */

.adm-table-wrap {
  overflow-x: auto;
}

.adm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.adm-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 7px 10px;
  border-bottom: 0.5px solid var(--border);
  background: var(--window-bg);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}

.adm-table td {
  padding: 8px 10px;
  border-bottom: 0.5px solid var(--border);
  vertical-align: middle;
}

.adm-table tbody tr {
  animation: fade 0.3s ease both;
  animation-delay: calc(var(--i) * 15ms);
}

.adm-table tr.clickable {
  cursor: pointer;
}

.adm-table tbody tr:hover {
  background: var(--hover);
}

.adm-table tr.selected,
.adm-table tr.active {
  background: rgba(10, 132, 255, 0.12);
}

.adm-table tr.muted td {
  opacity: 0.65;
}

.adm-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.adm-check {
  width: 28px;
}

.adm-row-actions > div {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.15s;
}

.adm-table tr:hover .adm-row-actions > div {
  opacity: 1;
}

.adm-row-actions .tool-btn {
  width: 26px;
  height: 26px;
}

.adm-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px 0 4px;
  color: var(--text-2);
  font-size: 12px;
}

.adm-person {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.adm-person small {
  color: var(--text-2);
}

.adm-doc {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 220px;
}

.adm-doc-icon {
  width: 26px;
  height: 32px;
  flex-shrink: 0;
}

.adm-doc > div {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.adm-doc small {
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 340px;
}

.adm-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 3px;
}

.adm-role,
.adm-pill {
  display: inline-flex;
  align-items: center;
  height: 19px;
  padding: 0 8px;
  border-radius: 10px;
  background: var(--row-alt);
  color: var(--text-2);
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
}

.role-owner,
.adm-pill.gold {
  background: rgba(255, 204, 0, 0.2);
  color: #a07800;
}

.role-admin,
.adm-pill.red {
  background: rgba(255, 59, 48, 0.14);
  color: #d70015;
}

.role-moderator,
.adm-pill.purple {
  background: rgba(175, 82, 222, 0.15);
  color: #8944ab;
}

.adm-pill.green {
  background: rgba(52, 199, 89, 0.15);
  color: #1d8a3a;
}

.adm-pill.orange {
  background: rgba(255, 149, 0, 0.16);
  color: #b25f00;
}

.adm-pill.gray {
  color: var(--text-2);
}

/* Tema scuro: data-theme="dark" lo imposta js/theme.js (sistema o scelta manuale) */
:root[data-theme="dark"] .role-owner,
:root[data-theme="dark"] .adm-pill.gold {
  color: #ffd60a;
}

:root[data-theme="dark"] .role-admin,
:root[data-theme="dark"] .adm-pill.red {
  color: #ff6961;
}

:root[data-theme="dark"] .role-moderator,
:root[data-theme="dark"] .adm-pill.purple {
  color: #da8fff;
}

:root[data-theme="dark"] .adm-pill.green {
  color: #30d158;
}

:root[data-theme="dark"] .adm-pill.orange {
  color: #ffb340;
}

/* --- azioni in blocco ------------------------------------------------------------------------ */

.adm-bulk {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: rgba(10, 132, 255, 0.1);
  border-bottom: 0.5px solid rgba(10, 132, 255, 0.3);
  font-size: 12.5px;
  animation: adm-drop 0.25s ease-out;
}

.adm-bulk strong {
  margin-right: 6px;
  color: var(--accent);
}

.adm-filter-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 16px;
  background: rgba(175, 82, 222, 0.1);
  font-size: 12.5px;
}

/* --- vista divisa (elenco + dettaglio) ------------------------------------------------------- */

.adm-split {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(320px, 1.1fr) minmax(320px, 1fr);
}

.adm-split-list,
.adm-split-col {
  min-height: 0;
  overflow: auto;
  border-right: 0.5px solid var(--border);
}

.adm-split-col {
  display: flex;
  flex-direction: column;
}

.adm-split-col > .adm-split-list {
  flex: 1;
  border-right: 0;
}

.adm-split-tools {
  padding: 10px 12px;
  border-bottom: 0.5px solid var(--border);
}

.adm-split-detail {
  min-height: 0;
  overflow: auto;
  padding: 18px;
}

@container (max-width: 760px) {
  .adm-split {
    grid-template-columns: 1fr;
  }
}

.adm {
  container-type: inline-size;
}

.adm-profile {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.adm-profile h2 {
  margin: 0;
  font-size: 18px;
}

.adm-profile a {
  color: var(--accent);
  font-size: 12.5px;
}

.adm-avatar {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, #5e5ce6, #bf5af2);
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(94, 92, 230, 0.35);
}

.adm-avatar.small {
  width: 32px;
  height: 32px;
  font-size: 13px;
  box-shadow: none;
}

.adm-banner {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 12.5px;
}

.adm-banner > .svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.adm-banner > div {
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: flex-start;
}

.adm-banner.red {
  background: rgba(255, 59, 48, 0.1);
  color: #d70015;
}

.adm-banner.green {
  background: rgba(52, 199, 89, 0.12);
  color: #1d8a3a;
}

.adm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 14px;
}

.adm-facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 5px 14px;
  margin: 0 0 14px;
  font-size: 12.5px;
}

.adm-facts dt {
  color: var(--text-2);
}

.adm-facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.adm-section {
  margin-top: 16px;
}

.adm-section h3 {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-2);
}

.adm-mini-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.adm-mini-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  padding: 7px 8px;
  border-radius: 8px;
  font-size: 12.5px;
}

.adm-mini-list li:hover {
  background: var(--hover);
}

.adm-mini-list li small {
  flex-basis: 100%;
  color: var(--text-2);
  font-size: 11px;
}

.adm-mini-list li p {
  flex-basis: 100%;
  margin: 0;
}

/* --- messaggi --------------------------------------------------------------------------------- */

.adm-thread-list {
  margin: 0;
  padding: 6px;
  list-style: none;
}

.adm-thread {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  padding: 10px 26px 10px 12px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--text);
  text-align: left;
}

.adm-thread:hover {
  background: var(--hover);
}

.adm-thread.active {
  background: rgba(10, 132, 255, 0.14);
}

.adm-thread.unread .adm-thread-subject {
  font-weight: 700;
}

.adm-thread-top {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
}

.adm-thread-top small,
.adm-thread-preview {
  color: var(--text-2);
  font-size: 11.5px;
}

.adm-thread-preview {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.adm-thread-subject {
  font-size: 13px;
}

.adm-conversation {
  display: flex;
  flex-direction: column;
  padding: 0;
}

.adm-conv-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 0.5px solid var(--border);
}

.adm-conv-head h3 {
  margin: 0 0 2px;
  font-size: 14px;
}

.adm-bubbles {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
}

.adm-bubble {
  max-width: 80%;
  padding: 9px 12px;
  border-radius: 16px;
  font-size: 13px;
  animation: hx-pop 0.3s ease-out both;
}

.adm-bubble p {
  margin: 0 0 4px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.adm-bubble small {
  opacity: 0.7;
  font-size: 10.5px;
}

.adm-bubble.in {
  align-self: flex-start;
  background: var(--row-alt);
  border-bottom-left-radius: 5px;
}

.adm-bubble.out {
  align-self: flex-end;
  background: linear-gradient(180deg, #2f8fff, #0a6cff);
  color: #fff;
  border-bottom-right-radius: 5px;
}

.adm-reply {
  flex-shrink: 0;
  padding: 10px 16px 14px;
  border-top: 0.5px solid var(--border);
}

.adm-reply-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
}

.adm-reply-actions small {
  color: var(--text-2);
  font-size: 11px;
}

.adm-ann-intro {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 0.5px solid var(--border);
}

.adm-ann-intro > div {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12.5px;
}

.adm-ann-intro span {
  color: var(--text-2);
}

.adm-ann-icon {
  width: 34px;
  height: 34px;
  padding: 7px;
  border-radius: 9px;
  background: linear-gradient(180deg, #ffcc4d, #ff9500);
  color: #fff;
}

.adm-ann-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.adm-ann {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--window-bg);
  box-shadow: inset 0 0 0 0.5px var(--border);
  border-left: 4px solid #ff9500;
  animation: hx-pop 0.4s ease-out both;
  animation-delay: calc(var(--i) * 40ms);
}

.adm-ann.important {
  border-left-color: #ff3b30;
}

.adm-ann.ended {
  opacity: 0.6;
  border-left-color: var(--border);
}

.adm-ann-head {
  display: flex;
  align-items: center;
  gap: 6px;
}

.adm-ann p {
  margin: 6px 0;
  font-size: 13px;
  white-space: pre-wrap;
}

.adm-ann small {
  color: var(--text-2);
  font-size: 11px;
}

/* --- ruoli --------------------------------------------------------------------------------- */

.adm-role-section {
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--window-bg);
  box-shadow: inset 0 0 0 0.5px var(--border);
}

.adm-role-section > header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
}

.adm-role-section > header > div {
  flex: 1;
}

.adm-role-section h3 {
  margin: 0 0 2px;
  font-size: 14px;
}

.adm-role-section header small {
  color: var(--text-2);
  font-size: 12px;
}

.adm-role-icon {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  padding: 7px;
  border-radius: 10px;
  color: #fff;
}

.adm-role-icon.gold {
  background: linear-gradient(180deg, #ffcf5c, #d18a00);
}

.adm-role-icon.red {
  background: linear-gradient(180deg, #ff6b6b, #c0262d);
}

.adm-role-icon.purple {
  background: linear-gradient(180deg, #c47cff, #6e3df5);
}

.adm-role-section ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.adm-role-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 4px;
  border-top: 0.5px solid var(--border);
}

.adm-role-info {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 8px;
  min-width: 0;
  font-size: 12.5px;
}

.adm-role-info small {
  color: var(--text-2);
}

.adm-role-note {
  font-style: italic;
}

.adm-role-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  color: var(--text-2);
  font-size: 11px;
}

/* --- registro ------------------------------------------------------------------------------- */

.adm-day h3 {
  position: sticky;
  top: -16px;
  z-index: 1;
  margin: 0 0 6px;
  padding: 8px 0;
  background: var(--content-bg, var(--window-bg));
  font-size: 12px;
  font-weight: 700;
  text-transform: capitalize;
  color: var(--text-2);
}

.adm-timeline {
  position: relative;
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
}

.adm-timeline::before {
  content: '';
  position: absolute;
  top: 6px;
  bottom: 6px;
  left: 15px;
  width: 2px;
  background: var(--border);
}

.adm-event {
  position: relative;
  display: flex;
  gap: 12px;
  padding: 6px 0;
  animation: hx-pop 0.35s ease-out both;
  animation-delay: calc(var(--i) * 20ms);
}

.adm-event-dot {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--tone);
  color: #fff;
  box-shadow: 0 0 0 3px var(--content-bg, var(--window-bg));
}

.adm-event-dot .svg {
  width: 15px;
  height: 15px;
}

.adm-event-body {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--window-bg);
  box-shadow: inset 0 0 0 0.5px var(--border);
}

.adm-event-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  font-size: 12.5px;
}

.adm-event-head small {
  margin-left: auto;
  color: var(--text-2);
}

.adm-event-body p {
  margin: 4px 0;
  font-size: 12.5px;
  overflow-wrap: anywhere;
}

.adm-event-body details summary {
  cursor: pointer;
  color: var(--accent);
  font-size: 11.5px;
}

.adm-event-body details > *:not(summary) {
  margin-top: 6px;
}

.adm-event-ip {
  display: block;
  color: var(--text-3, var(--text-2));
  font-size: 10.5px;
}

.adm-diff {
  border-collapse: collapse;
  font-size: 12px;
}

.adm-diff th,
.adm-diff td {
  padding: 4px 10px 4px 0;
  text-align: left;
  vertical-align: top;
}

.adm-diff th {
  color: var(--text-2);
  font-size: 11px;
}

.adm-diff .before {
  color: #d70015;
  text-decoration: line-through;
}

.adm-diff .after {
  color: #1d8a3a;
}

/* --- sistema -------------------------------------------------------------------------------- */

.adm-disk {
  position: relative;
  height: 22px;
  border-radius: 11px;
  background: var(--row-alt);
  overflow: hidden;
}

.adm-disk i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #30d158, #0a84ff);
  animation: adm-fill 1s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}

.adm-disk.warn i {
  background: linear-gradient(90deg, #ffcc00, #ff9500);
}

.adm-disk.danger i {
  background: linear-gradient(90deg, #ff9500, #ff3b30);
}

.adm-disk span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text);
  mix-blend-mode: difference;
  filter: invert(1);
}

.adm-status-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 12.5px;
}

.adm-status {
  display: flex;
  align-items: center;
  gap: 8px;
}

.adm-status i {
  width: 9px;
  height: 9px;
  flex-shrink: 0;
  border-radius: 50%;
  background: #30d158;
  box-shadow: 0 0 6px rgba(48, 209, 88, 0.6);
}

.adm-status.warn i {
  background: #ff9f0a;
  box-shadow: 0 0 6px rgba(255, 159, 10, 0.6);
}

/* --- impostazioni --------------------------------------------------------------------------- */

.adm-settings-group {
  margin-bottom: 16px;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--window-bg);
  box-shadow: inset 0 0 0 0.5px var(--border);
}

.adm-settings-group h3 {
  margin: 0 0 8px;
  font-size: 13.5px;
}

.adm-setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  border-top: 0.5px solid var(--border);
}

.adm-settings-group h3 + .adm-setting {
  border-top: 0;
}

.adm-setting > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
}

.adm-setting small {
  color: var(--text-2);
  font-size: 11.5px;
}

/* Interruttore in stile macOS */
.adm-switch {
  appearance: none;
  position: relative;
  width: 38px;
  height: 22px;
  flex-shrink: 0;
  margin: 0;
  border-radius: 11px;
  background: var(--row-alt);
  box-shadow: inset 0 0 0 0.5px var(--btn-border);
  cursor: pointer;
  transition: background 0.2s;
}

.adm-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: transform 0.22s cubic-bezier(0.3, 0.7, 0.4, 1.3);
}

.adm-switch:checked {
  background: #30d158;
}

.adm-switch:checked::after {
  transform: translateX(16px);
}

.adm-num-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  color: var(--text-2);
  font-size: 12px;
}

.adm-num {
  width: 90px;
  text-align: right;
}

.adm-radio {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  font-size: 13px;
}

.adm-radio > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.adm-radio small {
  color: var(--text-2);
  font-size: 11.5px;
}

.adm-invite {
  margin: 4px 0 0 24px;
}

.adm-invite small {
  color: var(--text-2);
  font-size: 11px;
}

.adm-settings-save {
  position: sticky;
  bottom: -16px;
  display: flex;
  justify-content: flex-end;
  padding: 12px 0;
  background: linear-gradient(transparent, var(--content-bg, var(--window-bg)) 40%);
}

/* --- Launchpad ------------------------------------------------------------------------------ */

.adm-launchpad {
  background:
    radial-gradient(80% 60% at 90% 0%, rgba(255, 69, 58, 0.18), transparent 70%),
    radial-gradient(70% 60% at 0% 100%, rgba(94, 92, 230, 0.18), transparent 70%),
    var(--window-bg);
}

.adm-lp-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px 6px;
}

.adm-lp-head h2 {
  margin: 0;
  font-size: 17px;
}

.adm-lp-head small {
  color: var(--text-2);
}

.adm-lp-icon {
  width: 40px;
  height: 40px;
}

.adm-lp-grid {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
  padding: 14px 18px 18px;
}

.adm-lp-app {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 8px;
  border: 0;
  border-radius: 14px;
  background: none;
  color: var(--text);
  text-align: center;
  animation: hx-pop 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
  animation-delay: calc(var(--i) * 40ms);
  transition: background 0.2s;
}

.adm-lp-app:hover {
  background: var(--hover);
}

.adm-lp-app-icon {
  width: 54px;
  height: 54px;
  margin-bottom: 4px;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.2));
  transition: transform 0.25s cubic-bezier(0.3, 0.7, 0.4, 1.4);
}

.adm-lp-app:hover .adm-lp-app-icon {
  transform: translateY(-4px) scale(1.06);
}

.adm-lp-app strong {
  font-size: 13px;
}

.adm-lp-app small {
  color: var(--text-2);
  font-size: 11px;
}

/* --- selettore di cartella ------------------------------------------------------------------- */

.adm-picker .field {
  margin-bottom: 8px;
}

.adm-picker-list {
  max-height: 300px;
  overflow: auto;
  margin: 0 0 10px;
  padding: 0;
  list-style: none;
}

.adm-picker-list button {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 7px 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text);
  text-align: left;
}

.adm-picker-list button:hover {
  background: var(--hover);
}

.adm-picker-list small,
.adm-picker-empty {
  color: var(--text-2);
  font-size: 11.5px;
}

.adm-picker-empty {
  padding: 10px;
  text-align: center;
}

/* --- "Scrivi all'associazione" (studenti) ---------------------------------------------------- */

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

.ct {
  display: flex;
  flex-direction: column;
  height: 100%;
  container-type: inline-size;
}

.ct-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 0.5px solid var(--border);
  background: var(--toolbar-bg);
}

.ct-head > div {
  flex: 1;
}

.ct-head h2 {
  margin: 0;
  font-size: 15px;
}

.ct-head small {
  color: var(--text-2);
  font-size: 11.5px;
}

.ct-icon {
  width: 36px;
  height: 36px;
}

.ct-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 260px 1fr;
}

.ct-list {
  overflow: auto;
  padding: 6px;
  border-right: 0.5px solid var(--border);
}

.ct-thread {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  padding: 10px 24px 10px 10px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--text);
  text-align: left;
}

.ct-thread:hover {
  background: var(--hover);
}

.ct-thread.active {
  background: rgba(10, 132, 255, 0.14);
}

.ct-thread.unread strong {
  font-weight: 800;
}

.ct-thread small,
.ct-meta {
  color: var(--text-2);
  font-size: 11.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ct-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.ct-empty {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 20px 12px;
  color: var(--text-2);
  font-size: 12.5px;
  text-align: center;
}

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

.ct-intro {
  margin: auto;
  padding: 24px;
  text-align: center;
  font-size: 13px;
}

.ct-intro-icon {
  display: inline-block;
  width: 64px;
  height: 64px;
  animation: hx-float 5s ease-in-out infinite;
}

.ct-intro ul {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
  margin: 0 0 14px;
  padding-left: 18px;
  color: var(--text-2);
  text-align: left;
}

.ct-conv-head {
  padding: 12px 16px;
  border-bottom: 0.5px solid var(--border);
}

.ct-conv-head h3 {
  margin: 0;
  font-size: 14px;
}

.ct-conv-head small {
  color: var(--text-2);
}

@container (max-width: 560px) {
  .ct-body {
    grid-template-columns: 1fr;
    grid-template-rows: 150px 1fr;
  }

  .ct-list {
    border-right: 0;
    border-bottom: 0.5px solid var(--border);
  }
}

/* --- account sospeso ------------------------------------------------------------------------ */

.suspended-card {
  max-width: 400px;
}

.suspended-reason {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 12px 0;
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(255, 59, 48, 0.25);
  text-align: center;
}

.suspended-card .btn {
  margin-top: 6px;
  border-color: rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  text-shadow: none;
}

.suspended-card .btn:hover {
  background: rgba(255, 255, 255, 0.32);
}

.lock-footer a {
  color: inherit;
}

.suspended-card a {
  color: #fff;
  font-weight: 700;
}

@media (prefers-reduced-motion: reduce) {
  .adm-bar,
  .adm-line,
  .adm-hbar-track i,
  .adm-disk i,
  .site-banner,
  .adm-kpi,
  .adm-event,
  .adm-feed-item,
  .adm-lp-app {
    animation: none;
  }
}

/* --- telefono -------------------------------------------------------------------------------- */

/* Il Finder su telefono nasconde i selettori a schede: nelle app admin servono (periodo, posta/annunci…). */
.adm-seg.segmented {
  display: inline-flex;
}

@media (max-width: 720px) {
  .adm-header {
    padding: 10px 12px;
  }

  .adm-tools {
    justify-content: flex-start;
  }

  .adm-search-input {
    width: 130px;
  }

  .adm-scroll {
    padding: 12px;
  }
}

@media (max-width: 720px) {
  .adm-heat {
    grid-template-columns: 26px repeat(24, minmax(0, 1fr));
    gap: 1px;
    font-size: 8px;
  }
}
