:root {
  --bg: #eef2f6;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #d7dee8;
  --accent: #0f766e;
  --accent-hover: #0d9488;
  --accent-soft: #ccfbf1;
  --danger: #b91c1c;
  --ok: #15803d;
  --sidebar-w: 264px;
  --sidebar-w-collapsed: 72px;
  --sidebar-bg: #0b1f2a;
  --sidebar-text: #c5d4de;
  --sidebar-active: #14b8a6;
  --topbar-h: 64px;
  --tab-h: 64px;
  --mobile-tab-bar-height: var(--tab-h);
  --radius: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  --font: "IBM Plex Sans", "Segoe UI", sans-serif;
  --font-display: "IBM Plex Sans Condensed", "IBM Plex Sans", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: var(--font); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.sx-icon {
  width: 1.15rem;
  height: 1.15rem;
  flex: 0 0 auto;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  overflow: visible;
}
.sx-icon--sm { width: 0.95rem; height: 0.95rem; }
.sx-icon--md { width: 1.35rem; height: 1.35rem; }
.sx-icon--lg { width: 1.65rem; height: 1.65rem; }
.sx-icon--xl { width: 1.9rem; height: 1.9rem; }

/* ——— Toggle platform (niente checkbox native visibili) ——— */
input[type="checkbox"] {
  appearance: none !important;
  -webkit-appearance: none !important;
  width: 2.55rem !important;
  max-width: 2.55rem !important;
  min-width: 2.55rem !important;
  height: 1.4rem !important;
  min-height: 0 !important;
  margin: 0;
  padding: 0 !important;
  border-radius: 999px !important;
  background: #cbd5e1 !important;
  border: 1px solid #94a3b8 !important;
  box-shadow: none !important;
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  box-sizing: border-box;
  vertical-align: middle;
  transition: background 0.15s ease, border-color 0.15s ease;
}
input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 0.16rem;
  width: 1.05rem;
  height: 1.05rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.25);
  transform: translateY(-50%);
  transition: left 0.15s ease;
  pointer-events: none;
}
input[type="checkbox"]:checked {
  background: var(--accent, #0f766e) !important;
  border-color: var(--accent, #0f766e) !important;
}
input[type="checkbox"]:checked::after {
  left: calc(100% - 1.22rem);
}
input[type="checkbox"]:focus-visible {
  outline: 2px solid #14b8a6;
  outline-offset: 2px;
}
input[type="checkbox"]:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Radio: non ereditare min-height/width 100% degli input testo */
input[type="radio"] {
  appearance: auto;
  -webkit-appearance: auto;
  width: 1.1rem !important;
  height: 1.1rem !important;
  min-width: 1.1rem !important;
  max-width: 1.1rem !important;
  min-height: 0 !important;
  margin: 0;
  padding: 0 !important;
  border: none !important;
  border-radius: 50% !important;
  background: transparent !important;
  box-shadow: none !important;
  accent-color: var(--accent, #0f766e);
  vertical-align: middle;
  cursor: pointer;
  flex-shrink: 0;
}
input[type="radio"]:focus-visible {
  outline: 2px solid #14b8a6;
  outline-offset: 2px;
}
input[type="radio"]:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.sx-toggle,
label.chk,
.sg-toggle,
.act-scheda__switch,
.saas-module-toggle {
  display: inline-flex !important;
  align-items: center;
  gap: 0.5rem;
  margin: 0.35rem 0;
  min-height: 2.5rem;
  cursor: pointer;
  user-select: none;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  text-transform: none !important;
  letter-spacing: 0 !important;
}
.sx-toggle__text,
.act-scheda__switch-txt {
  line-height: 1.3;
  color: var(--text);
}
.act-scheda__switch-input {
  /* resta checkbox: lo stile globale la rende toggle */
  position: static !important;
  opacity: 1 !important;
  width: 2.55rem !important;
  height: 1.4rem !important;
  min-width: 2.55rem !important;
  min-height: 0 !important;
  pointer-events: auto !important;
}
.act-scheda__switch-ui { display: none !important; }

/* ——— Shell StarGem (desktop-first) ——— */
.sx-app {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  transition: grid-template-columns 0.2s ease;
}

.sx-sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  width: var(--sidebar-w);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: linear-gradient(180deg, #0b1f2a 0%, #102a38 55%, #0b1f2a 100%);
  color: var(--sidebar-text);
  border-right: 1px solid #163445;
  padding: 1rem 0.85rem 1.5rem 0.75rem;
  z-index: 50;
  transition: width 0.2s ease, padding 0.2s ease;
}
/* Desktop: sidebar fissa — non scorre col contenuto principale */
@media (min-width: 961px) {
  .sx-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    height: 100dvh;
  }
  .sx-workspace {
    grid-column: 2;
  }
}
.sx-sidebar__brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.35rem 0.4rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 0.75rem;
}
.sx-sidebar__brand-text {
  min-width: 0;
  flex: 1 1 auto;
}
.sx-sidebar__mark {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  display: grid; place-items: center;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.12);
  flex: 0 0 auto;
}
.sx-sidebar__mark .sx-icon { width: 1.35rem; height: 1.35rem; }
.sx-sidebar__mark .sx-brand-logo {
  width: 34px;
  height: 34px;
  object-fit: contain;
  display: block;
}
.sx-sidebar__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.04em;
  color: #fff;
  text-transform: uppercase;
}
.sx-sidebar__tag { font-size: 0.72rem; color: #7f96a6; }
.sx-sidebar__brand-actions {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.sx-sidebar__pin,
.sx-sidebar__collapse {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  min-width: 36px;
  min-height: 36px;
  padding: 0.35rem;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  background: rgba(255,255,255,0.04);
  color: #9bb0be;
  cursor: pointer;
}
.sx-sidebar__pin:hover,
.sx-sidebar__collapse:hover {
  color: #fff;
  background: rgba(20, 184, 166, 0.18);
  border-color: rgba(20, 184, 166, 0.45);
}
.sx-sidebar__pin.is-pinned {
  color: #5eead4;
  background: rgba(20, 184, 166, 0.22);
  border-color: rgba(20, 184, 166, 0.55);
}
.sx-sidebar__pin .sx-icon {
  width: 1.05rem;
  height: 1.05rem;
}
.sx-sidebar__pin-label,
.sx-sidebar__collapse-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  display: none;
}
.sx-sidebar__collapse-ico {
  width: 0.45rem;
  height: 0.45rem;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.2s ease;
}

.sx-nav-group { margin: 0.55rem 0 0.85rem; }
.sx-nav-group--studio-gem {
  padding-top: 0.25rem;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.sx-nav-group--studio-gem-primary {
  border-top: none;
  padding-top: 0;
  margin-top: 0.15rem;
  margin-bottom: 0.65rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sx-nav-group--logout { margin-top: 0.35rem; }
.sx-nav-fold {
  margin: 0.35rem 0 0.45rem;
  padding: 0.1rem 0.15rem 0.3rem;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 10px;
  background: rgba(0,0,0,0.12);
}
.sx-nav-fold__summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 40px;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: none;
  color: var(--sidebar-text);
  user-select: none;
}
.sx-nav-fold__summary > span:not(.sx-nav-badge) {
  min-width: 0;
  flex: 1 1 auto;
}
.sx-nav-fold__summary::-webkit-details-marker { display: none; }
.sx-nav-fold__summary::after {
  content: "";
  width: 0.4rem;
  height: 0.4rem;
  border-right: 2px solid #8aa0b0;
  border-bottom: 2px solid #8aa0b0;
  transform: rotate(-45deg);
  flex-shrink: 0;
  margin-left: auto;
  opacity: 0.85;
  transition: transform 0.15s ease;
}
.sx-nav-fold[open] > .sx-nav-fold__summary::after {
  transform: rotate(45deg);
}
.sx-nav-fold__summary:hover {
  color: #fff;
  background: rgba(255,255,255,0.06);
}
.sx-nav-fold--nested {
  margin: 0.15rem 0.25rem 0.35rem;
  border-color: rgba(255,255,255,0.05);
  background: rgba(0,0,0,0.08);
}
.sx-nav-fold__summary--sub {
  text-transform: none;
  letter-spacing: 0.02em;
  font-size: 0.82rem;
  font-weight: 600;
  color: #b7c6d2;
  gap: 0.45rem;
  justify-content: flex-start;
}
.sx-nav-fold__summary--sub::after {
  margin-left: auto;
}
.sx-nav-fold__summary--sub .sx-icon {
  width: 1rem;
  height: 1rem;
  opacity: 0.9;
}
.sx-nav-link--sub {
  padding-left: 1.55rem !important;
  font-size: 0.8rem;
}
.sg-attivita-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 1rem;
}
.sg-attivita-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 999px;
  font-size: 0.78rem;
  text-decoration: none;
  color: inherit;
  background: var(--surface, #fff);
}
.sg-attivita-chip.is-active,
.sg-attivita-chip:hover {
  border-color: #94a3b8;
  background: #f8fafc;
}
.sg-attivita-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
}
.sg-attivita-card {
  display: block;
  padding: 0.85rem 0.9rem;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  background: var(--surface, #fff);
  min-height: 6.25rem;
}
.sg-attivita-card:hover {
  border-color: #94a3b8;
}
.sg-attivita-card__top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
}
.sg-attivita-card__metric {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.sg-attivita-card__n {
  font-size: 1.85rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: #0f172a;
}
.sg-attivita-card__unit {
  font-size: 0.72rem;
  color: #64748b;
}
.sg-attivita-card--hub_needed {
  background: #fffbeb;
}
.sg-attivita-card--stub {
  background: #f8fafc;
}
.sg-attivita-card--stub .sg-attivita-card__n {
  color: #94a3b8;
}

.sx-sg-brand {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  padding: 0.35rem 0.65rem 0.55rem;
  margin-bottom: 0.15rem;
  text-decoration: none !important;
  border-radius: 10px;
}
.sx-sg-brand:hover { background: rgba(255,255,255,0.05); }
.sx-sg-brand__logo {
  display: block;
  /* Stessa scala della brand StarGem in alto (mark 36px + scritta 1.15rem) */
  height: 36px;
  width: auto;
  max-width: calc(100% - 0.25rem);
  object-fit: contain;
  object-position: left center;
}
.sx-nav-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6d8494;
  padding: 0.35rem 0.65rem;
}
.sx-nav-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 40px;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  color: var(--sidebar-text);
  text-decoration: none !important;
  font-size: 0.92rem;
  font-weight: 500;
  position: relative;
  overflow: visible;
  z-index: 1;
}
.sx-nav-link > span:not(.sx-nav-badge) {
  min-width: 0;
  flex: 1 1 auto;
}
.sx-nav-link:hover { background: rgba(255,255,255,0.06); color: #fff; }
.sx-nav-link.active {
  background: rgba(20, 184, 166, 0.16);
  color: #5eead4;
  font-weight: 600;
}
.sx-nav-link.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  bottom: 7px;
  width: 3px;
  border-radius: 0 2px 2px 0;
  background: var(--sidebar-active);
}

/* Desktop: rail collassato (non in peek) */
@media (min-width: 961px) {
  .sx-app.sx-nav-collapsed {
    grid-template-columns: var(--sidebar-w-collapsed) 1fr;
  }
  .sx-app.sx-nav-collapsed .sx-sidebar {
    width: var(--sidebar-w-collapsed);
    padding: 0.85rem 0.45rem 1.25rem;
  }
  .sx-app.sx-nav-collapsed:not(.sx-nav-peek) .sx-sidebar__brand {
    flex-direction: column;
    align-items: center;
    gap: 0.45rem;
    padding: 0.25rem 0 0.85rem;
  }
  .sx-app.sx-nav-collapsed:not(.sx-nav-peek) .sx-sidebar__brand-text,
  .sx-app.sx-nav-collapsed:not(.sx-nav-peek) .sx-sidebar__pin,
  .sx-app.sx-nav-collapsed:not(.sx-nav-peek) .sx-sidebar__pin-label,
  .sx-app.sx-nav-collapsed:not(.sx-nav-peek) .sx-sidebar__collapse-label,
  .sx-app.sx-nav-collapsed:not(.sx-nav-peek) .sx-nav-label,
  .sx-app.sx-nav-collapsed:not(.sx-nav-peek) .sx-nav-link > span,
  .sx-app.sx-nav-collapsed:not(.sx-nav-peek) .sx-nav-badge,
  .sx-app.sx-nav-collapsed:not(.sx-nav-peek) .sx-nav-fold > .sx-nav-link,
  .sx-app.sx-nav-collapsed:not(.sx-nav-peek) .sx-nav-fold__summary > span,
  .sx-app.sx-nav-collapsed:not(.sx-nav-peek) .sx-sg-brand__logo {
    display: none !important;
  }
  .sx-app.sx-nav-collapsed:not(.sx-nav-peek) .sx-sg-brand {
    justify-content: center;
    padding: 0.35rem;
    margin-bottom: 0.35rem;
  }
  .sx-app.sx-nav-collapsed:not(.sx-nav-peek) .sx-sg-brand::after {
    content: "SG";
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    color: #5eead4;
  }
  .sx-app.sx-nav-collapsed:not(.sx-nav-peek) .sx-nav-link,
  .sx-app.sx-nav-collapsed:not(.sx-nav-peek) .sx-nav-fold__summary {
    justify-content: center;
    padding: 0.55rem 0.35rem;
    gap: 0;
  }
  .sx-app.sx-nav-collapsed:not(.sx-nav-peek) .sx-nav-fold {
    padding: 0.1rem;
    border-color: transparent;
    background: transparent;
  }
  .sx-app.sx-nav-collapsed:not(.sx-nav-peek) .sx-nav-fold__summary::after {
    display: none;
  }
  .sx-app.sx-nav-collapsed:not(.sx-nav-peek) .sx-nav-link--sub {
    padding-left: 0.35rem !important;
  }
  .sx-app.sx-nav-collapsed:not(.sx-nav-peek) .sx-sidebar__collapse-ico {
    transform: rotate(-135deg);
  }
  .sx-app.sx-nav-collapsed:not(.sx-nav-peek) .sx-nav-link.active::before {
    left: 2px;
  }
  .sx-app.sx-nav-collapsed:not(.sx-nav-peek) .sx-nav-group--studio-gem-primary {
    border-bottom-color: rgba(255,255,255,0.08);
  }

  /* Peek: overlay espanso sopra il contenuto, griglia resta compressa.
     Sidebar già position:fixed → allarga a destra senza reflow del workspace. */
  .sx-app.sx-nav-collapsed.sx-nav-peek .sx-sidebar {
    width: var(--sidebar-w);
    padding: 1rem 0.85rem 1.5rem;
    z-index: 60;
    box-shadow: 12px 0 28px rgba(0, 0, 0, 0.35);
    border-right: 1px solid rgba(255,255,255,0.08);
    /* Evita salto quando compare lo scrollbar con le label */
    scrollbar-gutter: stable;
  }
  .sx-app.sx-nav-collapsed.sx-nav-peek .sx-sidebar__brand {
    flex-direction: row;
    align-items: center;
    gap: 0.65rem;
    padding: 0.35rem 0.4rem 1rem;
  }
  .sx-app.sx-nav-collapsed.sx-nav-peek .sx-sidebar__collapse-ico {
    transform: rotate(45deg);
  }
}

@media (max-width: 960px) {
  .sx-sidebar__brand-actions { display: none; }
}

.sx-workspace { min-width: 0; display: flex; flex-direction: column; min-height: 100dvh; }
.sx-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 1.5rem;
  background: rgba(255,255,255,0.92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}
.sx-menu-btn {
  display: none;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 8px;
  width: 42px; height: 42px;
  align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text);
}
.sx-topbar__crumb {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}
.sx-topbar h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.sx-topbar__actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.sx-topbar-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.sx-topbar-icon-btn:hover,
.sx-topbar-icon-btn:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(15, 118, 110, 0.06);
  outline: none;
}
.sx-topbar-icon-btn .sx-icon {
  width: 1.25rem;
  height: 1.25rem;
}
.sx-topbar-icon-wrap {
  position: relative;
  z-index: 5;
}
.sx-topbar-badge,
.sx-chat-fab__badge,
.sx-chat-widget__count {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: #dc2626;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.25rem;
  text-align: center;
  box-shadow: 0 0 0 2px #fff;
  font-variant-numeric: tabular-nums;
  z-index: 6;
}
.sx-topbar-badge[hidden],
.sx-chat-fab__badge[hidden],
.sx-chat-widget__count[hidden] {
  display: none !important;
}
.sx-topbar-icon-btn {
  position: relative;
}
.sx-notif-panel {
  position: absolute;
  top: calc(100% + 0.45rem);
  right: 0;
  width: min(360px, calc(100vw - 1.5rem));
  max-height: min(70vh, 440px);
  display: none;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(11, 31, 42, 0.16);
  z-index: 90;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
}
.sx-notif-panel.is-open {
  display: flex;
}
.sx-notif-panel[hidden] {
  display: none !important;
}
.sx-notif-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
}
.sx-notif-panel__head strong {
  font-size: 0.95rem;
  color: var(--text);
}
.sx-notif-panel__mark {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.25rem 0;
  min-height: 44px;
}
.sx-notif-panel__mark:hover { text-decoration: underline; }
.sx-notif-panel__list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.sx-notif-panel__empty {
  padding: 1.25rem 1rem;
  color: var(--muted);
  font-size: 0.88rem;
  text-align: center;
}
.sx-notif-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  color: inherit;
  text-decoration: none;
  min-height: 44px;
}
.sx-notif-item:hover { background: rgba(15, 118, 110, 0.05); }
.sx-notif-item__icon {
  flex: 0 0 auto;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
}
.sx-notif-item__icon--chat { background: #ecfeff; color: #0e7490; }
.sx-notif-item__icon--agenda { background: #fef3c7; color: #b45309; }
.sx-notif-item__icon .sx-icon { width: 1.1rem; height: 1.1rem; }
.sx-notif-item__main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.sx-notif-item__top {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.72rem;
  color: var(--muted);
}
.sx-notif-item__kind {
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.sx-notif-item__main strong {
  font-size: 0.9rem;
  line-height: 1.25;
  color: var(--text);
}
.sx-notif-item__body {
  font-size: 0.82rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
  text-overflow: ellipsis;
}
.sx-notif-item__dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 0.35rem;
  flex: 0 0 auto;
}

.sx-chat-dock {
  position: fixed;
  right: 1.25rem;
  bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
  z-index: 70;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.75rem;
}
.sx-chat-dock.is-fullpage { display: none; }

/* —— Pausa Teo/Clary (menu tasto destro): solo companion, chat FAB resta —— */
html[data-sx-fab-paused] .sx-teo,
html[data-sx-fab-paused] .sx-teo[popover],
html[data-sx-fab-paused] .sx-clary,
html[data-sx-fab-paused] .sx-clary[popover] {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}
html[data-sx-fab-paused] {
  --sx-fab-teo-h: 0px;
}
.sx-fab-pause-menu {
  position: fixed;
  z-index: 10060;
  min-width: 11.5rem;
  padding: 0.35rem 0;
  border: 1px solid #d0d7e2;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(11, 31, 42, 0.18);
  color: #0f172a;
  font-size: 0.88rem;
  line-height: 1.25;
}
.sx-fab-pause-menu__title {
  padding: 0.4rem 0.85rem 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #64748b;
}
.sx-fab-pause-menu__item {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0.48rem 0.85rem;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.sx-fab-pause-menu__item:hover,
.sx-fab-pause-menu__item:focus-visible {
  background: #f1f5f9;
  outline: none;
}
.sx-fab-pause-menu__hint {
  margin-top: 0.2rem;
  padding: 0.45rem 0.85rem 0.4rem;
  border-top: 1px solid #e2e8f0;
  font-size: 0.72rem;
  line-height: 1.35;
  color: #64748b;
}

/* —— Teo + chat FAB: angoli di evasione (Teo “porta” la chat) —— */
html[data-sx-fab-zone="bl"] .sx-chat-dock {
  right: auto;
  left: 1.25rem;
  align-items: flex-start;
}
html[data-sx-fab-zone="tr"] .sx-chat-dock {
  top: calc(1.25rem + var(--sx-fab-teo-h, 96px) + 0.55rem + env(safe-area-inset-top, 0px));
  bottom: auto;
  right: 1.25rem;
}
html[data-sx-fab-zone="tl"] .sx-chat-dock {
  top: calc(1.25rem + var(--sx-fab-teo-h, 96px) + 0.55rem + env(safe-area-inset-top, 0px));
  bottom: auto;
  right: auto;
  left: 1.25rem;
  align-items: flex-start;
}
html[data-sx-fab-carrying] .sx-chat-dock,
html[data-sx-fab-carrying] .sx-teo,
html[data-sx-fab-carrying] .sx-teo[popover],
html[data-sx-fab-carrying] .sx-clary,
html[data-sx-fab-carrying] .sx-clary[popover] {
  will-change: transform;
  pointer-events: none;
}
/* Durante il volo: vignetta nascosta (resta l’inclinazione sull’container) */
html[data-sx-fab-carrying] .sx-teo-comic,
html[data-sx-fab-carrying] .sx-teo-comic[data-clary-bubble],
html[data-sx-fab-carrying] [data-teo-bubble],
html[data-sx-fab-carrying] [data-clary-bubble] {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}
html[data-sx-fab-carrying] .sx-teo__avatar {
  animation: sx-teo-carry-flight 1.8s cubic-bezier(0.28, 0.05, 0.18, 1);
}
html[data-sx-fab-carrying] .sx-chat-fab {
  box-shadow: 0 16px 36px rgba(11, 31, 42, 0.45);
  transition: box-shadow 0.35s ease;
}
@keyframes sx-teo-carry-flight {
  0% {
    filter: drop-shadow(0 6px 10px rgba(11, 31, 42, 0.18));
  }
  35% {
    filter: drop-shadow(0 18px 22px rgba(11, 31, 42, 0.32));
  }
  70% {
    filter: drop-shadow(0 12px 16px rgba(11, 31, 42, 0.24));
  }
  100% {
    filter: drop-shadow(0 6px 10px rgba(11, 31, 42, 0.18));
  }
}
@media (prefers-reduced-motion: reduce) {
  html[data-sx-fab-carrying] .sx-teo__avatar {
    animation: none;
  }
}

/* —— Teo (Hub SG) / Clary (CRM): sempre sopra modali / dialog (top-layer popover) —— */
.sx-teo,
.sx-teo[popover],
.sx-clary,
.sx-clary[popover] {
  position: fixed;
  right: 1.25rem;
  bottom: calc(1.25rem + 56px + 0.75rem + env(safe-area-inset-bottom, 0px));
  z-index: 10050;
  inset: auto 1.25rem calc(1.25rem + 56px + 0.75rem + env(safe-area-inset-bottom, 0px)) auto;
  margin: 0;
  border: 0;
  padding: 0;
  background: transparent;
  overflow: visible;
  width: max-content;
  max-width: min(320px, calc(100vw - 1.5rem));
  height: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.4rem;
  pointer-events: none;
  color: inherit;
}
.sx-teo::backdrop {
  display: none;
  background: none;
  pointer-events: none;
}
@media (max-width: 768px) {
  .sx-teo,
  .sx-teo[popover] {
    right: 1rem;
    bottom: calc(1rem + 56px + 0.65rem + env(safe-area-inset-bottom, 0px));
    inset: auto 1rem calc(1rem + 56px + 0.65rem + env(safe-area-inset-bottom, 0px)) auto;
  }
}
.sx-chat-dock.is-fullpage ~ .sx-teo,
body:has(.sx-chat-dock.is-fullpage) .sx-teo {
  /* in pagina chat full: Teo resta visibile in basso a destra */
  bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
  inset: auto 1.25rem calc(1.25rem + env(safe-area-inset-bottom, 0px)) auto;
}

/* Zone evasione Teo/Clary (sincronizzate con .sx-chat-dock via data-sx-fab-zone) */
html[data-sx-fab-zone="bl"] .sx-teo,
html[data-sx-fab-zone="bl"] .sx-teo[popover],
html[data-sx-fab-zone="bl"] .sx-clary,
html[data-sx-fab-zone="bl"] .sx-clary[popover] {
  right: auto;
  left: 1.25rem;
  inset: auto auto calc(1.25rem + 56px + 0.75rem + env(safe-area-inset-bottom, 0px)) 1.25rem;
  align-items: flex-start;
}
html[data-sx-fab-zone="tr"] .sx-teo,
html[data-sx-fab-zone="tr"] .sx-teo[popover],
html[data-sx-fab-zone="tr"] .sx-clary,
html[data-sx-fab-zone="tr"] .sx-clary[popover] {
  top: calc(1.25rem + env(safe-area-inset-top, 0px));
  right: 1.25rem;
  bottom: auto;
  left: auto;
  inset: calc(1.25rem + env(safe-area-inset-top, 0px)) 1.25rem auto auto;
}
html[data-sx-fab-zone="tl"] .sx-teo,
html[data-sx-fab-zone="tl"] .sx-teo[popover],
html[data-sx-fab-zone="tl"] .sx-clary,
html[data-sx-fab-zone="tl"] .sx-clary[popover] {
  top: calc(1.25rem + env(safe-area-inset-top, 0px));
  left: 1.25rem;
  right: auto;
  bottom: auto;
  inset: calc(1.25rem + env(safe-area-inset-top, 0px)) auto auto 1.25rem;
  align-items: flex-start;
}
html[data-sx-fab-zone="bl"] .sx-teo-comic__tail,
html[data-sx-fab-zone="tl"] .sx-teo-comic__tail {
  margin-right: 0;
  margin-left: 1.25rem;
  align-self: flex-start;
}

/* Posizione libera (evasione random su tutto il viewport) */
html[data-sx-fab-zone="xy"][data-sx-fab-align="start"] .sx-teo,
html[data-sx-fab-zone="xy"][data-sx-fab-align="start"] .sx-teo[popover],
html[data-sx-fab-zone="xy"][data-sx-fab-align="start"] .sx-clary,
html[data-sx-fab-zone="xy"][data-sx-fab-align="start"] .sx-clary[popover] {
  top: var(--sx-fab-top, 1.25rem);
  left: var(--sx-fab-left, 1.25rem);
  right: auto;
  bottom: auto;
  inset: var(--sx-fab-top, 1.25rem) auto auto var(--sx-fab-left, 1.25rem);
  align-items: flex-start;
}
html[data-sx-fab-zone="xy"][data-sx-fab-align="start"] .sx-chat-dock {
  top: calc(var(--sx-fab-top, 1.25rem) + var(--sx-fab-teo-h, 96px) + 0.55rem);
  left: var(--sx-fab-left, 1.25rem);
  right: auto;
  bottom: auto;
  align-items: flex-start;
}
html[data-sx-fab-zone="xy"][data-sx-fab-align="end"] .sx-teo,
html[data-sx-fab-zone="xy"][data-sx-fab-align="end"] .sx-teo[popover],
html[data-sx-fab-zone="xy"][data-sx-fab-align="end"] .sx-clary,
html[data-sx-fab-zone="xy"][data-sx-fab-align="end"] .sx-clary[popover] {
  top: var(--sx-fab-top, 1.25rem);
  right: calc(100vw - var(--sx-fab-left, 1.25rem) - var(--sx-fab-w, 96px));
  left: auto;
  bottom: auto;
  inset: var(--sx-fab-top, 1.25rem) calc(100vw - var(--sx-fab-left, 1.25rem) - var(--sx-fab-w, 96px)) auto auto;
  align-items: flex-end;
}
html[data-sx-fab-zone="xy"][data-sx-fab-align="end"] .sx-chat-dock {
  top: calc(var(--sx-fab-top, 1.25rem) + var(--sx-fab-teo-h, 96px) + 0.55rem);
  right: calc(100vw - var(--sx-fab-left, 1.25rem) - var(--sx-fab-w, 96px));
  left: auto;
  bottom: auto;
  align-items: flex-end;
}
html[data-sx-fab-zone="xy"][data-sx-fab-align="start"] .sx-teo-comic__tail {
  margin-right: 0;
  margin-left: 1.25rem;
  align-self: flex-start;
}

@media (max-width: 768px) {
  html[data-sx-fab-zone="bl"] .sx-teo,
  html[data-sx-fab-zone="bl"] .sx-teo[popover],
  html[data-sx-fab-zone="bl"] .sx-clary,
  html[data-sx-fab-zone="bl"] .sx-clary[popover] {
    left: 1rem;
    inset: auto auto calc(1rem + 56px + 0.65rem + env(safe-area-inset-bottom, 0px)) 1rem;
  }
  html[data-sx-fab-zone="bl"] .sx-chat-dock {
    left: 1rem;
  }
  html[data-sx-fab-zone="tl"] .sx-teo,
  html[data-sx-fab-zone="tl"] .sx-teo[popover],
  html[data-sx-fab-zone="tl"] .sx-clary,
  html[data-sx-fab-zone="tl"] .sx-clary[popover] {
    left: 1rem;
    inset: calc(1rem + env(safe-area-inset-top, 0px)) auto auto 1rem;
  }
  html[data-sx-fab-zone="tl"] .sx-chat-dock {
    left: 1rem;
  }
}
.sx-teo__avatar,
.sx-teo-comic,
.sx-teo-comic__dismiss {
  pointer-events: auto;
}
.sx-teo__avatar {
  position: relative;
  width: 80px;
  height: 96px;
  border: 0;
  padding: 0;
  border-radius: 0;
  background: transparent;
  cursor: pointer;
  box-shadow: none;
  overflow: visible;
  transition: transform 0.2s ease, filter 0.25s ease;
  filter: drop-shadow(0 6px 10px rgba(11, 31, 42, 0.18));
}
.sx-teo__avatar:hover,
.sx-teo__avatar:focus-visible {
  transform: translateY(-3px) scale(1.04);
  outline: none;
}
.sx-teo__ring {
  display: none;
}
.sx-teo--careful .sx-teo__avatar {
  filter: drop-shadow(0 6px 12px rgba(180, 100, 30, 0.28));
}
.sx-teo--think .sx-teo__avatar {
  filter: drop-shadow(0 6px 12px rgba(45, 90, 74, 0.28));
}
.sx-teo--cheer .sx-teo__avatar {
  filter: drop-shadow(0 6px 12px rgba(46, 140, 90, 0.28));
}
.sx-teo--help .sx-teo__avatar {
  filter: drop-shadow(0 6px 12px rgba(30, 90, 140, 0.26));
}
.sx-teo--error .sx-teo__avatar {
  filter: drop-shadow(0 0 14px rgba(255, 120, 40, 0.55)) drop-shadow(0 6px 12px rgba(180, 40, 20, 0.35));
}
.sx-teo--wow .sx-teo__avatar {
  filter: drop-shadow(0 0 12px rgba(250, 200, 60, 0.45)) drop-shadow(0 6px 12px rgba(46, 140, 90, 0.28));
}
.sx-teo--error .sx-teo-comic__who { color: #c2410c; }
.sx-teo--wow .sx-teo-comic__who { color: #ca8a04; }
.sx-teo--error .sx-teo-comic__balloon {
  background: linear-gradient(180deg, #fff 0%, #fff4ee 100%);
}
.sx-teo--wow .sx-teo-comic__balloon {
  background: linear-gradient(180deg, #fff 0%, #fffbeb 100%);
}
.sx-teo__pic,
.sx-teo__pic img {
  display: block;
  width: 80px;
  height: 96px;
  border-radius: 0;
  object-fit: contain;
  object-position: center bottom;
  background: transparent;
  transition: opacity 0.2s ease, transform 0.25s ease;
}
.sx-teo--swap .sx-teo__pic img {
  animation: sx-teo-swap 0.28s ease;
}
@keyframes sx-teo-swap {
  0% { opacity: 0.35; transform: translateY(4px) scale(0.96); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* Vignetta Teo: senza bordo, forma/dimensione dal testo */
.sx-teo-comic {
  position: relative;
  width: fit-content;
  max-width: min(280px, calc(100vw - 5rem));
  margin-right: 0.2rem;
  margin-left: auto;
  animation: sx-teo-pop 0.32s cubic-bezier(0.2, 0.9, 0.3, 1.15);
  filter: drop-shadow(0 8px 18px rgba(11, 31, 42, 0.16));
}
.sx-teo-comic.is-repop {
  animation: none;
}
.sx-teo-comic.is-repop {
  animation: sx-teo-pop 0.32s cubic-bezier(0.2, 0.9, 0.3, 1.15);
}
.sx-teo-comic__balloon {
  position: relative;
  width: fit-content;
  max-width: 100%;
  padding: 0.65rem 1.4rem 0.7rem 0.9rem;
  background: #fff;
  color: #142028;
  border: 0;
  outline: none;
  box-shadow: none;
  font-size: 0.84rem;
  line-height: 1.35;
  font-weight: 600;
  letter-spacing: 0.01em;
  display: block;
  z-index: 1;
  border-radius: 1.25rem;
}
/* Forme/ampiezze in base alla lunghezza testo */
.sx-teo-comic[data-shape="short"] .sx-teo-comic__balloon {
  border-radius: 1.5rem;
  padding: 0.55rem 1.25rem 0.6rem 0.85rem;
  max-width: 11rem;
}
.sx-teo-comic[data-shape="medium"] .sx-teo-comic__balloon {
  border-radius: 1.35rem 1.45rem 1.2rem 1.4rem;
  max-width: 15.5rem;
  padding: 0.65rem 1.35rem 0.7rem 0.9rem;
}
.sx-teo-comic[data-shape="long"] .sx-teo-comic__balloon {
  border-radius: 1.15rem 1.25rem 1.05rem 1.2rem;
  max-width: 17.5rem;
  padding: 0.7rem 1.4rem 0.75rem 0.95rem;
}
.sx-teo-comic[data-shape="xl"] .sx-teo-comic__balloon {
  border-radius: 1rem 1.1rem 0.95rem 1.05rem;
  max-width: 19rem;
  padding: 0.75rem 1.45rem 0.8rem 1rem;
}
/* Accento soft per mood (niente bordo) */
.sx-teo--careful .sx-teo-comic__balloon {
  background: linear-gradient(180deg, #fffefb 0%, #fff8ef 100%);
}
.sx-teo--think .sx-teo-comic__balloon {
  background: linear-gradient(180deg, #fff 0%, #f5f9ff 100%);
}
.sx-teo--cheer .sx-teo-comic__balloon {
  background: linear-gradient(180deg, #fff 0%, #f3fbf6 100%);
}
.sx-teo--help .sx-teo-comic__balloon {
  background: linear-gradient(180deg, #fff 0%, #f2fbfa 100%);
}
.sx-teo-comic__who {
  display: block;
  font-family: "IBM Plex Sans Condensed", "IBM Plex Sans", sans-serif;
  font-weight: 700;
  font-size: 0.66rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #2d5a4a;
  margin: 0 0 0.2rem;
}
.sx-teo--careful .sx-teo-comic__who { color: #a85a18; }
.sx-teo--cheer .sx-teo-comic__who { color: #1f7a4d; }
.sx-teo--think .sx-teo-comic__who { color: #1d4ed8; }
.sx-teo--help .sx-teo-comic__who { color: #0f766e; }
.sx-teo-comic__line {
  margin: 0;
  font-weight: 600;
  text-wrap: pretty;
  overflow-wrap: anywhere;
  color: #142028;
}
.sx-teo-comic__dismiss {
  position: absolute;
  top: 0.2rem;
  right: 0.3rem;
  border: 0;
  background: transparent;
  color: #8a949e;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  min-width: 24px;
  min-height: 24px;
  border-radius: 50%;
  z-index: 2;
  font-weight: 600;
}
.sx-teo-comic__dismiss:hover {
  color: #0b1f2a;
  background: rgba(11, 31, 42, 0.06);
}
/* Coda bianca senza bordo, punta verso Teo */
.sx-teo-comic__tail {
  display: block;
  position: relative;
  width: 0;
  height: 0;
  margin: -1px 1.35rem 0 auto;
  border-left: 9px solid transparent;
  border-right: 8px solid transparent;
  border-top: 12px solid #fff;
}
.sx-teo-comic__tail::after {
  display: none;
}
.sx-teo-comic[data-shape="short"] .sx-teo-comic__tail { margin-right: 1.5rem; }
.sx-teo-comic[data-shape="medium"] .sx-teo-comic__tail { margin-right: 1.35rem; }
.sx-teo-comic[data-shape="long"] .sx-teo-comic__tail { margin-right: 1.15rem; }
.sx-teo-comic[data-shape="xl"] .sx-teo-comic__tail { margin-right: 1rem; }

@keyframes sx-teo-pop {
  from { opacity: 0; transform: translateY(10px) scale(0.92); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes sx-teo-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}
@keyframes sx-teo-nod {
  0%, 100% { transform: rotate(0deg); }
  30% { transform: rotate(-6deg); }
  60% { transform: rotate(4deg); }
}
@keyframes sx-teo-wave {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(5deg) translateY(-2px); }
  50% { transform: rotate(-4deg); }
  75% { transform: rotate(3deg) translateY(-1px); }
}
@keyframes sx-teo-bounce {
  0%, 100% { transform: translateY(0) scale(1); }
  40% { transform: translateY(-7px) scale(1.05); }
  70% { transform: translateY(-2px) scale(1.02); }
}
@keyframes sx-teo-rage {
  0%, 100% { transform: translate(0, 0) rotate(0deg) scale(1); }
  20% { transform: translate(-2px, -3px) rotate(-4deg) scale(1.06); }
  40% { transform: translate(3px, -1px) rotate(5deg) scale(1.08); }
  60% { transform: translate(-2px, 2px) rotate(-3deg) scale(1.05); }
  80% { transform: translate(2px, -2px) rotate(3deg) scale(1.07); }
}
@keyframes sx-teo-wow {
  0%, 100% { transform: translateY(0) scale(1) rotate(0deg); }
  25% { transform: translateY(-10px) scale(1.12) rotate(-4deg); }
  50% { transform: translateY(-4px) scale(1.08) rotate(3deg); }
  75% { transform: translateY(-8px) scale(1.1) rotate(-2deg); }
}
.sx-teo--anim-bob .sx-teo__avatar {
  animation: sx-teo-bob 2.8s ease-in-out infinite;
}
.sx-teo--anim-nod .sx-teo__avatar {
  animation: sx-teo-nod 2.2s ease-in-out infinite;
}
.sx-teo--anim-wave .sx-teo__avatar {
  animation: sx-teo-wave 2.6s ease-in-out infinite;
}
.sx-teo--anim-bounce .sx-teo__avatar {
  animation: sx-teo-bounce 1.1s ease-in-out 3;
}
.sx-teo--anim-rage .sx-teo__avatar {
  animation: sx-teo-rage 0.55s ease-in-out 5;
}
.sx-teo--anim-wow .sx-teo__avatar {
  animation: sx-teo-wow 0.9s ease-in-out 4;
}

/* Demo Goku: ?clary=goku — faccia error quasi a tutto schermo */
html.sx-clary-goku-demo {
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
}
.sx-clary.is-goku-demo,
.sx-clary[popover].is-goku-demo {
  inset: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  left: 0 !important;
  width: 100vw;
  max-width: none;
  height: 100dvh;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  z-index: 10090;
  pointer-events: auto;
  /* niente overlay scuro: solo Clary a tutto schermo sulla UI sotto */
  background: transparent;
}
.sx-clary.is-goku-demo .sx-clary-goku-exit {
  position: absolute;
  top: max(0.75rem, env(safe-area-inset-top, 0px));
  right: max(0.75rem, env(safe-area-inset-right, 0px));
  z-index: 2;
  min-height: 44px;
  padding: 0.55rem 0.95rem;
  border: 1px solid rgba(255, 220, 180, 0.45);
  border-radius: 10px;
  background: rgba(20, 10, 6, 0.72);
  color: #ffe8d4;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  pointer-events: auto;
}
.sx-clary.is-goku-demo .sx-clary-goku-exit:hover,
.sx-clary.is-goku-demo .sx-clary-goku-exit:focus-visible {
  background: rgba(60, 20, 8, 0.88);
  outline: none;
}
.sx-clary.is-goku-demo .sx-teo-comic {
  order: 1;
  max-width: min(440px, calc(100vw - 1.5rem));
  pointer-events: auto;
}
.sx-clary.is-goku-demo .sx-teo-comic__line {
  font-size: 1.05rem;
  line-height: 1.35;
}
.sx-clary.is-goku-demo .sx-teo__avatar {
  order: 2;
  width: min(82vmin, 92vw);
  height: min(82vmin, 92vw);
  max-width: none;
  max-height: none;
  filter:
    drop-shadow(0 0 28px rgba(255, 120, 40, 0.7))
    drop-shadow(0 12px 28px rgba(180, 40, 20, 0.45));
}
.sx-clary.is-goku-demo .sx-teo__pic,
.sx-clary.is-goku-demo .sx-teo__pic img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.sx-clary.is-goku-demo.sx-teo--anim-rage .sx-teo__avatar {
  animation: sx-teo-rage 0.55s ease-in-out infinite;
}
@media (max-width: 768px) {
  .sx-clary.is-goku-demo .sx-teo__avatar,
  .sx-clary.is-goku-demo .sx-teo__pic,
  .sx-clary.is-goku-demo .sx-teo__pic img {
    width: min(86vmin, 94vw);
    height: min(86vmin, 94vw);
  }
  .sx-clary.is-goku-demo .sx-teo-comic {
    max-width: min(320px, calc(100vw - 1.25rem));
  }
}

@media (prefers-reduced-motion: reduce) {
  .sx-teo__avatar,
  .sx-teo-comic {
    animation: none !important;
  }
}
@media (max-width: 768px) {
  .sx-teo__avatar,
  .sx-teo__pic,
  .sx-teo__pic img {
    width: 64px;
    height: 76px;
  }
  .sx-teo-comic {
    max-width: min(260px, calc(100vw - 4.5rem));
  }
  .sx-teo-comic__balloon {
    font-size: 0.8rem;
  }
}

.sx-chat-fab {
  position: relative;
  z-index: 71;
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #0b1f2a;
  color: #fff;
  box-shadow: 0 10px 28px rgba(11, 31, 42, 0.35);
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}
.sx-chat-fab:hover,
.sx-chat-fab:focus-visible {
  background: #123044;
  transform: translateY(-2px);
  outline: none;
  color: #fff;
}
.sx-chat-fab .sx-icon {
  width: 1.45rem;
  height: 1.45rem;
  position: relative;
  z-index: 1;
}
.sx-chat-fab__badge {
  top: -2px;
  right: -2px;
  z-index: 3;
  box-shadow: 0 0 0 2px #0b1f2a;
  pointer-events: none;
}
.sx-chat-fab__badge[hidden] {
  display: none !important;
}

/* Chiuso di default: display:flex non deve sovrascrivere [hidden] */
.sx-chat-widget {
  display: none;
  width: min(380px, calc(100vw - 1.5rem));
  height: min(520px, calc(100dvh - 6.5rem));
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 18px 48px rgba(11, 31, 42, 0.28);
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
}
.sx-chat-widget.is-open {
  display: flex;
}
.sx-chat-widget[hidden] {
  display: none !important;
}
.sx-user { font-size: 0.85rem; color: var(--muted); font-weight: 500; }
.sx-user--identity {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 40px;
  max-width: min(220px, 38vw);
  color: var(--text);
  font-weight: 600;
}
.sx-user__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 auto;
  background: #e8eef1;
  border: 1px solid var(--border);
}
.sx-user__name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sx-user--role {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 0.65rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font-weight: 650;
  font-size: 0.82rem;
}

.sx-tenant-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  max-width: min(220px, 42vw);
}
.sx-tenant-switch__label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.sx-tenant-switch__select {
  min-width: 0;
  max-width: 100%;
  min-height: 40px;
  padding: 0.35rem 1.75rem 0.35rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.sx-tenant-switch__select:hover,
.sx-tenant-switch__select:focus-visible {
  border-color: var(--accent);
  outline: none;
}
@media (max-width: 768px) {
  .sx-tenant-switch__label { display: none; }
  .sx-tenant-switch { max-width: min(160px, 38vw); }
}

.sx-address-wrap { position: relative; }
.sx-addr-suggest {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 45;
  margin: 0.15rem 0 0;
  padding: 0.25rem 0;
  list-style: none;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
  max-height: 220px;
  overflow: auto;
  display: none;
}
.sx-addr-suggest.is-open { display: block; }
.sx-addr-suggest button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.45rem 0.65rem;
  border: 0;
  background: transparent;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.sx-addr-suggest button:hover,
.sx-addr-suggest button:focus-visible {
  background: rgba(15, 118, 110, 0.08);
  outline: none;
}
.sx-addr-suggest button strong {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
}
.sx-addr-suggest button small {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.12rem;
}
.sx-login-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.1rem 0 0.85rem;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.sx-login-divider::before,
.sx-login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}
.sx-google-btn {
  min-height: 44px;
  font-weight: 600;
}

.sx-chat-widget__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 0.95rem;
  background: #0b1f2a;
  color: #fff;
}
.sx-chat-widget__titles {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.sx-chat-widget__titles strong {
  font-size: 0.98rem;
  line-height: 1.2;
}
.sx-chat-widget__back {
  border: 0;
  background: transparent;
  color: #99f6e4;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-align: left;
  min-height: 28px;
}
.sx-chat-widget__actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex: 0 0 auto;
}
.sx-chat-widget__full {
  color: #99f6e4;
  font-size: 0.72rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  padding: 0.35rem 0.45rem;
  border-radius: 6px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
}
.sx-chat-widget__full:hover { background: rgba(255,255,255,0.08); color: #fff; }
.sx-chat-widget__close {
  border: 0;
  background: rgba(255,255,255,0.1);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}
.sx-chat-widget__close:hover { background: rgba(255,255,255,0.18); }
.sx-chat-widget__body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #f7f8fa;
}
.sx-chat-widget__new-dm {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid var(--border, #e2e8f0);
  background: #f8fafc;
  flex-shrink: 0;
}
.sx-chat-widget__new-dm[hidden] { display: none !important; }
.sx-chat-widget__new-dm select {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 36px;
  font-size: 0.85rem;
}
.sx-chat-widget__body[hidden],
.sx-chat-widget__thread-pane[hidden],
.sx-chat-widget__back[hidden] {
  display: none !important;
}
.sx-chat-widget__threads {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1;
}
.sx-chat-widget__empty {
  padding: 1.25rem 1rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  text-align: center;
}
.sx-chat-widget__thread {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.75rem 0.9rem;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: #fff;
  text-align: left;
  cursor: pointer;
  min-height: 56px;
  position: relative;
}
.sx-chat-widget__thread:hover { background: #f0fdfa; }
.sx-chat-widget__avatar {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  background: #0f766e;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex: 0 0 auto;
}
.sx-chat-widget__thread-main {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.sx-chat-widget__thread-main strong {
  font-size: 0.9rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
  text-overflow: ellipsis;
}
.sx-chat-widget__preview {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
  text-overflow: ellipsis;
}
.sx-chat-widget__count {
  position: static;
  box-shadow: none;
  flex: 0 0 auto;
}
.sx-chat-widget__msgs {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.sx-chat-widget__bubble {
  align-self: flex-start;
  max-width: 88%;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px 12px 12px 4px;
  padding: 0.55rem 0.7rem;
}
.sx-chat-widget__bubble--mine {
  align-self: flex-end;
  background: #ccfbf1;
  border-color: #99f6e4;
  border-radius: 12px 12px 4px 12px;
}
.sx-chat-widget__who {
  font-size: 0.7rem;
  font-weight: 700;
  color: #0f766e;
  margin-bottom: 0.15rem;
}
.sx-chat-widget__text {
  font-size: 0.88rem;
  line-height: 1.35;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}
.sx-chat-widget__bubble time {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.68rem;
  color: var(--muted);
  text-align: right;
}
.sx-chat-widget__composer {
  display: flex;
  gap: 0.45rem;
  padding: 0.65rem;
  background: #fff;
  border-top: 1px solid var(--border);
  align-items: flex-end;
}
.sx-chat-widget__composer textarea {
  flex: 1;
  min-height: 40px;
  max-height: 96px;
  resize: none;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  font: inherit;
}
@media (max-width: 768px) {
  .sx-chat-dock {
    right: 0.85rem;
    bottom: calc(var(--tab-h) + 0.75rem + env(safe-area-inset-bottom, 0px));
  }
  .sx-chat-widget {
    width: min(100vw - 1rem, 400px);
    height: min(62dvh, 480px);
  }
}

.sx-main {
  padding: 1.25rem 1.5rem 2rem;
  width: 100%;
  max-width: 1280px;
}
.sx-sidebar-backdrop { display: none; }

/* Tab bar solo mobile */
.tabbar { display: none; }

@media (max-width: 960px) {
  .sx-app { grid-template-columns: 1fr; padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px)); }
  .sx-sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: min(86vw, 300px);
    transform: translateX(-105%);
    transition: transform 0.2s ease;
  }
  .sx-sidebar.is-open { transform: translateX(0); }
  .sx-menu-btn { display: inline-flex; }
  .sx-sidebar-backdrop:not([hidden]) {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 40;
  }
  .sx-main { padding: 1rem; max-width: none; }
  .tabbar {
    display: grid;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 40;
    height: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(255,255,255,0.97);
    border-top: 1px solid var(--border);
    grid-template-columns: repeat(5, 1fr);
  }
  .tabbar a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 600;
    text-decoration: none;
    min-height: var(--tab-h);
  }
  .tabbar a.active { color: var(--accent); }
  .tabbar .sx-icon { width: 1.25rem; height: 1.25rem; }
}

/* ——— Components ——— */
.flash-wrap { margin: 0 0 1rem; }
.flash {
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
}
.flash-success { background: #dcfce7; color: var(--ok); }
.flash-error { background: #fee2e2; color: var(--danger); }
.flash-info { background: #e0f2fe; color: #075985; }

/* Toast notifiche (flash Flask) — basso a destra */
.sx-toast-stack {
  position: fixed;
  right: max(0.85rem, env(safe-area-inset-right));
  bottom: max(0.85rem, env(safe-area-inset-bottom));
  z-index: 2600;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  width: min(22rem, calc(100vw - 1.5rem));
  pointer-events: none;
}
.sx-toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.85rem 0.9rem;
  border-radius: 12px;
  border: 1px solid var(--border, #e2e8f0);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.16);
  background: #fff;
  color: #0f172a;
  font-size: 0.9rem;
  line-height: 1.35;
  animation: sx-toast-in 0.28s ease-out;
}
.sx-toast.is-leaving {
  animation: sx-toast-out 0.28s ease-in forwards;
}
.sx-toast__msg {
  flex: 1 1 auto;
  min-width: 0;
}
.sx-toast__close {
  flex: 0 0 auto;
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  opacity: 0.55;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  min-width: 1.75rem;
  min-height: 1.75rem;
}
.sx-toast__close:hover { opacity: 0.95; }
.sx-toast--success {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #065f46;
}
.sx-toast--error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}
.sx-toast--info {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1e3a8a;
}
.sx-toast--admin {
  border-style: dashed;
  font-size: 0.82rem;
  opacity: 0.96;
}
.sg-tip {
  font-size: 0.85rem;
  color: var(--muted, #64748b);
}
@keyframes sx-toast-in {
  from { opacity: 0; transform: translateY(0.65rem) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes sx-toast-out {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(0.45rem) scale(0.98); }
}
@media (max-width: 768px) {
  .sx-toast-stack {
    bottom: calc(var(--mobile-tab-bar-height, 3.75rem) + 0.65rem + env(safe-area-inset-bottom));
    right: max(0.65rem, env(safe-area-inset-right));
    left: max(0.65rem, env(safe-area-inset-left));
    width: auto;
  }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}
.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
}
.panel__head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
}
.panel__body { padding: 1rem; }

/* legacy card alias */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
  margin-bottom: 0.85rem;
}
.card h2, .card h3 { margin: 0 0 0.65rem; font-size: 1rem; }

/* —— Today to-do (dashboard) —— */
.today-todo {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 0.85rem 0.95rem 0.95rem;
  margin-bottom: 1rem;
  scroll-margin-top: calc(var(--topbar-h) + 0.75rem);
}
.today-todo__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem 0.75rem;
  margin-bottom: 0.55rem;
}
.today-todo__eyebrow {
  margin: 0 0 0.1rem;
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #94a3b8;
}
.today-todo__title {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.2;
}
.today-todo__title .sx-icon { width: 1.05rem; height: 1.05rem; }
.today-todo__sub { margin: 0.2rem 0 0; font-size: 0.82rem; }
.today-todo__head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
}
.today-todo__head-actions .btn {
  min-height: 34px;
  padding: 0.3rem 0.65rem;
  font-size: 0.8rem;
}
.today-todo__stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}
.today-todo__stat {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  padding: 0.4rem 0.55rem;
}
.today-todo__stat.is-warn {
  background: #fff7ed;
  border-color: #fed7aa;
}
.today-todo__stat-n {
  display: block;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 750;
  color: var(--accent);
  line-height: 1.05;
}
.today-todo__stat.is-warn .today-todo__stat-n { color: #c2410c; }
.today-todo__stat-l {
  font-size: 0.68rem;
  color: var(--muted);
  font-weight: 600;
}
.today-todo__cols {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
}
.today-todo__panel {
  min-width: 0;
  border: 1px solid #e8eef4;
  border-radius: 10px;
  background: #fff;
  padding: 0.45rem 0.5rem 0.5rem;
}
.today-todo__panel h3 {
  margin: 0 0 0.3rem;
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
}
.today-todo__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.today-todo__item {
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
  padding: 0.22rem 0.2rem;
  border-radius: 6px;
  min-height: 0;
}
.today-todo__item:hover { background: #f8fafc; }
.today-todo__item--overdue .today-todo__link { color: #c2410c; }
.today-todo__check { margin: 0; flex: 0 0 auto; }
.today-todo__check button {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.72rem;
  cursor: pointer;
  line-height: 1;
  padding: 0;
}
.today-todo__check button:hover {
  background: #ecfdf5;
  border-color: #99f6e4;
}
.today-todo__main { min-width: 0; flex: 1; }
.today-todo__link {
  display: block;
  font-weight: 650;
  font-size: 0.8rem;
  line-height: 1.25;
  color: var(--text);
  text-decoration: none !important;
  white-space: nowrap;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
  text-overflow: ellipsis;
}
.today-todo__link:hover { color: var(--accent); }
.today-todo__meta {
  margin-top: 0.05rem;
  font-size: 0.68rem;
  line-height: 1.25;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.15rem 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
  text-overflow: ellipsis;
}
.today-todo__prio {
  display: inline-flex;
  padding: 0.02rem 0.3rem;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: #f1f5f9;
  color: #64748b;
}
.today-todo__prio--alta,
.today-todo__prio--urgente {
  background: #ffedd5;
  color: #c2410c;
}
.today-todo__prio--bassa {
  background: #f8fafc;
  color: #94a3b8;
}
.today-todo__empty {
  padding: 0.35rem 0.15rem;
  font-size: 0.76rem;
}
.today-todo__more {
  padding: 0.2rem 0.15rem 0.05rem;
  font-size: 0.72rem;
}
.today-todo__more a {
  font-weight: 650;
  color: var(--accent);
  text-decoration: none;
}
.today-todo__more a:hover { text-decoration: underline; }

/* Dashboard: ancora più compatto */
.today-todo--compact {
  padding: 0.65rem 0.75rem 0.7rem;
  margin-bottom: 0.85rem;
  border-radius: 12px;
}
.today-todo--compact .today-todo__head { margin-bottom: 0.4rem; }
.today-todo--compact .today-todo__eyebrow { display: none; }
.today-todo--compact .today-todo__title { font-size: 1.02rem; }
.today-todo--compact .today-todo__stats { margin-bottom: 0.4rem; gap: 0.3rem; }
.today-todo--compact .today-todo__stat { padding: 0.3rem 0.45rem; border-radius: 8px; }
.today-todo--compact .today-todo__stat-n { font-size: 1.05rem; }
.today-todo--compact .today-todo__stat-l { font-size: 0.64rem; }
.today-todo--compact .today-todo__cols { gap: 0.35rem; }
.today-todo--compact .today-todo__panel { padding: 0.35rem 0.4rem 0.4rem; border-radius: 8px; }
.today-todo--compact .today-todo__panel h3 { margin-bottom: 0.2rem; font-size: 0.64rem; }
.today-todo--compact .today-todo__item { padding: 0.12rem 0.1rem; gap: 0.28rem; }
.today-todo--compact .today-todo__check button { width: 20px; height: 20px; font-size: 0.68rem; }
.today-todo--compact .today-todo__link { font-size: 0.76rem; }
.today-todo--compact .today-todo__meta { font-size: 0.64rem; }
.today-todo--compact .today-todo__empty { padding: 0.2rem 0.1rem; font-size: 0.72rem; }

@media (max-width: 960px) {
  .today-todo__cols { grid-template-columns: 1fr; }
  .today-todo__stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
  .today-todo__head-actions { width: 100%; }
  .today-todo__head-actions .btn { flex: 1 1 auto; justify-content: center; }
}

.grid-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
  margin-bottom: 1rem;
}
@media (max-width: 900px) {
  .grid-stats { grid-template-columns: repeat(2, 1fr); }
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
}
.stat .n {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.1;
}
.stat .l { font-size: 0.8rem; color: var(--muted); margin-top: 0.25rem; font-weight: 500; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 40px;
  padding: 0.5rem 0.95rem;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none !important;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: #fff; border-color: var(--border); color: var(--text); }
.btn-danger { background: #fff; border-color: #fecaca; color: var(--danger); }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0 0 1rem; }

.workspace-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 1rem;
}
@media (max-width: 960px) {
  .workspace-grid { grid-template-columns: 1fr; }
}

.module-soon {
  border: 1px dashed #94a3b8;
  background: #f8fafc;
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  text-align: left;
}
.module-soon h2 {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-size: 1.35rem;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.module-soon p { margin: 0 0 0.75rem; color: var(--muted); max-width: 42rem; }
.module-soon .badge { margin-bottom: 0.75rem; }

label { display: block; font-size: 0.82rem; font-weight: 600; margin: 0.65rem 0 0.25rem; color: #334155; }
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="image"]):not([type="file"]):not([type="range"]),
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  font: inherit;
}
textarea { min-height: 100px; resize: vertical; }
.muted { color: var(--muted); font-size: 0.85rem; }
.form-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }

/* Modifica anagrafica cliente: stessa shell prj-scheda della scheda dettaglio */
.cli-scheda--edit .cli-anag-form {
  margin-bottom: 0;
  align-items: start;
  gap: 0.85rem 1rem;
}
.cli-anag-form {
  margin-bottom: 0;
  align-items: start;
  gap: 0.85rem 1rem;
}
.cli-anag-form > div {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.cli-anag-form label {
  margin: 0 0 0.3rem;
}
.cli-anag-form label.chk,
.cli-scheda__wa-opt {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0.65rem 0 0;
  font-weight: 500;
  min-height: 44px;
}
.cli-anag-form label.chk input,
.cli-scheda__wa-opt input {
  width: auto;
  min-height: 0;
  margin: 0;
}
.cli-anag-form textarea,
.cli-scheda--edit .prj-scheda__aside textarea {
  min-height: 5.5rem;
}
.cli-anag-form .sg-form-grid__full {
  grid-column: 1 / -1;
}
@media (max-width: 768px) {
  .cli-anag-form { grid-template-columns: 1fr; }
}

.list { list-style: none; margin: 0; padding: 0; }
.list li {
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 0;
}
.list li:last-child { border-bottom: none; }
.list a { color: var(--text); font-weight: 600; text-decoration: none; }
.list .meta { font-size: 0.8rem; color: var(--muted); margin-top: 0.2rem; }

.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  background: #e2e8f0;
  color: #334155;
}
.badge-ok { background: #dcfce7; color: var(--ok); }
.badge-warn { background: #fef3c7; color: #b45309; }
.badge-wa { background: #d1fae5; color: #047857; }
.badge-soon { background: #e2e8f0; color: #475569; }

.pipeline {
  display: grid;
  gap: 0.75rem;
}
.pipeline--simple {
  grid-template-columns: 1fr;
}
@media (min-width: 700px) {
  .pipeline--simple { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.pipeline-col {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.65rem;
  min-height: 120px;
  min-width: 0;
}
.pipeline-col h3 { margin: 0 0 0.5rem; font-size: 0.85rem; }
.pipe-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem;
  margin-bottom: 0.5rem;
  font-size: 0.88rem;
}
.pipe-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.45rem;
}
.pipe-card__actions form { margin: 0; }
.pipe-card__actions .btn { min-height: 36px; }
@media (max-width: 768px) {
  .pipe-card__actions .btn { min-height: 44px; }
}

.login-page {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(ellipse at top left, rgba(20,184,166,0.18), transparent 50%),
    linear-gradient(135deg, #0b1f2a 0%, #123044 45%, #0f766e 160%);
}
.login-card {
  width: min(100%, 420px);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 18px 40px rgba(0,0,0,0.18);
}
.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 0.35rem;
}
.login-brand__logo {
  width: min(220px, 72vw);
  height: auto;
  max-height: 120px;
  object-fit: contain;
  margin: 0 0 0.85rem;
  display: block;
}
.login-card .brand-hero {
  font-family: var(--font-display);
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin: 0 0 0.35rem;
  color: #0b1f2a;
  text-transform: uppercase;
}
.login-card .brand-tagline {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}
.sx-brand-logo {
  display: block;
  object-fit: contain;
  background: transparent;
}
.sx-topbar__crumb {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.sx-topbar__mark {
  width: 22px;
  height: 22px;
  object-fit: contain;
  flex: 0 0 auto;
}
.sx-user--tenant {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 44px;
}
.sx-user__ico {
  width: 18px;
  height: 18px;
  object-fit: contain;
  flex: 0 0 auto;
}
.sx-tenant-switch__select {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-weight: 650;
  padding: 0.35rem 0.6rem;
  min-height: 40px;
  outline: none;
}

.sx-tenant-switch__select:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.18);
}
.sx-inline-brand {
  width: 20px;
  height: 20px;
  object-fit: contain;
  display: inline-block;
  vertical-align: middle;
}
.sx-inline-brand.sx-brand-logo--head {
  width: 56px;
  height: auto;
  max-height: 28px;
}
.sx-page-title-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  min-height: 44px;
}
.sx-password-field {
  position: relative;
}
.sx-password-field input {
  width: 100%;
  padding-right: 2.85rem;
}
.sx-password-toggle {
  position: absolute;
  top: 50%;
  right: 0.2rem;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  min-height: 44px;
  min-width: 44px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #5a7080;
  cursor: pointer;
}
.sx-password-toggle:hover,
.sx-password-toggle:focus-visible {
  color: #0f766e;
  background: rgba(15, 118, 110, 0.08);
  outline: none;
}
.sx-password-toggle .sx-icon {
  width: 1.15rem;
  height: 1.15rem;
}
.sx-password-toggle__icon[hidden] {
  display: none !important;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}
.toolbar input, .toolbar select { flex: 1 1 140px; }

/* Shared Studio Gem list chrome: action pills + labeled filter band (Parametri / Programmazione) */
.sg-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 0.75rem;
}
.sg-actions .badge {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  background: #f1f5f9;
  color: #475569;
  font-weight: 650;
  font-size: 0.82rem;
  border: 1px solid #e2e8f0;
}
.sg-filter-bar,
.sg-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.55rem 0.65rem;
  margin: 0 0 0.85rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  background: #f8fafc;
}
.sg-filter-field {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  flex: 1 1 9.5rem;
  min-width: 8rem;
  margin: 0;
}
.sg-filter-field--wide {
  flex: 1 1 16rem;
}
.sg-filter-field--sm {
  flex: 0 1 6.5rem;
  min-width: 5.5rem;
}
.sg-filter-field--apply {
  flex: 0 0 auto;
  min-width: 0;
}
.sg-filter-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
  line-height: 1.2;
}
.sg-filter-control {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
  width: 100%;
}
.sg-filter-control select,
.sg-filter-control input[type="search"],
.sg-filter-control input[type="text"],
.sg-filter-control input[type="date"],
.sg-filter-control input[type="time"],
.sg-filter-bar > input[type="search"],
.sg-filter-bar > input[type="text"],
.sg-filter-bar > select,
.sg-filter-row > label > input,
.sg-filter-row > label > select {
  width: 100%;
  min-height: 40px;
  margin: 0;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #d0d7e2);
  border-radius: 8px;
  color: var(--text, #0f172a);
}
/* Search lens in filter/parametri/prog fields.
   padding-left needs !important: global input:not([type=…])×9 beats class selectors. */
.sg-filter-ico,
.sg-parametri__field-ico,
.sg-prog__field-ico {
  position: absolute;
  left: 0.72rem;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  height: 1.1rem;
  color: #64748b;
  opacity: 0.88;
  pointer-events: none;
  z-index: 1;
}
.sg-filter-ico .sx-icon,
.sg-parametri__field-ico .sx-icon,
.sg-prog__field-ico .sx-icon {
  width: 1.05rem;
  height: 1.05rem;
}
.sg-filter-control:has(.sg-filter-ico) input[type="search"],
.sg-filter-control:has(.sg-filter-ico) input[type="text"],
.sg-parametri__field-control:has(.sg-parametri__field-ico) input[type="search"],
.sg-parametri__field-control:has(.sg-parametri__field-ico) input[type="text"],
.sg-prog__field-control:has(.sg-prog__field-ico) select:not(.sg-select-search__native),
.sg-prog__field-control:has(.sg-prog__field-ico) .sg-select-search__control,
.sg-prog__field-control:has(.sg-prog__field-ico) input[type="search"],
.sg-filter-control:has(.sg-filter-ico) .sg-select-search__control,
.sg-parametri__field-control:has(.sg-parametri__field-ico) .sg-select-search__control {
  padding-left: 2.4rem !important;
}
.sg-filter-field--apply .btn,
.sg-filter-bar > .btn,
.sg-filter-row > .btn {
  min-height: 40px;
  min-width: 6.5rem;
}
.sg-filter-check {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 40px;
  font-size: 0.84rem;
  color: var(--text, #0f172a);
  white-space: nowrap;
}
@media (max-width: 720px) {
  .sg-filter-field,
  .sg-filter-field--wide,
  .sg-filter-field--sm {
    flex: 1 1 100%;
    max-width: none;
  }
  .sg-filter-field--apply {
    flex: 1 1 100%;
  }
  .sg-filter-field--apply .btn {
    width: 100%;
  }
}

.sx-page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.sx-page-head h1 {
  margin: 0 0 0.25rem;
  font-size: 1.35rem;
}
.sx-page-head .muted { margin: 0; }
.sx-page-head__actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
@media (max-width: 768px) {
  .sx-page-head__actions { width: 100%; }
  .sx-page-head__actions .btn {
    flex: 1 1 auto;
    min-height: 44px;
    justify-content: center;
  }
}

.sx-clienti-toolbar {
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.45rem;
}
.sx-clienti-toolbar > input,
.sx-clienti-toolbar > select {
  flex: 1 1 0;
  min-width: 0;
  min-height: 40px;
}
.sx-clienti-toolbar__q { flex: 1.6 1 0 !important; }
.sx-clienti-toolbar__citta { flex: 0.9 1 0 !important; max-width: 9rem; }
.sx-clienti-toolbar > .btn {
  flex: 0 0 auto;
  min-height: 40px;
  white-space: nowrap;
}
.sx-clienti-toolbar__reset { color: var(--muted); }
@media (max-width: 900px) {
  .sx-clienti-toolbar {
    flex-wrap: wrap;
  }
  .sx-clienti-toolbar__q { flex: 1 1 100% !important; }
  .sx-clienti-toolbar__citta { max-width: none; }
}
@media (max-width: 768px) {
  .sx-clienti-toolbar > input,
  .sx-clienti-toolbar > select,
  .sx-clienti-toolbar > .btn {
    min-height: 44px;
  }
}

.sx-th-sort a {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: inherit;
  text-decoration: none !important;
  white-space: nowrap;
}
.sx-th-sort a:hover { color: var(--accent, #0f766e); }
.sx-th-sort.is-sorted a { color: var(--accent, #0f766e); }
.sx-th-sort__ico {
  font-size: 0.75rem;
  opacity: 0.55;
  font-weight: 700;
}
.sx-th-sort.is-sorted .sx-th-sort__ico { opacity: 1; }

.rubrica-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
  font-size: 0.92rem;
}
.rubrica-table th,
.rubrica-table td {
  text-align: left;
  padding: 0.65rem 0.7rem;
  border-bottom: 1px solid var(--border, #e2e8f0);
  vertical-align: top;
}
.rubrica-table th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 700;
}
.rubrica-table a { color: var(--text); text-decoration: none; }
.rubrica-table a:hover { text-decoration: underline; }
.sx-anagrafica-name {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  max-width: 100%;
  text-decoration: none !important;
}
.sx-anagrafica-name strong {
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sx-anagrafica-name:hover strong { text-decoration: underline; }
.sx-anagrafica-table td { vertical-align: middle; }
.sx-anagrafica-table .badge { text-transform: capitalize; }
@media (max-width: 768px) {
  .rubrica-table { min-width: 480px; }
  .btn-row .btn { min-height: 44px; }
  .toolbar .btn { min-height: 44px; }
}

.completed { opacity: 0.55; text-decoration: line-through; }
code { font-size: 0.85em; background: #f1f5f9; padding: 0.1rem 0.3rem; border-radius: 4px; }

.quick-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}
@media (min-width: 700px) {
  .quick-links { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.quick-link {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  text-decoration: none !important;
  font-weight: 600;
  font-size: 0.9rem;
  min-height: 48px;
}
.quick-link:hover { border-color: #99f6e4; background: #f0fdfa; }
.quick-link .sx-icon { color: var(--accent); }
.quick-link small {
  display: block;
  font-weight: 500;
  color: var(--muted);
  font-size: 0.72rem;
}

/* ——— Studio Gem ——— */
.sg-dash-hero {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.25rem;
  justify-content: space-between;
  align-items: flex-start;
  margin: 0 0 1.1rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background:
    linear-gradient(135deg, #f0fdfa 0%, #fff 42%, #f8fafc 100%);
}
.sg-dash-hero__title {
  margin: 0 0 0.3rem;
  font-size: 1.35rem;
  font-weight: 800;
}
.sg-dash-hero__meta {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
  max-width: 36rem;
}
.sg-dash-hero__meta strong { color: var(--text); font-weight: 700; }
.sg-dash-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}
.sg-kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
  margin: 0 0 1.15rem;
}
@media (min-width: 700px) {
  .sg-kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.sg-kpi {
  display: block;
  min-width: 0;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  text-decoration: none !important;
  color: var(--text);
}
a.sg-kpi:hover {
  border-color: #5eead4;
  background: #f0fdfa;
}
.sg-kpi--static { cursor: default; }
.sg-kpi__k {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.sg-kpi__v {
  display: block;
  margin: 0.2rem 0 0.15rem;
  font-size: clamp(1.35rem, 3.2vw, 1.85rem);
  font-weight: 800;
  font-family: "IBM Plex Sans Condensed", "IBM Plex Sans", sans-serif;
  line-height: 1.15;
}
.sg-kpi__h {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.35;
}
.sg-home-section-title {
  margin: 0 0 0.65rem;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.sg-hub-macro {
  margin: 0.35rem 0 1.35rem;
}
.sg-hub-macro__desc {
  margin: -0.25rem 0 0.85rem;
  font-size: 0.88rem;
  line-height: 1.45;
  max-width: 52rem;
}
.sg-hub-macro__desc strong {
  color: var(--text, #0f172a);
  font-weight: 650;
}
.sg-home-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}
@media (min-width: 700px) {
  .sg-home-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.sg-home-tile {
  display: block;
  position: relative;
  padding: 1.05rem 1.15rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  text-decoration: none !important;
  color: var(--text);
  min-height: 110px;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.sg-home-tile:has(.sg-home-tile__ico) {
  padding-right: 3rem;
}
.sg-home-tile:hover {
  border-color: #99f6e4;
  background: #f0fdfa;
  box-shadow: 0 1px 0 rgba(15, 118, 110, 0.06);
}
.sg-home-tile--static { cursor: default; }
.sg-home-tile__ico {
  position: absolute;
  top: 1.05rem;
  right: 1.05rem;
  width: 1.55rem;
  height: 1.55rem;
  color: #94a3b8;
  pointer-events: none;
  transition: color 0.15s ease;
}
.sg-home-tile:hover .sg-home-tile__ico {
  color: #0f766e;
}
.sg-home-tile__k {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.sg-home-tile__v {
  display: block;
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0.3rem 0 0.35rem;
  font-family: "IBM Plex Sans Condensed", "IBM Plex Sans", sans-serif;
  line-height: 1.2;
}
.sg-home-tile__v--lg {
  font-size: 1.15rem;
}
.sg-home-tile__h {
  display: block;
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--muted);
}
.sg-home-tile__badge {
  margin-left: 0.35rem;
  vertical-align: middle;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.65rem;
  font-weight: 600;
}
.sg-home-tile--warn {
  background: #fffbeb;
}
.sg-home-tile--muted {
  background: #f8fafc;
}
.sg-home-tile--muted .sg-home-tile__v {
  color: #94a3b8;
}

/* Hub SGPanel — quadrotti dashboard */
.sg-hub-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr));
  gap: 0.75rem;
  margin: 0.85rem 0 1.25rem;
  align-items: stretch;
}
.sg-hub-tile {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  text-decoration: none !important;
  color: var(--text);
  min-height: 6.25rem;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.sg-hub-tile:hover {
  border-color: #99f6e4;
  background: #f0fdfa;
}
.sg-hub-tile--accent {
  border-color: #5eead4;
  background: #f0fdfa;
}
.sg-hub-tile__k {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.sg-hub-tile__v {
  font-size: 1.2rem;
  font-weight: 700;
  font-family: "IBM Plex Sans Condensed", "IBM Plex Sans", sans-serif;
  color: var(--text);
}
.sg-hub-tile__h {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.35;
  margin-top: auto;
}

/* App Health — diagnostica Hub */
.sg-health-dl {
  display: grid;
  gap: 0.55rem 1rem;
  margin: 0;
}
.sg-health-dl > div {
  display: grid;
  grid-template-columns: 10.5rem minmax(0, 1fr);
  gap: 0.35rem 0.75rem;
  align-items: baseline;
}
.sg-health-dl dt {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}
.sg-health-dl dd {
  margin: 0;
  font-size: 0.9rem;
  word-break: break-word;
}
.sg-health-err {
  color: #b91c1c;
  font-size: 0.85rem;
  line-height: 1.4;
}
.sg-health-pill {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 0.12rem 0.45rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: #f8fafc;
  color: var(--muted);
  vertical-align: middle;
}
.sg-health-pill--ok {
  border-color: #99f6e4;
  background: #f0fdfa;
  color: #0f766e;
}
.sg-health-pill--fail {
  border-color: #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}
.sg-health-pill--skip {
  border-color: #e2e8f0;
  background: #f8fafc;
  color: #64748b;
}
.sg-health-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}
.sg-health-item {
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}
.sg-health-item--ok { border-color: #99f6e4; }
.sg-health-item--fail { border-color: #fecaca; background: #fffbfb; }
.sg-health-item--skip { opacity: 0.92; }
.sg-health-item__top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.65rem;
}
.sg-health-item__label { font-size: 0.92rem; }
.sg-health-item__ms {
  margin-left: auto;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.sg-health-item__detail {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.4;
}
.sg-health-item__error {
  margin: 0.3rem 0 0;
  font-size: 0.82rem;
  color: #b91c1c;
  line-height: 1.4;
}

/* ——— Vista Lista / Schede elenchi ——— */
.sg-view-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.85rem;
  margin: 0 0 0.75rem;
}
.sg-view-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}
.sg-view-toggle__btn {
  appearance: none;
  border: 0;
  margin: 0;
  padding: 0.4rem 0.75rem;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  min-height: 36px;
}
.sg-view-toggle__btn + .sg-view-toggle__btn {
  border-left: 1px solid var(--border);
}
.sg-view-toggle__btn.is-active,
.sg-view-toggle__btn[aria-pressed="true"] {
  color: var(--text);
  background: #f0fdfa;
}
.sg-view-toggle__btn:hover {
  color: var(--text);
}
.sg-list-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
/* display:grid altrimenti vince sul [hidden] UA → lista + schede insieme */
.sg-list-cards[hidden],
[data-sg-view-panel][hidden] {
  display: none !important;
}
@media (min-width: 700px) {
  .sg-list-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1100px) {
  .sg-list-cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.sg-list-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
  padding: 0.9rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background:
    linear-gradient(160deg, #f0fdfa 0%, #fff 38%, #f8fafc 100%);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, background 0.15s ease;
}
a.sg-list-card:hover,
.sg-list-card:has(.sg-list-card__main:hover),
.sg-list-card:has(.sg-list-card__detail:hover) {
  border-color: #99f6e4;
  background: #f0fdfa;
}
.sg-list-card__main {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}
.sg-list-card__enroll {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.5rem;
  align-items: center;
  margin-top: 0.1rem;
}
.sg-list-card__posti {
  display: inline-flex;
  align-items: baseline;
  gap: 0.28rem;
  font-size: 0.72rem;
  font-weight: 650;
  color: #047857;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 999px;
  padding: 0.12rem 0.5rem;
}
.sg-list-card__posti strong {
  font-size: 0.82rem;
  color: #065f46;
}
.sg-list-card__dates {
  font-size: 0.82rem;
  color: var(--muted, #6b7280);
  font-weight: 550;
}
.sg-list-card__detail {
  align-self: flex-start;
  font-size: 0.78rem;
  font-weight: 650;
  color: #0f766e;
  text-decoration: none;
}
.sg-list-card__detail:hover {
  text-decoration: underline;
  color: #115e59;
}
.sg-list-card__k {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.sg-list-card__v {
  font-size: 0.95rem;
  font-weight: 750;
  line-height: 1.3;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.sg-list-card__row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.55rem;
  align-items: center;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.35;
}
.sg-list-card__row strong {
  color: var(--text);
  font-weight: 650;
}
.sg-list-card__foot {
  margin-top: auto;
  padding-top: 0.35rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}
.sg-list-card__avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid #e2e8f0;
  background: #e2e8f0;
}
.sg-list-card__head {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
}
.sg-list-card__head-text {
  min-width: 0;
  flex: 1;
}
.sg-list-cards__empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.sg-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 650;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #e2e8f0;
}
.sg-badge--src { background: #f5f3ff; color: #5b21b6; border-color: #ddd6fe; }
.sg-badge--woo { background: #fff7ed; color: #c2410c; border-color: #fed7aa; }
.sg-badge--both { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.sg-badge--f { background: #fdf2f8; color: #9d174d; border-color: #fbcfe8; }
.sg-badge--m { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.sg-badge--ok { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.sg-text-warn { color: #c2410c; }
.sg-badge--warn { background: #ffedd5; color: #c2410c; border-color: #fed7aa; }
.sg-badge--off { background: #f1f5f9; color: #64748b; border-color: #e2e8f0; }

.sg-scheda {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  align-items: start;
}
@media (min-width: 900px) {
  .sg-scheda { grid-template-columns: 240px minmax(0, 1fr); }
}
.sg-scheda__side {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.sg-scheda__id { display: flex; gap: 0.65rem; align-items: center; }
.sg-scheda__avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  background: #eff6ff;
  border: 2px solid #bfdbfe;
  color: #2563eb;
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
}
.sg-scheda__name {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.25;
}
.sg-scheda__aid {
  margin: 0.15rem 0 0;
  font-size: 0.68rem;
  font-family: ui-monospace, monospace;
  color: var(--muted);
  word-break: break-all;
}
.sg-scheda__pills { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.sg-scheda__hr {
  border: 0;
  border-top: 1px solid #e2e8f0;
  margin: 0;
}
.sg-scheda__section {
  margin: 0 0 0.35rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.sg-scheda__field { margin-bottom: 0.45rem; }
.sg-scheda__field a { color: #2563eb; word-break: break-all; font-size: 0.8rem; }
.sg-scheda__lbl {
  display: block;
  font-size: 0.65rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #94a3b8;
  margin-bottom: 0.1rem;
}
.sg-scheda__mono { font-family: ui-monospace, monospace; font-size: 0.75rem; }
.sg-scheda__warn { color: #d97706; font-weight: 650; font-size: 0.8rem; }
.sg-scheda__money { color: #047857; font-weight: 700; font-size: 0.9rem; }
.sg-scheda__main { min-width: 0; display: flex; flex-direction: column; gap: 1rem; }
.sg-panel {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  padding: 1rem 1.1rem;
}
.sg-panel__title {
  margin: 0 0 0.85rem;
  font-size: 0.95rem;
  font-family: "IBM Plex Sans Condensed", "IBM Plex Sans", sans-serif;
}
.sg-form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.65rem;
  margin-bottom: 0.65rem;
}
@media (min-width: 640px) {
  .sg-form-grid { grid-template-columns: 1fr 1fr; }
}
.sg-iscr-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  margin: 0;
}
.sg-iscr-edit {
  align-items: end;
}
.sg-iscr-edit input[type="number"] {
  max-width: 8.5rem;
  min-height: 2.5rem;
  margin: 0;
}
.sg-iscr-importo {
  max-width: 7rem;
}
.sg-iscr-inline select,
.sg-iscr-inline input {
  margin: 0;
  min-height: 2.5rem;
}
.sg-iscr-create {
  border: 1px solid #c7e0d8;
  border-radius: 10px;
  background: #f3fbf7;
  padding: 0.75rem 0.85rem 0.9rem;
}
.sg-iscr-create .sg-scheda-subblock__title {
  margin: 0 0 0.25rem;
}
.sg-iscr-create summary {
  cursor: pointer;
  list-style: none;
}
.sg-iscr-create__fields input[type="search"] {
  width: 100%;
}
.sg-enroll-quota-pick {
  margin: 0 0 0.35rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid #c7e0d8;
  border-radius: 12px;
  background: #f3fbf7;
}
.sg-enroll-quota-pick__title {
  display: block;
  font-weight: 650;
  margin-bottom: 0.35rem;
}
.sg-enroll-quota-pick label {
  font-weight: 650;
}
.sg-enroll-quota-pick select {
  width: 100%;
  margin-top: 0.25rem;
}
.sg-enroll-quota-template {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.sg-enroll-sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.sg-enroll-quota-groups {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.sg-enroll-quota-group {
  padding: 0.55rem 0.65rem;
  border: 1px solid #b7d6cb;
  border-radius: 10px;
  background: #fff;
}
.sg-enroll-quota-group__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 0.75rem;
  margin-bottom: 0.35rem;
}
.sg-enroll-quota-group__title {
  font-weight: 650;
  font-size: 0.9rem;
}
.sg-enroll-quota-group__meta {
  font-size: 0.78rem;
  color: var(--muted, #64748b);
}
.sg-enroll-quota-group__search {
  width: 100%;
  min-height: 40px;
  margin: 0;
  padding: 0.4rem 0.65rem;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  font-size: 0.9rem;
}
.sg-enroll-quota-group__search-wrap {
  position: relative;
  margin: 0 0 0.35rem;
}
.sg-enroll-quota-group__search-wrap .sg-enroll-suggest {
  z-index: 30;
}
.sg-enroll-quota-group select {
  width: 100%;
  min-height: 44px;
}
.sg-enroll-picked {
  list-style: none;
  margin: 0.55rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.sg-enroll-picked__item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.55rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  background: #fff;
  min-height: 44px;
}
.sg-enroll-picked__body {
  min-width: 0;
  flex: 1 1 auto;
}
.sg-enroll-picked__body strong {
  display: block;
  font-size: 0.9rem;
  line-height: 1.25;
}
.sg-enroll-picked__meta {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.78rem;
  color: var(--muted, #64748b);
}
.sg-enroll-picked__rm {
  flex: 0 0 auto;
  min-height: 44px;
  min-width: 44px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  background: #f8fafc;
  color: #64748b;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}
.sg-enroll-picked__rm:hover {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fecaca;
}
.sg-enroll__minor-bar,
.sg-enroll__options-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 1rem;
  margin: 0 0 0.95rem;
  padding: 0.8rem 1rem;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  background: #fff;
}
.sg-enroll__minor-hint {
  margin: 0;
  font-size: 0.82rem;
  flex: 1 1 12rem;
  color: var(--muted, #64748b);
}
.sg-enroll-minor-toggle,
.sg-enroll-wa-toggle {
  font-weight: 650;
}
.sg-enroll__search-block {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.sg-enroll__anag-grid {
  align-items: start;
}
.sg-enroll__phone-wa {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.65rem 0.75rem;
  align-items: start;
}
@media (min-width: 640px) {
  .sg-enroll__phone-wa {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}
/* WhatsApp: stessa altezza/struttura di un campo form */
.sg-enroll__wa-cell {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  min-height: 0;
  justify-content: flex-start;
}
.sg-enroll__field-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted, #64748b);
}
.sg-enroll__field-hint {
  margin: 0.2rem 0 0;
  font-size: 0.75rem;
}
.sg-enroll__wa-cell .sg-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  box-sizing: border-box;
  min-height: 2.5rem;
  width: 100%;
  margin: 0;
  padding: 0 0.75rem;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  background: #fff;
}
.sg-enroll-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 0.85rem;
  padding: 0;
  border: none;
  background: transparent;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.sg-enroll-tabs__btn {
  flex: 0 0 auto;
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.15rem;
  margin: 0;
  padding: 0.35rem 0.9rem;
  border: 1px solid #d0d7e2;
  border-radius: 999px;
  background: #fff;
  box-shadow: none;
  color: #0f172a;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
  position: static;
  z-index: auto;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.sg-enroll-tabs__btn:first-child {
  margin-left: 0;
}
.sg-enroll-tabs__btn:hover {
  border-color: var(--accent, #0f766e);
  color: var(--accent, #0f766e);
  background: #fff;
  box-shadow: none;
  z-index: auto;
}
.sg-enroll-tabs__btn.is-active {
  color: #fff;
  font-weight: 600;
  background: var(--accent, #0f766e);
  border-color: var(--accent, #0f766e);
  border-bottom: 1px solid var(--accent, #0f766e);
  box-shadow: none;
  z-index: auto;
  padding: 0.35rem 0.9rem;
  margin-bottom: 0;
}
.sg-enroll-tabs__btn[hidden] {
  display: none !important;
}
.sg-enroll-panels {
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  background: #fff;
  padding: 1rem 1rem 0.5rem;
  margin-bottom: 1rem;
}
.sg-enroll-panels .sg-enroll__section {
  margin: 0 0 1rem;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
}
.sg-enroll-panel[hidden] {
  display: none !important;
}
.sg-enroll-panel.is-active {
  display: block;
}
@media (max-width: 768px) {
  .sg-enroll-tabs__btn {
    min-height: 2.35rem;
    padding: 0.4rem 0.85rem;
    font-size: 0.875rem;
  }
  .sg-enroll-panels {
    padding: 0.85rem 0.75rem 0.35rem;
  }
}


.sg-enroll__head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}
.sg-enroll__head--modal {
  margin-bottom: 0.75rem;
}
.sg-enroll__head--modal .sg-enroll__title {
  font-size: 1.15rem;
}
.entity-modal__body .sg-enroll {
  max-width: none;
}
.sg-enroll__title {
  margin: 0 0 0.35rem;
  font-size: 1.45rem;
}
.sg-enroll__lead {
  margin: 0;
  max-width: 38rem;
  font-size: 0.9rem;
}
.sg-enroll__section {
  margin: 0 0 1.1rem;
  padding: 1rem 1rem 1.05rem;
  border: 1px solid var(--border, #d8dde6);
  border-radius: 10px;
  background: var(--surface, #fff);
}
.sg-enroll__section-title {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
}
.sg-enroll__hint {
  margin: 0 0 0.75rem;
  font-size: 0.78rem;
}
.sg-enroll__lookup {
  margin-top: 0.65rem;
  font-size: 0.84rem;
  padding: 0.45rem 0.55rem;
  border-radius: 6px;
  background: rgba(45, 90, 74, 0.08);
}
.sg-enroll__pay summary {
  cursor: pointer;
  list-style: none;
}
.sg-enroll__footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.35rem;
  padding-bottom: 0.25rem;
}
.sg-enroll__footer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-left: auto;
  align-items: center;
}
.sg-enroll__ready-hint {
  margin: 0.15rem 0 0.5rem;
  font-size: 0.8rem;
  text-align: right;
}
.sg-enroll__ready-hint[hidden] {
  display: none !important;
}
.sg-form-grid--3 {
  grid-template-columns: 1fr;
}
.sg-form-grid__span2 {
  grid-column: 1 / -1;
}
@media (min-width: 640px) {
  .sg-form-grid--3 { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 900px) {
  .sg-form-grid--3 { grid-template-columns: 1fr 1fr 1fr; }
  .sg-form-grid--3 .sg-form-grid__span2 { grid-column: span 2; }
}
@media (max-width: 768px) {
  .sg-enroll__footer .btn,
  .sg-enroll__footer-actions .btn,
  .sg-enroll__actions-top .btn {
    min-height: 44px;
  }
  .sg-enroll__footer {
    flex-direction: column;
    align-items: stretch;
  }
  .sg-enroll__footer-actions {
    margin-left: 0;
    width: 100%;
  }
  .sg-enroll__footer-actions .btn {
    flex: 1 1 auto;
  }
  .sg-enroll__ready-hint {
    text-align: left;
  }
}
.sg-enroll-combobox {
  position: relative;
}
.sg-enroll-suggest {
  position: absolute;
  z-index: 40;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  max-height: 280px;
  overflow: auto;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #d8dde6);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(20, 28, 40, 0.12);
  padding: 0.35rem;
}
.sg-enroll-suggest__item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  cursor: pointer;
  min-height: 44px;
  font: inherit;
  color: inherit;
}
.sg-enroll-suggest__item:hover,
.sg-enroll-suggest__item:focus,
.sg-enroll-suggest__item.is-active {
  background: rgba(45, 90, 74, 0.08);
  outline: none;
}
.sg-enroll-suggest__item.is-full {
  opacity: 0.85;
}
.sg-enroll-suggest__item--create {
  font-weight: 600;
  color: #1f5c45;
  border-top: 1px solid var(--border, #d8dde6);
  margin-top: 0.25rem;
}
.sg-enroll__mode {
  margin-top: 0.4rem;
  font-size: 0.8rem;
}
.sg-enroll-smart {
  margin: 0.85rem 0 0.35rem;
  padding: 0.65rem 0.85rem 0.85rem;
  border: 1px solid var(--border, #d8dde6);
  border-radius: 12px;
  background: rgba(45, 90, 74, 0.04);
}
.sg-enroll-smart__summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  list-style: none;
}
.sg-enroll-smart__summary::-webkit-details-marker {
  display: none;
}
.sg-enroll-smart__teo,
.sg-enroll-smart__teo img {
  width: 40px;
  height: 44px;
  border-radius: 0;
  object-fit: contain;
  flex-shrink: 0;
  box-shadow: none;
  filter: drop-shadow(0 2px 6px rgba(11, 31, 42, 0.14));
  background: transparent;
}
.sg-enroll-smart__teo {
  display: inline-flex;
}
.sg-enroll-smart__hint {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
}
.sg-enroll-smart__days {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
  padding-top: 0.25rem;
}
.sg-enroll-smart__day {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-height: 40px;
  font-size: 0.88rem;
  cursor: pointer;
}
.sg-enroll-smart__day input {
  width: auto;
  min-height: auto;
}
.sg-enroll-smart__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin-top: 0.75rem;
}
.sg-enroll-smart__status {
  font-size: 0.82rem;
}
.sg-enroll-smart__reason {
  margin: 0.55rem 0 0;
  font-size: 0.8rem;
}
.sg-enroll-smart__results {
  list-style: none;
  margin: 0.65rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.sg-enroll-smart__item {
  margin: 0;
}
.sg-enroll-smart__pick {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  min-height: 44px;
  white-space: normal;
}
.sg-enroll-smart__meta {
  font-size: 0.78rem;
  margin-top: 0.2rem;
  padding-left: 0.15rem;
}
@media (max-width: 768px) {
  .sg-enroll-smart__actions .btn {
    width: 100%;
    min-height: 44px;
  }
  .sg-enroll-smart__days {
    gap: 0.25rem 0.5rem;
  }
}
.sg-enroll-snapshot {
  margin-top: 0.9rem;
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  background: rgba(45, 90, 74, 0.06);
  border: 1px solid rgba(45, 90, 74, 0.12);
}
.sg-enroll-snapshot__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.45rem 0.85rem;
  margin-bottom: 0.65rem;
}
@media (min-width: 640px) {
  .sg-enroll-snapshot__grid { grid-template-columns: 1fr 1fr 1fr; }
}
.sg-enroll-snapshot__k {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #5b6573;
}
.sg-enroll-corsi-list {
  margin: 0.35rem 0 0.65rem;
  padding-left: 1.1rem;
  font-size: 0.86rem;
}
.sg-enroll-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin: 0.55rem 0 0.35rem;
}
.sg-enroll-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  height: 1.85rem;
  min-height: 1.85rem;
  max-height: 1.85rem;
  padding: 0 0.65rem;
  margin: 0;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  background: #f8fafc;
  color: #475569;
  border: 1px solid var(--border, #e2e8f0);
}
.sg-enroll-chip--warn {
  background: #fdecea;
  color: #8a1f17;
  border-color: #f3c4bf;
}
.sg-enroll-chip--note {
  background: #fff6e5;
  color: #8a5a00;
  border-color: #f0d9a8;
}
.sg-enroll-avail {
  margin: 0.25rem 0;
  font-size: 0.86rem;
}
.sg-enroll-avail--full { color: #8a1f17; font-weight: 600; }
.sg-enroll-avail--low { color: #9a6700; }
.sg-enroll-avail--ok { color: #1f5c45; }
.sg-enroll-avail--mismatch { color: #8a5a00; font-weight: 600; }
.sg-enroll-avail--age { color: #8a5a00; font-weight: 600; }
.sg-enroll-warn {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 0.85rem;
  align-items: flex-start;
  margin-top: 0.55rem;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  border: 1px solid #f0d9a8;
  background: linear-gradient(180deg, #fffaf0 0%, #fff6e5 100%);
}
.sg-enroll-warn--age {
  border-color: #f0d9a8;
  background: linear-gradient(180deg, #fffaf0 0%, #fff6e5 100%);
}
.sg-enroll-warn--empty {
  border-color: #f3c4bf;
  background: linear-gradient(180deg, #fff8f7 0%, #fdecea 100%);
}
.sg-enroll-warn__icon {
  flex: 0 0 auto;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  background: #f0d9a8;
  color: #6b4500;
}
.sg-enroll-warn--empty .sg-enroll-warn__icon {
  background: #f3c4bf;
  color: #8a1f17;
}
.sg-enroll-warn__body {
  flex: 1 1 12rem;
  min-width: 0;
}
.sg-enroll-warn__title {
  margin: 0 0 0.2rem;
  font-size: 0.88rem;
  font-weight: 650;
  color: #5c3d00;
}
.sg-enroll-warn--empty .sg-enroll-warn__title { color: #8a1f17; }
.sg-enroll-warn__text {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.4;
  color: #5b4a2e;
}
.sg-enroll-warn--empty .sg-enroll-warn__text { color: #6b2e28; }
.sg-enroll-warn__btn {
  margin-left: auto;
  min-height: 44px;
}
.sg-enroll-full {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.sg-enroll-modal {
  border: none;
  border-radius: 12px;
  padding: 0;
  max-width: min(32rem, 94vw);
  width: 100%;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.22);
}
.sg-enroll-modal::backdrop {
  background: rgba(15, 23, 42, 0.45);
}
.sg-enroll-modal__panel {
  margin: 0;
  padding: 1rem 1.1rem 1.15rem;
}
.sg-enroll-modal__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}
.sg-enroll-modal__head h3 {
  margin: 0;
  font-size: 1.05rem;
}
.sg-enroll-alt-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.sg-enroll-alt-list .btn {
  width: 100%;
  justify-content: flex-start;
  min-height: 44px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.sg-tessera-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}
@media (min-width: 700px) {
  .sg-tessera-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.sg-tessera-cell {
  background: #f8fafc;
  border-radius: 8px;
  padding: 0.55rem 0.65rem;
}
.sg-tessera-cell label {
  font-size: 0.65rem;
  margin-bottom: 0.25rem;
}
.sg-tessera-cell input {
  margin: 0;
  background: transparent;
  border-color: transparent;
  padding-left: 0;
  font-weight: 600;
}
.sg-tessera-cell input:focus {
  border-color: var(--border);
  background: #fff;
  padding-left: 0.5rem;
}
.sg-tessera-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.65rem;
}
.sg-tessera-actions--main {
  margin: 0 0 0.75rem;
}
.sg-tessera-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  line-height: 1.2;
}
.sg-tessera-btn:hover:not(:disabled) {
  border-color: #94a3b8;
  background: #f8fafc;
}
.sg-tessera-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
a.sg-tessera-btn {
  color: inherit;
}
.sg-form-span {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.75rem;
  padding: 0.35rem 0 0.15rem;
}
.sg-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 2.5rem;
}
.sg-toggle input,
.sg-toggle input[type="checkbox"] {
  width: 2.55rem !important;
  max-width: 2.55rem !important;
  min-width: 2.55rem !important;
  height: 1.4rem !important;
  min-height: 0 !important;
  margin: 0;
  padding: 0 !important;
  appearance: none;
  -webkit-appearance: none;
  border-radius: 999px !important;
  background: #cbd5e1;
  border: 1px solid #94a3b8 !important;
  box-shadow: none !important;
  position: relative;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  flex-shrink: 0;
  box-sizing: border-box;
  vertical-align: middle;
}
.sg-toggle input::after,
.sg-toggle input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 0.16rem;
  width: 1.05rem;
  height: 1.05rem;
  margin-top: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.25);
  transform: translateY(-50%);
  transition: left 0.15s ease;
}
.sg-toggle input:checked,
.sg-toggle input[type="checkbox"]:checked {
  background: var(--accent, #0f766e);
  border-color: var(--accent, #0f766e);
}
.sg-toggle input:checked::after,
.sg-toggle input[type="checkbox"]:checked::after {
  left: calc(100% - 1.22rem);
  transform: translateY(-50%);
}
.sg-toggle:focus-within input {
  outline: 2px solid #14b8a6;
  outline-offset: 2px;
  box-shadow: none !important;
}
.sg-wa-attivo-field {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
  min-width: 0;
}
.sg-wa-attivo-field > label:first-child {
  margin: 0;
}
.sg-wa-attivo-field .sg-toggle {
  min-height: 0;
}
.sg-form-span--wa {
  align-items: flex-end;
}
.sg-wa-rules {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.sg-wa-rule {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  background: #f8fafc;
}
.sg-wa-rule__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}
.sg-mono { font-family: ui-monospace, monospace; text-transform: uppercase; }

/* ——— Bot WhatsApp: layout operativo compatto ——— */
.sg-wa-bot-page {
  max-width: 68rem;
  margin: 0 auto;
  padding-bottom: 1.25rem;
}
.sg-wa-bot-page__head {
  margin: 0 0 0.65rem;
}
.sg-wa-bot-page__head h1 {
  margin: 0 0 0.25rem;
  font-size: 1.28rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.sg-wa-bot-page__lead {
  margin: 0;
  max-width: 46rem;
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--muted, #64748b);
}
.sg-wa-bot-page__lead code {
  font-size: 0.8em;
}
.sg-wa-subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0 0 0.85rem;
  padding: 0.2rem 0 0.65rem;
  border-bottom: 1px solid var(--border, #e2e8f0);
}
.sg-wa-subnav__link {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.38rem 0.75rem;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted, #64748b);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  line-height: 1.2;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.sg-wa-subnav__link:hover {
  background: #f1f5f9;
  color: var(--text, #0f172a);
}
.sg-wa-subnav__link.is-active {
  background: color-mix(in srgb, var(--accent, #0f766e) 12%, #fff);
  border-color: color-mix(in srgb, var(--accent, #0f766e) 35%, #fff);
  color: var(--accent, #0f766e);
}
.sg-wa-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.55rem;
  margin: 0 0 0.85rem;
  padding: 0.55rem 0.75rem;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  box-shadow: var(--shadow);
}
.sg-wa-status__label {
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #94a3b8;
  margin-right: 0.15rem;
}
.sg-wa-status__chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  font-size: 0.78rem;
  color: var(--text, #0f172a);
  white-space: nowrap;
}
.sg-wa-status__chip strong {
  font-weight: 700;
}
.sg-wa-status__chip--ok strong { color: var(--ok, #15803d); }
.sg-wa-status__chip--warn strong { color: var(--warn, #b45309); }
.sg-wa-status__chip--err strong { color: var(--danger, #b91c1c); }
.sg-wa-status__actions {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.sg-wa-status__actions .btn {
  min-height: 2rem;
  padding: 0.28rem 0.65rem;
  font-size: 0.78rem;
}
.sg-wa-bot-alerts {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0 0 0.85rem;
}
.sg-wa-bot-alerts .flash {
  margin: 0;
}
.sg-wa-bot-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
@media (min-width: 900px) {
  .sg-wa-bot-grid {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
  .sg-wa-bot-grid__span {
    grid-column: 1 / -1;
  }
}
.sg-wa-bot-page .card.sg-wa-bot-card {
  max-width: none;
  margin: 0;
  padding: 0.75rem 0.9rem;
}
.sg-wa-bot-card__title {
  margin: 0 0 0.55rem;
  font-size: 0.92rem;
  font-weight: 700;
}
.sg-wa-bot-card__hint {
  margin: 0 0 0.65rem;
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--muted, #64748b);
}
.sg-wa-bot-card label {
  margin-top: 0.55rem;
  font-size: 0.8rem;
}
.sg-wa-bot-card label:first-of-type,
.sg-wa-bot-card .sg-toggle:first-child,
.sg-wa-bot-card .chk:first-child {
  margin-top: 0;
}
.sg-wa-bot-card .muted {
  font-size: 0.78rem;
  line-height: 1.35;
}
.sg-wa-bot-card textarea {
  min-height: 0;
}
.sg-wa-bot-card textarea[rows="2"],
.sg-wa-bot-card textarea[rows="3"] {
  min-height: auto;
}
.sg-wa-bot-fields-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem 0.75rem;
}
@media (max-width: 520px) {
  .sg-wa-bot-fields-2 {
    grid-template-columns: 1fr;
  }
}
.sg-wa-bot-fields-2 > div {
  min-width: 0;
}
.sg-wa-bot-fields-2 label {
  margin-top: 0;
}
.sg-wa-bot-page .form-actions.sg-wa-bot-actions {
  max-width: none;
  position: sticky;
  bottom: 0.5rem;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.25rem 0 0.85rem;
  padding: 0.65rem 0.75rem;
  background: color-mix(in srgb, var(--surface, #fff) 92%, transparent);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.06);
  backdrop-filter: blur(6px);
}
.sg-wa-bot-more {
  margin: 0 0 0.65rem;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  background: var(--surface, #fff);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.sg-wa-bot-more > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0.9rem;
  font-size: 0.9rem;
  font-weight: 700;
  user-select: none;
}
.sg-wa-bot-more > summary::-webkit-details-marker { display: none; }
.sg-wa-bot-more > summary::after {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid #94a3b8;
  border-bottom: 2px solid #94a3b8;
  transform: rotate(45deg);
  flex-shrink: 0;
  transition: transform 0.15s ease;
}
.sg-wa-bot-more[open] > summary::after {
  transform: rotate(-135deg);
}
.sg-wa-bot-more__body {
  padding: 0 0.9rem 0.85rem;
  border-top: 1px solid var(--border, #e2e8f0);
}
.sg-wa-bot-more__body > .muted:first-child {
  margin: 0.65rem 0 0.55rem;
  font-size: 0.78rem;
}
.sg-wa-bot-more .sg-wa-src-list,
.sg-wa-bot-more .sg-wa-rule-list {
  list-style: none;
  padding: 0;
  margin: 0 0 0.85rem;
}
.sg-wa-bot-more .sg-wa-src-item,
.sg-wa-bot-more .sg-wa-rule-item {
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  margin-bottom: 0.45rem;
  background: #f8fafc;
}
.sg-wa-bot-belly {
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  margin: 0 0 0.75rem;
  background: #f8fafc;
}
.sg-wa-bot-add-forms {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}
@media (min-width: 900px) {
  .sg-wa-bot-add-forms {
    grid-template-columns: 1fr 1fr 1fr;
  }
}
.sg-wa-bot-add-forms form {
  margin: 0;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  background: #fafbfc;
}

.sg-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
  font-size: 0.88rem;
}
.sg-table th, .sg-table td {
  text-align: left;
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.sg-table th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  font-weight: 700;
}
.sg-table--iscritti { min-width: 860px; }
.sg-table--iscritti td {
  vertical-align: middle;
  padding-top: 0.85rem;
  padding-bottom: 0.85rem;
  min-height: 3.4rem;
}
.sg-table--insegnanti { min-width: 720px; }
.sg-table--insegnanti td {
  vertical-align: middle;
  padding-top: 0.85rem;
  padding-bottom: 0.85rem;
  min-height: 3.4rem;
}
.sg-table--insegnanti td:first-child {
  white-space: nowrap;
}
.sg-scheda__avatar--img {
  object-fit: cover;
  padding: 0;
  background: #e2e8f0;
}
.sg-scheda__avatar--lg.sg-scheda__avatar--img {
  display: block;
  border-radius: 14px;
}
.sg-iscritto-name {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  color: var(--accent, #0f766e);
  min-width: 0;
  cursor: pointer;
}
.sg-iscritto-name strong {
  color: inherit;
  font-weight: 700;
}
.sg-iscritto-name:hover strong { text-decoration: underline; }
.sg-iscritto-name:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent, #0f766e) 45%, #fff);
  outline-offset: 2px;
  border-radius: 6px;
}
.sg-iscritto-name__avatar {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  object-fit: cover;
  flex-shrink: 0;
  background: #e2e8f0;
  border: 1px solid #e2e8f0;
}
.sg-scheda__mini-list {
  margin: 0;
  padding-left: 1rem;
  font-size: 0.72rem;
  line-height: 1.4;
  color: #334155;
}
.sg-scheda__mini-list li { margin-bottom: 0.25rem; }
.sg-table__categorie {
  max-width: 11rem;
  font-size: 0.82rem;
  line-height: 1.35;
  white-space: normal;
  word-break: break-word;
}
.sg-table__codici {
  max-width: 16rem;
  min-width: 10rem;
  font-size: 0.78rem;
  line-height: 1.4;
  white-space: normal;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.sg-table__codice {
  display: inline-block;
  word-break: break-all;
}
@media (max-width: 768px) {
  .sg-table__categorie { max-width: 8rem; }
  .sg-table__codici { max-width: 11rem; min-width: 8rem; }
}
.sg-dl {
  display: grid;
  grid-template-columns: 7rem 1fr;
  gap: 0.35rem 0.75rem;
  margin: 0;
}
.sg-dl dt { color: var(--muted); font-size: 0.75rem; font-weight: 650; }
.sg-dl dd { margin: 0; font-size: 0.9rem; }
.sg-inline-edit { margin-top: 0.65rem; padding-top: 0.65rem; border-top: 1px dashed #e2e8f0; }
.crm-hero-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }

/* Filtri AJAX */
[data-ajax-results].is-ajax-loading {
  opacity: 0.55;
  pointer-events: none;
  transition: opacity 0.15s ease;
}
form[data-ajax-filter] button[type="submit"] {
  min-width: 5.5rem;
}

/* Modale anagrafiche / elenco → dettaglio */
body.entity-modal-open { overflow: hidden; }
.entity-modal[hidden] { display: none !important; }
.entity-modal {
  position: fixed;
  inset: 0;
  z-index: 2600;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 1rem;
  padding-top: max(1rem, env(safe-area-inset-top));
}
.entity-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(11, 31, 42, 0.5);
}
.entity-modal__panel {
  position: relative;
  z-index: 1;
  width: min(100%, 560px);
  max-height: min(92vh, 780px);
  margin-top: 3vh;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
}
.entity-modal__panel--wide { width: min(100%, 720px); }
.entity-modal__panel--xl {
  width: min(100%, 960px);
  max-height: min(94vh, 920px);
}
.entity-modal__panel--scheda {
  width: min(calc(100% - 2rem), 72rem);
  max-height: min(92vh, 900px);
  height: min(92vh, 900px);
  border-radius: 16px;
}
.entity-modal__panel--xl.entity-modal__panel--scheda {
  /* Iscritto: barra tab lunga (Anagrafica…Stagione) — più larga di --xl generico */
  width: min(calc(100% - 2rem), 78rem);
  max-height: min(94vh, 920px);
  height: min(94vh, 920px);
}
.entity-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}
.entity-modal__head[hidden] { display: none !important; }
.entity-modal__head h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 650;
}
.entity-modal__x {
  width: 44px;
  min-height: 44px;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: #64748b;
}
.entity-modal__x:hover { background: #f1f5f9; }
.entity-modal__x:focus { outline: none; }
.entity-modal__x:focus-visible { outline: 2px solid #94a3b8; outline-offset: 1px; }
.entity-modal__body {
  padding: 0.85rem 1rem 1.15rem;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
}
.entity-modal__body--scheda {
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.entity-modal__body.is-saving {
  opacity: 0.72;
  pointer-events: none;
}
.sg-modal-flashes {
  flex: 0 0 auto;
  padding: 0.55rem 0.85rem 0;
  display: grid;
  gap: 0.35rem;
}
.sg-modal-flashes .flash {
  margin: 0;
}
.entity-modal__body--scheda > .sg-modal-scheda,
.entity-modal__body--scheda > [data-entity-modal-form] {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.entity-modal__body--scheda > [data-entity-modal-form] > .prj-scheda,
.entity-modal__body--scheda > [data-entity-modal-form] > .act-scheda {
  flex: 1;
  min-height: 0;
  height: 100%;
}
/* Scheda corso/workshop: header+tabs fissi, contenuto scroll, footer fisso */
.entity-modal__body--scheda > [data-entity-modal-form] > .sg-attivita-shell {
  flex: 1 1 auto;
  min-height: 0;
  max-height: 100%;
  height: auto;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0;
}
.entity-modal__body--scheda .sg-attivita-shell > .sg-attivita-shell__head {
  flex-shrink: 0;
  margin: 0;
  padding: 0.85rem 1rem 0.7rem;
}
.entity-modal__body--scheda .sg-attivita-shell > .sg-corso-scheda-tabs {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.entity-modal__body--scheda .sg-corso-scheda-tabs > .sg-scheda-tabs,
.entity-modal__body--scheda .sg-attivita-shell > .sg-attivita-shell__tabs {
  flex-shrink: 0;
  /* margine esterno = padding pannelli: lo sfondo grigio allinea alle card sotto */
  margin: 0 1rem 0.55rem;
  padding: 0.28rem;
  box-sizing: border-box;
  width: auto;
  max-width: none;
  align-self: stretch;
}
.entity-modal__body--scheda .sg-corso-scheda-tabs > .sg-scheda-panels,
.entity-modal__body--scheda .sg-attivita-shell > .sg-attivita-shell__scroll,
.entity-modal__body--scheda .sg-attivita-shell > .sg-attivita-shell__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 0 1rem 1.15rem;
}
/* Tab Scheda: evita doppia card (section + attivita_section) */
.entity-modal__body--scheda .sg-scheda-panels > [data-scheda-panel="scheda"].sg-modal-scheda__section {
  border: none;
  padding: 0;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
}
.entity-modal__body--scheda .sg-scheda-panels > [data-scheda-panel="scheda"] > .sg-attivita-shell__body {
  padding: 0;
  overflow: visible;
  min-height: 0;
}
.entity-modal__body--scheda .sg-attivita-shell > .sg-attivita-shell__foot,
.entity-modal__body--scheda .sg-attivita-shell > .sg-modal-simple__foot {
  flex-shrink: 0;
  position: static;
  margin: 0;
  padding: 0.7rem 1rem calc(0.7rem + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid #e2e8f0;
  background: #fff;
  z-index: 2;
}
.entity-modal__body--scheda .sg-attivita-section,
.entity-modal__body--scheda .sg-modal-scheda__section {
  margin-bottom: 0.75rem;
}
.entity-modal__body--scheda .sg-attivita-section:last-child,
.entity-modal__body--scheda .sg-modal-scheda__section:last-child {
  margin-bottom: 0.25rem;
}
.entity-modal__body--scheda > [data-entity-modal-form] > script {
  display: none !important;
}
.entity-modal__body--scheda .sg-attivita-shell > script {
  display: none !important;
}
.entity-modal__body label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #64748b;
  margin: 0.55rem 0 0.25rem;
}
.entity-modal__body input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="submit"]):not([type="button"]),
.entity-modal__body select,
.entity-modal__body textarea {
  width: 100%;
  min-height: 44px;
  box-sizing: border-box;
}
.entity-modal__body .chk,
.entity-modal__body label.chk {
  display: flex !important;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.85rem !important;
  font-weight: 500;
  color: inherit;
}
.entity-modal__body .chk input { width: auto; min-height: auto; }
.entity-modal__extra {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #e2e8f0;
}
.list a[data-entity-modal],
.sg-table a[data-entity-modal] {
  cursor: pointer;
}
.list li.is-row-click {
  cursor: pointer;
}

@media (max-width: 768px) {
  .entity-modal {
    padding: 0;
    align-items: flex-end;
  }
  .entity-modal__panel,
  .entity-modal__panel--wide,
  .entity-modal__panel--xl,
  .entity-modal__panel--scheda {
    width: 100%;
    max-height: 94vh;
    margin-top: 0;
    border-radius: 14px 14px 0 0;
    align-self: flex-end;
  }
  .entity-modal__panel--scheda,
  .entity-modal__panel--xl.entity-modal__panel--scheda {
    height: min(94dvh, 94vh);
    max-height: min(94dvh, 94vh);
  }
}

/* Scheda anagrafica in modale (stile pannello) */
.sg-modal-scheda {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  background: #fff;
}
.sg-modal-scheda__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.15rem 1.35rem 1rem;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}
.sg-modal-scheda__head-text { min-width: 0; flex: 1; }
.sg-modal-scheda__head-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem;
  flex-shrink: 0;
}
.sg-head-action {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 2.5rem;
  padding: 0.35rem 0.7rem;
  border: 1px solid #d5dee9;
  border-radius: 10px;
  background: #fff;
  color: #334155;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
  line-height: 1.1;
  -webkit-tap-highlight-color: transparent;
}
.sg-head-action:hover:not(:disabled) {
  border-color: #94a3b8;
  background: #f8fafc;
}
.sg-head-action:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.sg-head-action__ico {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #64748b;
}
.sg-head-action--wa .sg-head-action__ico { color: #16a34a; }
.sg-head-action--mail .sg-head-action__ico { color: #0d9488; }
.sg-head-action__lbl { white-space: nowrap; }
.sg-modal-scheda__title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.6rem;
  margin-bottom: 0.2rem;
}
.sg-modal-scheda__title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.2;
  color: #0f172a;
  letter-spacing: -0.02em;
}
.sg-modal-scheda__sub {
  margin: 0;
  font-size: 0.8rem;
  font-family: inherit;
  color: #64748b;
}
.sg-modal-scheda__x {
  width: 36px;
  min-height: 36px;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  color: #94a3b8;
  flex-shrink: 0;
}
.sg-modal-scheda__x:hover { background: #f1f5f9; color: #334155; }
.sg-modal-scheda__x:focus { outline: none; }
.sg-modal-scheda__x:focus-visible { outline: 2px solid #94a3b8; outline-offset: 1px; }
.sg-modal-scheda__body {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
}
.sg-modal-scheda__side {
  width: 14rem;
  flex-shrink: 0;
  background: #f8fafc;
  border-right: 1px solid #f1f5f9;
  padding: 1rem;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.sg-scheda__id--hero {
  flex-direction: column;
  align-items: flex-start;
}
.sg-scheda__avatar--lg {
  width: 5.5rem;
  height: 5.5rem;
  border-radius: 14px;
  font-size: 1.35rem;
  background: linear-gradient(145deg, #e0f2fe, #eff6ff);
  border: 1px solid #bfdbfe;
}
.sg-modal-scheda__main {
  flex: 1;
  min-width: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0.85rem 1.1rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
/* Tab scheda: barra segmentata (formato dashboard) */
.sg-scheda-tabs {
  --sg-tab-border: #d7e0eb;
  --sg-tab-muted: #64748b;
  --sg-tab-active-text: #0f172a;
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0.15rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0;
  padding: 0.28rem;
  border: 1px solid var(--sg-tab-border);
  border-radius: 12px;
  background: #f1f5f9;
  scrollbar-width: thin;
  flex: 0 0 auto;
}
.sg-scheda-tabs__btn {
  flex: 0 0 auto;
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.4rem;
  margin: 0;
  padding: 0.45rem 0.8rem;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  box-shadow: none;
  color: var(--sg-tab-muted);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  line-height: 1.15;
  cursor: pointer;
  white-space: nowrap;
  position: relative;
  z-index: 0;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
}
.sg-scheda-tabs__btn:first-child {
  margin-left: 0;
}
.sg-scheda-tabs__btn:hover {
  color: var(--sg-tab-active-text);
  background: color-mix(in srgb, #fff 70%, #e2e8f0);
  z-index: 1;
}
.sg-scheda-tabs__btn.is-active {
  color: var(--sg-tab-active-text);
  font-weight: 800;
  background: #fff;
  border-color: #e2e8f0;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  z-index: 2;
  padding-bottom: 0.45rem;
  margin-bottom: 0;
}
.sg-scheda-tabs__ico {
  width: 0.95rem;
  height: 0.95rem;
  margin-right: 0.35rem;
  flex: 0 0 auto;
  opacity: 0.75;
}
.sg-scheda-tabs__btn.is-active .sg-scheda-tabs__ico {
  opacity: 1;
}
.sg-scheda-tabs__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  margin-left: 0.35rem;
  padding: 0.05rem 0.35rem;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
  font-size: 0.65rem;
  font-weight: 700;
}
.sg-scheda-tabs__btn.is-active .sg-scheda-tabs__count {
  background: color-mix(in srgb, var(--accent, #7c3aed) 18%, #fff);
  color: var(--accent, #6d28d9);
}
.sg-scheda-tabs__meta {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0 0.55rem;
  color: var(--sg-tab-muted);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  align-self: center;
}
.sg-scheda-tabs__meta strong {
  color: var(--sg-tab-active-text);
  font-weight: 800;
}
.sg-scheda-tabs__meta-sep {
  opacity: 0.55;
  margin: 0 0.15rem;
}
.sg-corso-scheda-tabs {
  margin-top: 0.35rem;
}
.sg-scheda-tabs--corso {
  margin-bottom: 0.75rem;
}

/* Tab underline (mockup scheda unificata) */
.sg-scheda-tabs--underline {
  gap: 0;
  padding: 0;
  border: none;
  border-bottom: 1px solid #e2e8f0;
  border-radius: 0;
  background: transparent;
  overflow-x: auto;
}
.sg-scheda-tabs--underline .sg-scheda-tabs__btn {
  min-height: 2.6rem;
  padding: 0.55rem 0.85rem;
  border: none;
  border-radius: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  box-shadow: none;
  color: #64748b;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: none;
}
.sg-scheda-tabs--underline .sg-scheda-tabs__btn:hover {
  color: #0f172a;
  background: transparent;
}
.sg-scheda-tabs--underline .sg-scheda-tabs__btn.is-active {
  color: #0f172a;
  font-weight: 700;
  background: transparent;
  border-color: transparent;
  border-bottom-color: #0f172a;
  box-shadow: none;
  padding-bottom: 0.55rem;
}
.sg-pres-gender {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  margin-left: 0.45rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 650;
}
.sg-pres-gender--f {
  background: #fce7f3;
  color: #9d174d;
}
.sg-pres-gender--m {
  background: #e0f2fe;
  color: #075985;
}
.sg-presenze-page__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 0.85rem;
}
.sg-presenze-page__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.sg-presenze-page__lead {
  margin: 0.25rem 0 0;
  font-size: 0.9rem;
}
.sg-presenze-page__gender {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.sg-presenze-page__filter {
  margin-bottom: 0.85rem;
}
.sg-presenze-page__filter select {
  min-width: min(100%, 28rem);
  max-width: 100%;
}
.sg-presenze-page__combo {
  flex: 1 1 22rem;
  min-width: min(100%, 18rem);
  max-width: 44rem;
}
.sg-presenze-page__combo-input {
  width: 100%;
  min-height: 42px;
}
.sg-presenze-page__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.55rem;
  margin: 0 0 0.85rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}
/* Registro presenze + scheda corso: full-bleed come Programmazione */
body.sg-presenze-wide .sx-main {
  max-width: none;
  width: 100%;
  padding-left: 1rem;
  padding-right: 1rem;
}
body.sg-presenze-wide .sg-presenze-page,
body.sg-presenze-wide .sg-corso-detail-card {
  max-width: none;
  width: 100%;
}
.sg-pres-grid {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-width: 0;
}
.sg-pres-grid__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem 0.75rem;
}
.sg-pres-grid__stats,
.sg-pres-grid__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}
.sg-pres-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #334155;
  font-size: 0.72rem;
  font-weight: 700;
}
.sg-pres-chip--pct { background: #ecfdf5; border-color: #a7f3d0; color: #047857; }
.sg-pres-chip--low { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.sg-pres-grid__search {
  min-width: 10rem;
  max-width: 14rem;
  min-height: 2.15rem;
  padding: 0.35rem 0.65rem;
  border: 1px solid #d7e0eb;
  border-radius: 8px;
  font: inherit;
  font-size: 0.82rem;
}
.sg-pres-grid__scroll {
  overflow: auto;
  max-height: min(52vh, 28rem);
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  -webkit-overflow-scrolling: touch;
}
.sg-pres-table {
  border-collapse: separate;
  border-spacing: 0;
  width: max-content;
  min-width: 100%;
  font-size: 0.78rem;
}
.sg-pres-table th,
.sg-pres-table td {
  padding: 0.35rem 0.3rem;
  border-bottom: 1px solid #eef2f7;
  vertical-align: middle;
  text-align: center;
  white-space: nowrap;
}
.sg-pres-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f8fafc;
  color: #64748b;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  box-shadow: 0 1px 0 #e2e8f0;
}
.sg-pres-table__sticky {
  position: sticky;
  left: 0;
  z-index: 3;
  background: #fff;
  text-align: left !important;
  box-shadow: 1px 0 0 #e2e8f0;
}
.sg-pres-table thead .sg-pres-table__sticky {
  z-index: 4;
  background: #f8fafc;
}
.sg-pres-table__name {
  min-width: 11rem;
  max-width: 14rem;
  padding-left: 0.65rem !important;
  padding-right: 0.55rem !important;
}
.sg-pres-table__pct {
  left: 11rem;
  min-width: 3rem;
  text-align: center !important;
  font-variant-numeric: tabular-nums;
}
.sg-pres-table__fullname {
  display: block;
  font-size: 0.78rem;
  letter-spacing: 0.01em;
  color: #0f172a;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sg-pres-table__aid {
  display: block;
  font-size: 0.68rem;
  color: #94a3b8;
  margin-top: 0.1rem;
}
.sg-pres-pct {
  font-weight: 800;
  color: #0f766e;
  font-variant-numeric: tabular-nums;
}
.sg-pres-pct.is-low { color: #b91c1c; }
.sg-pres-table__date { min-width: 2.6rem; }
.sg-pres-table__cell { padding: 0.2rem !important; }
.sg-pres-cell-wrap {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.12rem;
  min-width: 1.7rem;
}
.sg-pres-cell {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.7rem;
  height: 1.7rem;
  margin: 0;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: #f1f5f9;
  color: #94a3b8;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  transition: background 0.1s ease, color 0.1s ease, border-color 0.1s ease;
}
button.sg-pres-cell:hover { border-color: #cbd5e1; }
.sg-pres-cell.is-presente {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}
.sg-pres-cell.is-assente {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}
.sg-pres-cell.is-none {
  background: #f8fafc;
  color: #cbd5e1;
}
.sg-pres-cell.is-fonte-portal {
  box-shadow: inset 0 0 0 1px #93c5fd;
}
.sg-pres-cell.is-fonte-segreteria {
  box-shadow: inset 0 0 0 1px #94a3b8;
}
.sg-pres-cell.is-busy { opacity: 0.55; pointer-events: none; }
.sg-pres-cell.is-locked,
button.sg-pres-cell.is-locked {
  cursor: default;
  opacity: 0.72;
  background: #f8fafc;
  color: #cbd5e1;
  border-color: transparent;
  box-shadow: none;
}
button.sg-pres-cell.is-locked:hover {
  border-color: transparent;
}
.sg-pres-cell-wrap.is-locked .sg-pres-fonte { display: none; }
.sg-pres-fonte {
  display: inline-block;
  max-width: 2.4rem;
  padding: 0.05rem 0.2rem;
  border-radius: 3px;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.2;
  text-transform: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sg-pres-fonte--portal {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}
.sg-pres-fonte--segreteria {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}
i.sg-pres-cell {
  font-style: normal;
  pointer-events: none;
  width: 1.35rem;
  height: 1.35rem;
  font-size: 0.75rem;
}
.sg-pres-grid__legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
  font-size: 0.72rem;
  color: #64748b;
}
.sg-pres-grid__legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.sg-pres-grid__legend .sg-pres-fonte {
  max-width: none;
}
.sg-pres-date-dialog {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1rem 1.1rem;
  max-width: 22rem;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.18);
}
.sg-pres-date-dialog::backdrop {
  background: rgba(15, 23, 42, 0.35);
}
.sg-pres-date-dialog__form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: #64748b;
}
.sg-contabile-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.55rem;
}
.sg-contabile-summary--sheet {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.sg-contabile-kpi {
  padding: 0.65rem 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
}
.sg-contabile-kpi.is-warn {
  background: #fef2f2;
  border-color: #fecaca;
}
.sg-contabile-kpi.is-ok {
  background: #ecfdf5;
  border-color: #a7f3d0;
}
.sg-contabile-kpi__lbl {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 0.25rem;
}
.sg-contabile-kpi__val {
  font-size: 1.05rem;
  font-weight: 800;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
}
.sg-contabile-kpi.is-warn .sg-contabile-kpi__val { color: #b91c1c; }
.sg-contabile-kpi.is-ok .sg-contabile-kpi__val { color: #047857; }
.sg-contabile-pay-form {
  margin-top: 0.35rem;
}
.sg-contabile-source {
  margin: 0.4rem 0 0.85rem;
  font-size: 0.74rem;
}
.sg-contabile-block {
  margin-top: 0.85rem;
}
.sg-contabile-block--action {
  margin-top: 1.1rem;
  padding-top: 0.85rem;
  border-top: 1px solid #e2e8f0;
}
.sg-contabile-count {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  background: #e2e8f0;
  font-size: 0.72rem;
  font-weight: 700;
  color: #475569;
  vertical-align: middle;
}
.sg-contabile-rows {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.sg-contabile-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.45rem 0.85rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
}
.sg-contabile-row__main {
  flex: 1 1 14rem;
  min-width: 0;
}
.sg-contabile-row__title {
  display: block;
  font-size: 0.9rem;
  color: #0f172a;
  line-height: 1.35;
}
.sg-contabile-row__method {
  margin-left: 0.35rem;
  font-weight: 600;
  color: #475569;
  font-size: 0.82rem;
}
.sg-contabile-row__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.55rem;
  margin-top: 0.3rem;
  font-size: 0.75rem;
  color: #64748b;
  align-items: center;
}
.sg-contabile-row__money {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.15rem;
  font-size: 0.78rem;
  color: #64748b;
  text-align: right;
  flex: 0 0 auto;
}
.sg-contabile-row__money strong {
  color: #0f172a;
  font-variant-numeric: tabular-nums;
}
.sg-contabile-row__actions {
  flex: 0 0 auto;
  align-self: center;
}
.sg-contabile-paid {
  color: #047857;
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.sg-contabile-empty {
  margin: 0;
  font-size: 0.82rem;
}
.sg-contabile-hint {
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  font-size: 0.82rem;
  color: #475569;
}
.sg-contabile-hint p {
  margin: 0;
  line-height: 1.45;
}
.badge--web {
  background: #ecfeff;
  color: #0e7490;
  border: 1px solid #a5f3fc;
}
.sg-text-warn { color: #b91c1c; }
@media (max-width: 720px) {
  .sg-contabile-summary,
  .sg-contabile-summary--sheet {
    grid-template-columns: 1fr;
  }
  .sg-contabile-row__money {
    align-items: flex-start;
    text-align: left;
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.35rem 0.75rem;
  }
}
@media (max-width: 720px) {
  .sg-pres-table__name { min-width: 8.5rem; max-width: 10rem; }
  .sg-pres-table__pct { left: 8.5rem; min-width: 2.6rem; }
  .sg-pres-grid__search { max-width: none; flex: 1 1 100%; }
}
.sg-scheda-panels {
  border: none;
  border-radius: 0;
  background: transparent;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  flex: 1 1 auto;
  min-height: 0;
}
/* Vista Tutto: solo panoramica (form anagrafica nella tab Anagrafica) */
[data-scheda-tabs-root].is-tutto .sg-scheda-panels,
[data-scheda-tabs-root][data-active-scheda-tab="tutto"] .sg-scheda-panels {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
[data-scheda-tabs-root].is-tutto .sg-scheda-overview,
[data-scheda-tabs-root][data-active-scheda-tab="tutto"] .sg-scheda-overview {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-width: 0;
}
.sg-scheda-overview[hidden] {
  display: none !important;
}
.sg-scheda-home__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.65rem 1rem;
}
.sg-scheda-home__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 750;
  color: #0f172a;
}
.sg-scheda-home__lead {
  margin: 0.2rem 0 0;
  font-size: 0.82rem;
}
.sg-scheda-home__jumps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.sg-contabile-summary--home {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 0.15rem;
}
.sg-scheda-home__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  align-items: start;
}
.sg-scheda-home__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.sg-scheda-home__list li {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-size: 0.88rem;
}
.sg-scheda-home__list .meta {
  font-size: 0.75rem;
  color: #64748b;
}
@media (max-width: 720px) {
  .sg-contabile-summary--home {
    grid-template-columns: 1fr;
  }
  .sg-scheda-home__grid {
    grid-template-columns: 1fr;
  }
}
.sg-scheda-card {
  margin: 0;
  padding: 0.85rem 0.95rem;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}
.sg-scheda-card__title {
  margin: 0 0 0.65rem;
  font-size: 0.82rem;
  font-weight: 750;
  color: #0f172a;
}
.sg-scheda-card__row {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  margin-bottom: 0.55rem;
  font-size: 0.88rem;
}
.sg-scheda-card__row a {
  color: #2563eb;
  word-break: break-all;
  text-decoration: none;
}
.sg-scheda-card__row a:hover { text-decoration: underline; }
.sg-scheda-card__lbl {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
}
.sg-scheda-card__wa {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.sg-scheda-card__hint {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.4;
}
.sg-linkish {
  display: inline;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent, #0f766e);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.sg-linkish:hover {
  color: #0d9488;
}
.sg-scheda-pill {
  display: inline-flex;
  align-items: center;
  min-height: 1.6rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.sg-scheda-pill--on {
  background: #dcfce7;
  color: #166534;
}
.sg-scheda-pill--off {
  background: #f1f5f9;
  color: #64748b;
}
.sg-scheda-status {
  margin: 0.35rem 0 0;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 650;
  background: #f8fafc;
  color: #475569;
  line-height: 1.35;
}
.sg-scheda-status--ok {
  background: #ecfdf5;
  color: #047857;
}
.sg-scheda-status--warn {
  background: #fffbeb;
  color: #b45309;
}
.sg-scheda-alert {
  margin: 0.85rem 0 0;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  background: #eff6ff;
  color: #1e3a8a;
  font-size: 0.8rem;
  line-height: 1.4;
  border: 1px solid #bfdbfe;
}
.sg-scheda-subblock {
  margin-top: 1.1rem;
  padding-top: 0.95rem;
  border-top: 1px solid #e2e8f0;
}
.sg-scheda-subblock__title {
  margin: 0 0 0.65rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.sg-modal-scheda__section {
  margin: 0;
  padding: 0.95rem 1rem 1.05rem;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}
.sg-modal-scheda__section[hidden] {
  display: none !important;
}
.sg-modal-scheda__section-title {
  margin: 0 0 0.85rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.sg-modal-scheda__ico {
  width: 1.05rem;
  height: 1.05rem;
  color: var(--accent, #0d9488);
  flex: 0 0 auto;
  display: block;
}
@media (max-width: 768px) {
  .sg-scheda-tabs__btn {
    min-height: 40px;
    padding: 0.4rem 0.6rem;
    font-size: 0.68rem;
  }
  .sg-scheda-panels {
    padding: 0;
  }
  .sg-modal-scheda__head {
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 0.65rem;
  }
  .sg-modal-scheda__head-text {
    min-width: 0;
    flex: 1 1 auto;
  }
  .sg-modal-scheda__title-row {
    margin-bottom: 0;
    gap: 0.3rem;
  }
  .sg-modal-scheda__title {
    font-size: 0.92rem;
    white-space: nowrap;
    overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
    text-overflow: ellipsis;
    max-width: 100%;
  }
  .sg-modal-scheda__sub {
    display: none;
  }
  .sg-modal-scheda__head-actions {
    width: auto;
    flex: 0 0 auto;
    flex-wrap: nowrap;
    gap: 0.25rem;
  }
  .sg-head-action {
    flex: 0 0 auto;
    min-height: 36px;
    min-width: 36px;
    padding: 0.3rem 0.4rem;
    border-radius: 8px;
  }
  .sg-head-action__lbl {
    display: none;
  }
  .sg-head-action__ico {
    font-size: 0.72rem;
  }
  .sg-modal-scheda__x {
    flex: 0 0 auto;
    width: 36px;
    min-width: 36px;
    min-height: 36px;
  }
  .sg-scheda__avatar--lg {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 10px;
    font-size: 0.9rem;
  }
}
.sg-scheda-page {
  max-width: 78rem;
  margin: 0 auto;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.08);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
}
.sg-modal-scheda--page {
  min-height: min(80vh, 820px);
}
.sg-modal-scheda--page .sg-modal-scheda__body {
  min-height: 28rem;
}
.sg-modal-scheda__title {
  text-transform: uppercase;
  letter-spacing: 0.01em;
}
.sg-modal-scheda__cf {
  margin-bottom: 1rem;
  max-width: 16rem;
}
.sg-modal-scheda__cf label,
.sg-modal-scheda label {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #94a3b8;
  margin: 0 0 0.3rem;
}
.sg-modal-scheda input,
.sg-modal-scheda select,
.sg-modal-scheda textarea {
  width: 100%;
  min-height: 40px;
  box-sizing: border-box;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.45rem 0.65rem;
  font-size: 0.9rem;
  background: #fff;
}
.sg-modal-scheda input:focus,
.sg-modal-scheda select:focus,
.sg-modal-scheda textarea:focus {
  outline: none;
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}
.sg-modal-scheda .sg-form-grid { margin-bottom: 0; }
.sg-form-grid__full { grid-column: 1 / -1; }
.sg-modal-scheda .sg-tessera-cell {
  background: #f8fafc;
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
}
.sg-modal-scheda .sg-tessera-cell input {
  background: transparent;
  border-color: transparent;
  padding-left: 0;
  min-height: 32px;
  font-weight: 600;
}
.sg-modal-scheda .sg-tessera-cell input:focus {
  background: #fff;
  border-color: #93c5fd;
  padding-left: 0.5rem;
}
.sg-modal-scheda__list { margin: 0; }
.sg-corso-iscritto__head {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.sg-iscritto-alert {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 999px;
  background: #fff7ed;
  border: 1px solid #fdba74;
  color: #c2410c;
  cursor: help;
  flex-shrink: 0;
}
.sg-iscritto-alert__ico {
  width: 0.92rem;
  height: 0.92rem;
  display: block;
}
.sg-iscritto-alert__tip {
  position: absolute;
  left: 0;
  bottom: calc(100% + 0.35rem);
  top: auto;
  z-index: 40;
  min-width: 14rem;
  max-width: min(22rem, 78vw);
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  border: 1px solid #fed7aa;
  background: #fffbeb;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
  color: #9a3412;
  font-size: 0.78rem;
  line-height: 1.35;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-2px);
  transition: opacity 0.12s ease, transform 0.12s ease, visibility 0.12s;
}
.sg-iscritto-alert:hover .sg-iscritto-alert__tip,
.sg-iscritto-alert:focus .sg-iscritto-alert__tip,
.sg-iscritto-alert:focus-within .sg-iscritto-alert__tip {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}
.sg-iscritto-alert__tip-title {
  display: block;
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #c2410c;
}
.sg-iscritto-alert__tip-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.45rem;
}
.sg-iscritto-alert__tip-label {
  display: block;
  font-weight: 700;
  color: #9a3412;
}
.sg-iscritto-alert__tip-detail {
  display: block;
  margin-top: 0.1rem;
  color: #b45309;
  font-weight: 500;
}
.sg-modal-scheda__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem;
  padding: 0.85rem 1.35rem;
  border-top: 1px solid #e2e8f0;
  background: #fff;
  flex-shrink: 0;
}
.sg-modal-scheda__foot-hint {
  margin: 0;
  margin-right: auto;
  font-size: 0.8rem;
  max-width: 22rem;
}
.sg-modal-scheda__foot-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.sg-modal-scheda__foot .btn-primary {
  background: var(--accent, #0f766e);
  border-color: var(--accent, #0f766e);
}
.sg-modal-scheda__foot .btn-primary:hover {
  background: var(--accent-hover, #0d9488);
  border-color: var(--accent-hover, #0d9488);
}
.sg-modal-simple__head {
  margin: 0 0 0.75rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid #e2e8f0;
}
.sg-modal-simple__head h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
}
.sg-modal-simple__foot {
  justify-content: flex-end;
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid #e2e8f0;
  position: sticky;
  bottom: 0;
  background: #fff;
  z-index: 2;
}

/* ——— Scheda attività unificata (corso / workshop) ——— */
.sg-attivita-shell {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 0;
}
.sg-attivita-shell__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #e2e8f0;
}
.sg-attivita-shell__head-main {
  min-width: 0;
  flex: 1;
}
.sg-attivita-shell__kind {
  margin: 0 0 0.2rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #0f766e;
  line-height: 1.2;
}
.sg-attivita-shell__title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.25;
}
.sg-attivita-shell__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.45rem;
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  color: #64748b;
}
.sg-attivita-shell__meta-sep {
  color: #cbd5e1;
}
.sg-attivita-shell__status {
  display: inline-flex;
  align-items: center;
  margin-left: 0.25rem;
  padding: 0.12rem 0.55rem;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #475569;
  font-size: 0.72rem;
  font-weight: 600;
}
.sg-attivita-shell__status--ok {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #047857;
}
.sg-attivita-shell__status--warn {
  background: #ffedd5;
  border-color: #fed7aa;
  color: #c2410c;
}
.sg-attivita-shell__head-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.sg-attivita-shell__tabs {
  margin-bottom: 0.85rem;
}
.sg-attivita-shell__body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-bottom: 0.5rem;
}
.sg-attivita-section {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  padding: 0.85rem 1rem;
}
.sg-attivita-section__title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 0.75rem;
  font-size: 0.92rem;
  font-weight: 700;
  color: #0f172a;
}
.sg-attivita-section__ico {
  width: 1.05rem;
  height: 1.05rem;
  color: #64748b;
  flex-shrink: 0;
}
.sg-attivita-section__body {
  min-width: 0;
}
.sg-attivita-fields {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: 1fr 1fr;
}
.sg-attivita-fields__row {
  min-width: 0;
}
.sg-attivita-fields__row--full {
  grid-column: 1 / -1;
}
.sg-attivita-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
}
.sg-attivita-shell__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: auto;
}
.sg-attivita-shell__scroll {
  min-width: 0;
}
.sg-attivita-shell__foot-hint {
  margin: 0;
  margin-right: auto;
  font-size: 0.8rem;
}
.sg-attivita-shell__foot-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
@media (max-width: 640px) {
  .sg-attivita-fields {
    grid-template-columns: 1fr;
  }
  .sg-attivita-shell__head {
    flex-direction: column;
  }
}

/* Workshop — tab Classi (mockup scheda-unificata) */
.sg-ws-classi__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0 0 0.35rem;
}
.sg-ws-classi__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 650;
}
.sg-ws-classi__lead {
  margin: 0 0 0.85rem;
  font-size: 0.84rem;
}
.sg-ws-classi__table th {
  white-space: nowrap;
}
.sg-ws-classi__table td {
  vertical-align: middle;
}
.sg-ws-classi__actions {
  text-align: right;
  white-space: nowrap;
}
.sg-ws-classi__actions form {
  display: inline;
  margin: 0;
}
.sg-ws-classe-add {
  margin-top: 0.85rem;
  padding: 0.85rem 1rem;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  background: #f8fafc;
}
.sg-ws-classe-add__grid {
  display: grid;
  gap: 0.65rem 0.85rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
}
.sg-ws-classe-add__grid label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #64748b;
  margin-bottom: 0.25rem;
}
.sg-ws-classe-add__foot {
  margin-top: 0.75rem;
}
@media (max-width: 720px) {
  .sg-ws-classe-add__grid {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 480px) {
  .sg-ws-classe-add__grid {
    grid-template-columns: 1fr;
  }
}

.sg-corso-form__flags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin: 0.35rem 0 0.75rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid #f0e2a8;
  border-radius: 10px;
  background: #fffbeb;
}
.sg-corso-form .sg-form-grid {
  margin-top: 0.25rem;
}
.sg-corso-form__scheda {
  align-items: start;
}
.sg-corso-form__scheda > .sg-combo,
.sg-corso-form__scheda > .sg-corso-form__sku {
  min-width: 0;
}
.sg-corso-form__scheda > .sg-combo > label,
.sg-corso-form__scheda > .sg-corso-form__sku > label {
  margin-top: 0;
  display: block;
}
.sg-corso-form__sku input {
  width: 100%;
  min-height: 42px;
  height: 42px;
  box-sizing: border-box;
}
.sg-corso-form__quotes {
  margin-top: 0.25rem;
}
.sg-corso-form__quotes-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.65rem 1rem;
  align-items: start;
}
@media (min-width: 640px) {
  .sg-corso-form__quotes-row {
    grid-template-columns: 1fr 1fr;
  }
}
.sg-corso-form__quotes-row > div,
.sg-corso-form__quotes-row > .sg-combo {
  min-width: 0;
}
.sg-corso-form__quotes-row > div > label,
.sg-corso-form__quotes-row > .sg-combo > label {
  margin-top: 0;
}
.sg-corso-form__quotes-row input[type="number"] {
  width: 100%;
  min-height: 42px;
  box-sizing: border-box;
}
.sg-corso-form__quotes-hint {
  margin: 0.45rem 0 0.85rem;
}
.sg-corso-form__hint {
  margin: 0.25rem 0 0;
  font-size: 0.72rem;
}
.sg-corso-form__scheda textarea[name="dettagli"] {
  min-height: 2.75rem;
  resize: vertical;
}
.sg-corso-form__orario-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.65rem 0.85rem;
}
@media (min-width: 720px) {
  .sg-corso-form__orario-row {
    grid-template-columns: 1fr 1fr 1fr;
  }
}
.sg-corso-form__posti-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.65rem 0.85rem;
  align-items: end;
}
@media (min-width: 900px) {
  .sg-corso-form__posti-row {
    grid-template-columns: minmax(12rem, 1fr) 7.5rem auto;
    align-items: end;
  }
}
.sg-corso-form__det-iscr {
  min-width: 0;
}
.sg-corso-form__limite input {
  width: 100%;
  min-height: 42px;
  height: 42px;
  box-sizing: border-box;
}
.sg-corso-form__posti-toggles {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
  min-height: 42px;
  padding-bottom: 0;
}
/* Chip box = stessa altezza degli input standard (42px) */
.sg-corso-form .sg-combo--chip .sg-combo-multi__box,
.sg-corso-form .sg-combo--multi .sg-combo-multi__box {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.3rem;
  height: 42px;
  min-height: 42px;
  max-height: 42px;
  padding: 0 0.55rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  cursor: text;
  box-sizing: border-box;
  overflow-x: auto;
  overflow-y: hidden;
}
.sg-corso-form .sg-combo--chip .sg-combo-multi__box:focus-within,
.sg-corso-form .sg-combo--multi .sg-combo-multi__box:focus-within {
  border-color: #0d9488;
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}
.sg-corso-form .sg-combo--chip [data-sg-combo-input],
.sg-corso-form .sg-combo--multi [data-sg-multi-search] {
  flex: 1 1 5rem;
  min-width: 4rem;
  width: auto !important;
  min-height: 0 !important;
  height: 1.6rem !important;
  margin: 0;
  padding: 0 0.15rem !important;
  border: 0 !important;
  border-radius: 0 !important;
  outline: none;
  background: transparent;
  box-shadow: none !important;
  font: inherit;
  font-size: 0.86rem;
}
.sg-corso-form .sg-combo-multi__chip {
  flex: 0 0 auto;
  padding: 0.12rem 0.28rem 0.12rem 0.4rem;
  font-size: 0.72rem;
  line-height: 1.2;
  max-height: 1.55rem;
}
.sg-corso-form [data-field="quota"] .sg-combo-multi__chip {
  max-height: none;
  white-space: normal;
  line-height: 1.3;
  padding: 0.25rem 0.35rem 0.25rem 0.5rem;
  word-break: break-word;
}
.sg-corso-form [data-field="quota"] .sg-combo-multi__box.has-chip {
  min-height: 42px;
  height: auto;
  align-items: flex-start;
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
}
.sg-combo {
  position: relative;
  min-width: 0;
}
.sg-combo .sg-enroll-suggest {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% - 0.15rem);
  z-index: 20;
  max-height: 14rem;
  overflow: auto;
  margin: 0;
  padding: 0.25rem;
  background: #fff;
  border: 1px solid #d0d7e2;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}
.sg-combo .sg-enroll-suggest__item {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 0.45rem 0.55rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.86rem;
  color: #0f172a;
}
.sg-combo .sg-enroll-suggest__item:hover,
.sg-combo .sg-enroll-suggest__item:focus {
  background: rgba(15, 118, 110, 0.1);
  outline: none;
}
.sg-combo .sg-enroll-suggest__item.is-active {
  background: rgba(15, 118, 110, 0.14);
  color: #0f766e;
  font-weight: 600;
}
.sg-combo--chip .sg-combo-multi__box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  min-height: 42px;
  padding: 0 0.55rem;
  border: 1px solid #d0d7e2;
  border-radius: 8px;
  background: #fff;
  cursor: text;
  box-sizing: border-box;
}
.sg-combo--chip .sg-combo-multi__box:focus-within {
  border-color: #0d9488;
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}
.sg-combo--chip [data-sg-combo-input] {
  flex: 1 1 6rem;
  min-width: 5rem;
  width: auto;
  min-height: 0 !important;
  height: 1.6rem;
  padding: 0.15rem 0.2rem !important;
  border: 0 !important;
  outline: none;
  background: transparent;
  box-shadow: none !important;
  font: inherit;
}
.sg-combo--chip [data-sg-combo-input][hidden] {
  display: none !important;
}
.sg-combo--multi .sg-combo-multi__box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  min-height: 42px;
  padding: 0 0.55rem;
  border: 1px solid #d0d7e2;
  border-radius: 8px;
  background: #fff;
  cursor: text;
  box-sizing: border-box;
}
.sg-combo--multi .sg-combo-multi__box:focus-within {
  border-color: #0d9488;
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}
.sg-combo--multi [data-sg-multi-search] {
  flex: 1 1 6rem;
  min-width: 5rem;
  width: auto;
  min-height: 0 !important;
  height: 1.6rem;
  padding: 0.15rem 0.2rem !important;
  border: 0 !important;
  outline: none;
  background: transparent;
  box-shadow: none !important;
  font: inherit;
}
.sg-combo-multi__chips {
  display: contents;
}
.sg-combo-multi__chip {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.15rem 0.35rem 0.15rem 0.5rem;
  border-radius: 3px;
  font-size: 0.75rem;
  font-weight: 600;
  background: #e2e8f0;
  color: #334155;
  border: 1px solid #cbd5e1;
  max-width: 100%;
}
.sg-combo-multi__chip-rm {
  appearance: none;
  border: 0;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0 0.15rem;
  border-radius: 2px;
}
.sg-combo-multi__chip-rm:hover {
  background: rgba(15, 23, 42, 0.08);
  color: #0f172a;
}
.sg-partecipante-add {
  position: relative;
  margin-bottom: 0.85rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}
.sg-partecipante-add .sg-enroll-suggest {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 20;
  max-height: 12rem;
  overflow: auto;
  margin: 0;
  padding: 0.25rem;
  background: #fff;
  border: 1px solid #d0d7e2;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}
.sg-partecipante-add .sg-enroll-suggest__item {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 0.45rem 0.55rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.86rem;
}

@media (max-width: 768px) {
  /* Un solo scroll: side + form scorrono insieme; footer resta fisso in basso */
  .sg-modal-scheda__body {
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
  .sg-modal-scheda__side {
    width: 100%;
    border-right: 0;
    border-bottom: 1px solid #f1f5f9;
    max-height: none;
    overflow: visible;
    padding: 0.65rem 0.75rem 0.5rem;
    flex: 0 0 auto;
  }
  .sg-modal-scheda__main {
    overflow: visible;
    flex: 1 0 auto;
    padding: 0.65rem 0.75rem 1rem;
  }
  .sg-scheda__id--hero {
    gap: 0.5rem;
    margin-bottom: 0.25rem;
  }
  .sg-scheda__name {
    font-size: 0.95rem;
  }
  .sg-scheda__hr {
    margin: 0.45rem 0;
  }
  .sg-scheda__block {
    margin-bottom: 0.15rem;
  }
  .sg-scheda__field {
    margin-bottom: 0.3rem;
  }
}

/* ——— Scheda iscritto: tasto WA + modale chat ——— */
.sg-scheda__phone-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  min-width: 0;
}
.sg-wa-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #25d366;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
  flex-shrink: 0;
}
.sg-wa-btn:hover { background: #1ebe57; }
.sg-wa-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.sg-wa-btn--solo {
  width: auto;
  border-radius: 999px;
  padding: 0 0.75rem 0 0.45rem;
  font-size: 0.82rem;
  font-weight: 600;
}
.sg-wa-btn__ico {
  width: 20px;
  height: 20px;
  display: block;
}

.sg-wa-dialog {
  padding: 0;
  border: 0;
  border-radius: 14px;
  /* +30% rispetto a 420px */
  width: min(546px, calc(100vw - 1.25rem));
  max-width: calc(100vw - 1.25rem);
  max-height: min(85dvh, 640px);
  background: transparent;
  box-shadow: none;
}
.sg-wa-dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
}
.sg-wa-dialog__panel {
  display: flex;
  flex-direction: column;
  max-height: min(85dvh, 640px);
  background: #efeae2;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.28);
  border: 1px solid #d1d7db;
}
.sg-wa-dialog__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.65rem 0.75rem;
  background: #075e54;
  color: #fff;
}
.sg-wa-dialog__head-brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}
.sg-wa-dialog__logo {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #25d366;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sg-wa-dialog__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 650;
}
.sg-wa-dialog__sub {
  margin: 0.1rem 0 0;
  font-size: 0.72rem;
  opacity: 0.88;
  white-space: nowrap;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
  text-overflow: ellipsis;
  max-width: 20rem;
}
.sg-wa-dialog__close {
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  cursor: pointer;
}
.sg-wa-dialog__close:hover { background: rgba(255, 255, 255, 0.12); }
.sg-wa-dialog__messages {
  flex: 1 1 auto;
  min-height: 140px;
  max-height: 52dvh;
  overflow: auto;
  padding: 0.55rem 0.65rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  gap: 0.28rem;
}
.sg-wa-dialog__empty {
  margin: auto;
  text-align: center;
  color: #667781;
  font-size: 0.86rem;
  padding: 1rem;
}
.sg-wa-dialog__row {
  display: flex;
  flex: 0 0 auto;
  width: 100%;
}
.sg-wa-dialog__row--out { justify-content: flex-end; }
.sg-wa-dialog__row--in { justify-content: flex-start; }
.sg-wa-dialog__bubble {
  display: block;
  width: fit-content;
  max-width: min(88%, 28rem);
  height: fit-content;
  padding: 0.28rem 0.5rem 0.18rem;
  border-radius: 8px;
  font-size: 0.86rem;
  line-height: 1.3;
  box-shadow: 0 1px 0.5px rgba(15, 23, 42, 0.08);
}
.sg-wa-dialog__text {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}
.sg-wa-dialog__row--out .sg-wa-dialog__bubble { background: #d9fdd3; }
.sg-wa-dialog__row--in .sg-wa-dialog__bubble { background: #fff; }
.sg-wa-dialog__meta {
  margin: 0.1rem 0 0;
  padding: 0;
  font-size: 0.65rem;
  line-height: 1.1;
  color: #667781;
  text-align: right;
  white-space: nowrap;
}
.sg-wa-dialog__composer {
  display: flex;
  gap: 0.45rem;
  align-items: flex-end;
  padding: 0.55rem 0.65rem;
  background: #f0f2f5;
  border-top: 1px solid #e9edef;
}
.sg-wa-dialog__composer textarea {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  max-height: 120px;
  resize: vertical;
  border: 0;
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  font: inherit;
  background: #fff;
}
.sg-wa-dialog__send {
  min-height: 44px;
  min-width: 4.5rem;
  border: 0;
  border-radius: 10px;
  background: #128c7e;
  color: #fff;
  font-weight: 650;
  font-size: 0.88rem;
  cursor: pointer;
  padding: 0 0.85rem;
}
.sg-wa-dialog__send:hover { background: #0e7a6e; }
.sg-wa-dialog__send:disabled { opacity: 0.45; cursor: not-allowed; }
.sg-wa-dialog__foot {
  margin: 0;
  padding: 0.35rem 0.75rem 0.55rem;
  background: #f0f2f5;
  font-size: 0.78rem;
  text-align: center;
}
.sg-wa-dialog__foot a { color: #128c7e; }
.sg-wa-dialog__foot .sg-linkish {
  border: 0;
  background: none;
  color: #128c7e;
  cursor: pointer;
  font: inherit;
  padding: 0;
  text-decoration: underline;
}

/* ——— Scheda: modale Comunicazioni (WA + email) ——— */
.sg-head-action--comms .sg-head-action__ico { color: #0369a1; }
.sg-comms-dialog {
  padding: 0;
  border: 0;
  border-radius: 14px;
  width: min(960px, calc(100vw - 1.25rem));
  max-width: calc(100vw - 1.25rem);
  max-height: min(90dvh, 780px);
  background: transparent;
  box-shadow: none;
}
.sg-comms-dialog::backdrop {
  background: rgba(15, 23, 42, 0.5);
}
.sg-comms-dialog__panel {
  display: flex;
  flex-direction: column;
  max-height: min(90dvh, 780px);
  background: #f8fafc;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid #d1d7db;
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.28);
}
.sg-comms-dialog__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: #0f766e;
  color: #fff;
}
.sg-comms-dialog__title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
}
.sg-comms-dialog__sub {
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
  opacity: 0.9;
}
.sg-comms-dialog__close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: rgba(255,255,255,0.12);
  color: #fff;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}
.sg-comms-dialog__close:hover { background: rgba(255,255,255,0.2); }
.sg-comms-dialog__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  min-height: 0;
  flex: 1;
  overflow: hidden;
}
.sg-comms-dialog__col {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  border-right: 1px solid #e2e8f0;
  background: #fff;
}
.sg-comms-dialog__col--mail { border-right: 0; }
.sg-comms-dialog__col-title {
  margin: 0;
  padding: 0.65rem 0.85rem 0.4rem;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
}
.sg-comms-dialog__msgs {
  flex: 1;
  min-height: 220px;
  max-height: none;
  background: #efeae2;
}
.sg-comms-dialog__composer { flex-shrink: 0; }
.sg-comms-dialog__foot {
  margin: 0;
  padding: 0.45rem 0.85rem 0.65rem;
  font-size: 0.78rem;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
}
.sg-comms-dialog__foot a { color: #0f766e; }
.sg-comms-dialog__empty {
  margin: 0.75rem 0.85rem;
  font-size: 0.85rem;
}
.sg-comms-mail-list {
  list-style: none;
  margin: 0;
  padding: 0 0.65rem 0.65rem;
  overflow: auto;
  flex: 1;
  min-height: 220px;
}
.sg-comms-mail-list__item {
  padding: 0.55rem 0.45rem;
  border-bottom: 1px solid #eef2f7;
}
.sg-comms-mail-list__item.is-unread .sg-comms-mail-list__subj { font-weight: 800; }
.sg-comms-mail-list__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.4rem;
}
.sg-comms-mail-list__subj {
  font-size: 0.88rem;
  line-height: 1.3;
}
.sg-comms-mail-list__dir {
  flex-shrink: 0;
  font-size: 0.68rem;
}
.sg-comms-mail-list__snip {
  margin: 0.25rem 0 0.35rem;
  font-size: 0.78rem;
  color: #64748b;
  line-height: 1.35;
}
@media (max-width: 760px) {
  .sg-comms-dialog__grid {
    grid-template-columns: 1fr;
    overflow: auto;
  }
  .sg-comms-dialog__col {
    border-right: 0;
    border-bottom: 1px solid #e2e8f0;
    max-height: 46dvh;
  }
}

/* ——— Studio Gem WhatsApp Business layout ——— */
.sx-wab {
  --wab-green: #075e54;
  --wab-green-2: #128c7e;
  --wab-out: #d9fdd3;
  --wab-in: #ffffff;
  --wab-bg: #efeae2;
  --wab-side: #ffffff;
  --wab-border: #e9edef;
  display: grid;
  grid-template-columns: minmax(260px, 34%) 1fr;
  height: min(78vh, 720px);
  min-height: min(78vh, 720px);
  max-width: 1100px;
  border: 1px solid var(--wab-border);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
  background: var(--wab-side);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}
.sx-wab__sidebar {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
  border-right: 1px solid var(--wab-border);
  background: var(--wab-side);
}
.sx-wab__side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: #f0f2f5;
  border-bottom: 1px solid var(--wab-border);
}
.sx-wab__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #111b21;
}
.sx-wab__sub { margin: 0.15rem 0 0; font-size: 0.72rem; color: #667781; }
.sx-wab__icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 0.7rem;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--wab-border);
  color: #54656f;
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none !important;
}
.sx-wab__search { padding: 0.55rem 0.75rem; background: #f0f2f5; }
.sx-wab__search input {
  width: 100%;
  border: 0;
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  background: #fff;
  font-size: 0.9rem;
  min-height: 40px;
}
.sx-wab__filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.45rem 0.75rem 0.65rem;
  background: #f0f2f5;
  border-bottom: 1px solid var(--wab-border);
}
.sx-wab__chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 0.65rem;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--wab-border);
  color: #54656f;
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none !important;
}
.sx-wab__chip.is-on { background: #e7fce3; border-color: #b7e3a1; color: #0b6b3a; }
.sx-wab__chip--warn { background: #fff7ed; border-color: #fed7aa; color: #c2410c; }
.sx-wab__chats {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1;
}
.sx-wab__chat {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 0.65rem;
  align-items: center;
  padding: 0.7rem 0.85rem;
  min-height: 72px;
  color: inherit;
  text-decoration: none !important;
  border-bottom: 1px solid #f0f2f5;
}
.sx-wab__chat:hover { background: #f5f6f6; }
.sx-wab__chat.is-active { background: #f0f2f5; }
.sx-wab__avatar {
  width: 48px; height: 48px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: #dfe5e7;
  color: #54656f;
  font-weight: 700;
  font-size: 1.1rem;
}
.sx-wab__avatar--lg { width: 40px; height: 40px; font-size: 1rem; }
.sx-wab__chat-main { min-width: 0; }
.sx-wab__chat-top {
  display: flex; justify-content: space-between; gap: 0.5rem; align-items: baseline;
}
.sx-wab__chat-top strong {
  font-size: 0.95rem; color: #111b21;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sx-wab__chat-top time { font-size: 0.72rem; color: #667781; flex: 0 0 auto; }
.sx-wab__chat-preview {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.82rem;
  color: #667781;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sx-wab__badge {
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: #25d366;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  display: grid; place-items: center;
}
.sx-wab__empty, .sx-wab__empty-msg {
  padding: 1.25rem;
  color: #667781;
  font-size: 0.9rem;
  text-align: center;
}

.sx-wab__pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
  background: var(--wab-bg);
  background-image:
    radial-gradient(rgba(0,0,0,0.03) 1px, transparent 1px);
  background-size: 18px 18px;
}
.sx-wab__pane--empty { align-items: center; justify-content: center; }
.sx-wab__empty-pane {
  max-width: 22rem;
  text-align: center;
  padding: 1.5rem;
  color: #41525d;
}
.sx-wab__empty-pane h2 { margin: 0 0 0.5rem; font-size: 1.35rem; color: #41525d; }
.sx-wab__empty-pane p { margin: 0.35rem 0; font-size: 0.92rem; line-height: 1.45; }
.sx-wab__hint { color: #667781; font-size: 0.82rem !important; }

.sx-wab__chat-head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.85rem;
  background: #f0f2f5;
  border-bottom: 1px solid var(--wab-border);
  flex: 0 0 auto;
}
.sx-wab__back {
  display: none;
  width: 36px; height: 36px;
  place-items: center;
  font-size: 1.6rem;
  color: #54656f;
  text-decoration: none !important;
}
.sx-wab__chat-head-text { flex: 1; min-width: 0; }
.sx-wab__chat-head-text strong {
  display: block;
  font-size: 0.95rem;
  color: #111b21;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sx-wab__chat-head-text span {
  display: block;
  font-size: 0.75rem;
  color: #667781;
}
.sx-wab__chat-head-actions {
  display: flex; gap: 0.5rem; flex-wrap: wrap;
}
.sx-wab__chat-head-actions a {
  font-size: 0.78rem;
  font-weight: 600;
  color: #027eb5;
  text-decoration: none !important;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 0 0.35rem;
}

.sx-wab__messages {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0.85rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-height: 0;
  max-height: none;
}
.sx-wab__row { display: flex; width: 100%; }
.sx-wab__row--out { justify-content: flex-end; }
.sx-wab__row--in { justify-content: flex-start; }
.sx-wab__bubble {
  position: relative;
  max-width: min(78%, 32rem);
  padding: 0.4rem 0.55rem 0.3rem 0.65rem;
  border-radius: 8px;
  font-size: 0.92rem;
  line-height: 1.35;
  box-shadow: 0 1px 0.5px rgba(11, 20, 26, 0.13);
}
.sx-wab__bubble--out {
  background: var(--wab-out);
  border-top-right-radius: 2px;
}
.sx-wab__bubble--in {
  background: var(--wab-in);
  border-top-left-radius: 2px;
}
.sx-wab__tpl-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #027eb5;
  margin-bottom: 0.2rem;
}
.sx-wab__bubble-text {
  white-space: pre-wrap;
  word-break: break-word;
  color: #111b21;
  padding-right: 3.2rem;
  min-height: 1.2em;
}
.sx-wab__bubble-foot {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.25rem;
  margin-top: -0.85rem;
  min-height: 1rem;
}
.sx-wab__bubble-foot time {
  font-size: 0.68rem;
  color: #667781;
}
.sx-wab__ticks {
  display: inline-block;
  width: 1rem;
  height: 0.7rem;
  position: relative;
  flex: 0 0 auto;
}
.sx-wab__ticks::before,
.sx-wab__ticks::after {
  content: "";
  position: absolute;
  width: 0.35rem;
  height: 0.55rem;
  border-right: 1.5px solid #8696a0;
  border-bottom: 1.5px solid #8696a0;
  transform: rotate(40deg);
  top: 0;
}
.sx-wab__ticks::before { left: 0.05rem; }
.sx-wab__ticks--sent::after { display: none; }
.sx-wab__ticks--delivered::after,
.sx-wab__ticks--read::after { left: 0.35rem; }
.sx-wab__ticks--read::before,
.sx-wab__ticks--read::after { border-color: #53bdeb; }
.sx-wab__ticks--error {
  width: auto;
  color: #ea0038;
  font-weight: 800;
  font-size: 0.8rem;
  line-height: 1;
}
.sx-wab__ticks--error::before,
.sx-wab__ticks--error::after { display: none; }
.sx-wab__ticks--error::before {
  content: "!";
  display: inline;
  position: static;
  border: 0;
  width: auto;
  height: auto;
  transform: none;
}

.sx-wab__composer {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  background: #f0f2f5;
  border-top: 1px solid var(--wab-border);
  flex: 0 0 auto;
  margin-top: auto;
}
.sx-wab__composer textarea {
  flex: 1;
  min-height: 44px;
  max-height: 120px;
  resize: vertical;
  border: 0;
  border-radius: 24px;
  padding: 0.65rem 1rem;
  font: inherit;
  font-size: 0.92rem;
  background: #fff;
}
.sx-wab__send {
  min-height: 44px;
  min-width: 72px;
  border: 0;
  border-radius: 24px;
  padding: 0 1rem;
  background: var(--wab-green-2);
  color: #fff;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
}
.sx-wab__send:hover { background: var(--wab-green); }
.sx-wab__composer-hint {
  margin: 0;
  padding: 0.25rem 0.85rem 0.55rem;
  background: #f0f2f5;
  font-size: 0.7rem;
  color: #667781;
  flex: 0 0 auto;
}
.sx-wab__composer--off {
  justify-content: center;
  color: #c2410c;
  font-size: 0.88rem;
  font-weight: 600;
}

@media (max-width: 768px) {
  .sx-wab {
    grid-template-columns: 1fr;
    height: calc(100dvh - var(--topbar-h, 64px) - var(--tab-h, 64px) - 2rem);
    min-height: calc(100dvh - var(--topbar-h, 64px) - var(--tab-h, 64px) - 2rem);
    max-width: none;
    border-radius: 0;
    margin: 0 -0.75rem;
  }
  .sx-wab--thread .sx-wab__sidebar { display: none; }
  .sx-wab:not(.sx-wab--thread) .sx-wab__pane--empty { display: none; }
  .sx-wab__back { display: grid; }
  .sx-wab__messages { max-height: none; flex: 1 1 auto; min-height: 0; }
}

/* ——— Studio Gem: utenti / profili permessi ——— */
.sg-users-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
  font-size: 0.9rem;
}
.sg-users-table th,
.sg-users-table td {
  text-align: left;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border, #e2e8f0);
  vertical-align: middle;
}
.sg-users-table th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  background: #f8fafc;
}
.sg-users-table__actions { text-align: right; white-space: nowrap; }
.sg-role-badge.sg-role-admin { background: #fee2e2; color: #b91c1c; }
.sg-role-badge.sg-role-editor { background: #dbeafe; color: #1d4ed8; }
.sg-role-badge.sg-role-viewer { background: #e2e8f0; color: #475569; }
.sg-user-form label { display: block; margin: 0.75rem 0 0.3rem; font-weight: 600; font-size: 0.86rem; }
.sg-user-form input[type="text"],
.sg-user-form input[type="email"],
.sg-user-form input[type="password"],
.sg-user-form select,
.sg-user-form textarea {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.sg-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 1rem;
  align-items: end;
}
@media (max-width: 768px) {
  .sg-form-grid { grid-template-columns: 1fr; }
}
.sg-form-check { padding-bottom: 0.35rem; }
.sg-access-title { font-weight: 700; margin: 1rem 0 0.5rem; }
.sg-perm-mode-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.sg-perm-mode {
  flex: 1 1 8rem;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.45rem 0.6rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: #475569;
  background: #fff;
  cursor: pointer;
}
.sg-perm-mode input { accent-color: var(--accent, #0f766e); }
.sg-perm-mode.is-active {
  border-color: #0f766e;
  background: #ecfdf5;
  color: #065f46;
}
.sg-perm-banner {
  border-radius: 10px;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  margin: 0.75rem 0;
}
.sg-perm-banner--ok {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
}
.sg-perm-matrix {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  margin-top: 0.5rem;
}
.sg-perm-matrix__head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.45rem 0.85rem;
  background: #f8fafc;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  border-bottom: 1px solid #e2e8f0;
}
.sg-perm-matrix__h-on { width: 3.2rem; text-align: center; }
.sg-perm-matrix__h-label { flex: 1; }
.sg-perm-matrix__h-rw { width: 11rem; text-align: right; }
.sg-perm-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid #f1f5f9;
  min-height: 44px;
  background: #fff;
}
.sg-perm-row:last-child { border-bottom: 0; }
.sg-perm-row__on { width: 3.2rem; display: flex; justify-content: center; margin: 0; }
.sg-perm-row__on input { width: 1.05rem; height: 1.05rem; accent-color: var(--accent, #0f766e); }
.sg-perm-row__label { flex: 1 1 8rem; font-weight: 600; font-size: 0.88rem; }
.sg-perm-row__label.is-off { color: #94a3b8; font-weight: 500; }
.sg-perm-row__rw { display: flex; gap: 0.35rem; flex-wrap: wrap; justify-content: flex-end; }
.sg-perm-row__off { font-size: 0.75rem; margin-left: auto; }
.sg-perm-chip-opt {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.28rem 0.55rem;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #94a3b8;
  cursor: pointer;
  margin: 0;
}
.sg-perm-chip-opt input { position: absolute; opacity: 0; pointer-events: none; width: 0; height: 0; }
.sg-perm-chip-opt.is-active {
  border-color: #99f6e4;
  background: #f0fdfa;
  color: #0f766e;
}
.sg-perm-row__select { flex: 0 1 12rem; min-width: 9rem; }
.sg-builtin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
}
.sg-builtin-card {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.85rem 1rem;
  background: #f8fafc;
}
.sg-builtin-card--admin { border-color: #fecaca; background: #fff1f2; }
.sg-builtin-card--editor { border-color: #bfdbfe; background: #eff6ff; }
.sg-builtin-card--viewer { border-color: #e2e8f0; }
.sg-perm-chips { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.sg-perm-chip {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  background: #e2e8f0;
  color: #334155;
}
.sg-perm-chip--read { background: #dbeafe; color: #1d4ed8; }
.sg-perm-chip--write { background: #fef3c7; color: #b45309; }
.sg-perm-chip--full { background: #d1fae5; color: #047857; }
.sg-preset-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin: 0.75rem 0 0.25rem;
}
.btn-sm {
  min-height: 36px;
  padding: 0.25rem 0.65rem;
  font-size: 0.8rem;
}
.btn-danger {
  background: #b91c1c;
  color: #fff;
  border: 0;
}
.btn-danger:hover { background: #991b1b; }

/* ——— Chat interna team ——— */
.sx-nav-badge {
  margin-left: auto;
  flex: 0 0 auto;
  position: relative;
  z-index: 5;
  min-width: 1.4rem;
  height: 1.4rem;
  padding: 0 0.4rem;
  border-radius: 999px;
  background: #dc2626 !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  font-size: 0.78rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1.4rem;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.2);
  overflow: visible;
}
.sx-nav-badge[hidden] {
  display: none !important;
}
.sx-nav-link.active .sx-nav-badge,
.sx-nav-link:hover .sx-nav-badge {
  background: #dc2626 !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}
.sx-team-new-dm {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  padding: 0.5rem 0.75rem;
}
.sx-team-new-dm select {
  flex: 1;
  min-height: 40px;
  min-width: 0;
}
#sx-chat-messages .sx-wab__bubble-text {
  white-space: pre-wrap;
  word-break: break-word;
}

/* ——— Posta (UX tipo Bitrix, colori StarGem) ——— */
.sx-mail-shell {
  margin: -1.25rem -1.5rem -2rem;
  height: calc(100dvh - var(--topbar-h, 64px));
  min-height: 420px;
  display: flex;
  flex-direction: column;
}
.sx-mail {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 220px minmax(280px, 360px) minmax(0, 1fr);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: var(--shadow);
}
.sx-mail__nav {
  background: #f4f6f8;
  color: var(--text);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  border-right: 1px solid var(--border);
}
.sx-mail__compose-cta {
  padding: 0.85rem 0.85rem 0.35rem;
}
.sx-mail__compose-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: 100%;
  min-height: 44px;
  padding: 0.55rem 0.85rem;
  border-radius: 8px;
  background: #2563eb;
  color: #fff !important;
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none !important;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.25);
  transition: background 0.15s ease, transform 0.12s ease;
}
.sx-mail__compose-btn:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
}
.sx-mail__compose-btn-icon {
  display: inline-flex;
}
.sx-mail__compose-btn-icon .sx-icon { width: 1.05rem; height: 1.05rem; color: #fff; }
.sx-mail__icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: #475569;
  text-decoration: none !important;
  cursor: pointer;
  padding: 0;
}
.sx-mail__icon-btn:hover {
  background: #eff6ff;
  color: #2563eb;
  border-color: #bfdbfe;
}
.sx-mail__icon-btn--light {
  background: #fff;
  color: #64748b;
}
.sx-mail__icon-btn .sx-icon { width: 1.1rem; height: 1.1rem; }
.sx-mail__nav-section {
  padding: 0.55rem 0.55rem 0.25rem;
}
.sx-mail__nav-section--foot {
  margin-top: auto;
  padding-bottom: 0.85rem;
  border-top: 1px solid var(--border);
}
.sx-mail__nav-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #94a3b8;
  padding: 0.35rem 0.45rem;
}
.sx-mail__nav-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
}
.sx-mail__folders-refresh {
  margin: 0;
  padding: 0;
}
.sx-mail__icon-btn--xs {
  width: 1.65rem;
  height: 1.65rem;
  min-height: 1.65rem;
  padding: 0;
}
.sx-mail__icon-btn--xs .sx-icon {
  width: 0.95rem;
  height: 0.95rem;
}
.sx-mail__accounts,
.sx-mail__folders {
  list-style: none;
  margin: 0;
  padding: 0;
}
.sx-mail__account,
.sx-mail__folder {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 0.5rem;
  border-radius: 8px;
  color: #334155;
  text-decoration: none !important;
  min-height: 40px;
  position: relative;
  font-size: 0.88rem;
}
.sx-mail__badge {
  margin-left: auto;
  flex: 0 0 auto;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: #2563eb;
  color: #fff !important;
  font-size: 0.7rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.sx-mail__account:hover,
.sx-mail__folder:hover {
  background: #e8eef5;
  color: #0f172a;
}
.sx-mail__account.is-active,
.sx-mail__folder.is-active {
  background: #dbeafe;
  color: #1d4ed8;
  font-weight: 600;
}
.sx-mail__account-icon {
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  background: #e0f2fe;
  color: #0284c7;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.sx-mail__account-icon .sx-icon { width: 1rem; height: 1rem; }
.sx-mail__account-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.sx-mail__account-main strong {
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
  text-overflow: ellipsis;
}
.sx-mail__account-meta {
  font-size: 0.68rem;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
  text-overflow: ellipsis;
}
.sx-mail__account-error {
  margin: 0.25rem 0.5rem 0;
  font-size: 0.72rem;
  color: #dc2626;
}
.sx-mail__nav-empty {
  padding: 0.5rem;
  font-size: 0.82rem;
  color: #94a3b8;
}
.sx-mail__folder .sx-icon {
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;
  color: #64748b;
}
.sx-mail__folder.is-active .sx-icon { color: #2563eb; }
.sx-mail__folder-form {
  display: flex;
  gap: 0.35rem;
  padding: 0.35rem 0.45rem 0.5rem;
}
.sx-mail__folder-form input {
  flex: 1;
  min-width: 0;
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 0.35rem 0.5rem;
  font: inherit;
  font-size: 0.78rem;
}
.sx-mail__folder-form input::placeholder { color: #94a3b8; }
.sx-mail__nav-settings {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0.15rem 0.45rem 0;
  padding: 0.55rem 0.5rem;
  border-radius: 8px;
  color: #64748b;
  text-decoration: none !important;
  font-size: 0.84rem;
  min-height: 40px;
}
.sx-mail__nav-settings:hover {
  background: #e8eef5;
  color: #0f172a;
}
.sx-mail__nav-settings .sx-icon { width: 1rem; height: 1rem; }

.sx-mail__list {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--border);
  background: #fafbfc;
}
.sx-mail__list-head {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.65rem 0.75rem;
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.sx-mail__filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.55rem 0.75rem;
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.sx-mail__filter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  color: #475569;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none !important;
}
.sx-mail__filter:hover {
  border-color: #93c5fd;
  color: #1d4ed8;
  background: #eff6ff;
}
.sx-mail__filter.is-active {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff !important;
}
.sx-mail__sort-hint {
  margin-left: auto;
  font-size: 0.75rem;
  color: #94a3b8;
  font-weight: 600;
}
.sx-mail__day-label {
  padding: 0.55rem 0.85rem 0.25rem;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #94a3b8;
  background: #fafbfc;
  position: sticky;
  top: 0;
  z-index: 1;
}
.sx-mail__search {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  padding: 0 0.55rem;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}
.sx-mail__search-icon {
  color: var(--muted);
  display: inline-flex;
}
.sx-mail__search-icon .sx-icon { width: 1rem; height: 1rem; }
.sx-mail__search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 0.88rem;
  outline: none;
}
.sx-mail__sync { margin: 0; }
.sx-mail__sync-err {
  font-size: 0.72rem;
  font-weight: 700;
  color: #b91c1c;
  white-space: nowrap;
  max-width: 7rem;
  overflow: hidden;
  text-overflow: ellipsis;
}
#sx-mail-ajax {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.sx-mail__items {
  list-style: none;
  margin: 0;
  padding: 0;
}
.sx-mail__items > li {
  margin: 0;
  padding: 0;
  list-style: none;
}
.sx-mail-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 4.75rem;
  align-items: start;
  border-bottom: 1px solid var(--border);
  border-left: 3px solid transparent;
  background: #fff;
  color: inherit;
  min-height: 68px;
  box-sizing: border-box;
  transition: background 0.12s ease;
}
.sx-mail-row:hover { background: #f1f5f9; }
.sx-mail-row.is-active {
  background: #dbeafe;
  border-left-color: #2563eb;
}
.sx-mail-row.is-unread {
  background: #f0f7ff;
  border-left-color: #2563eb;
}
.sx-mail-row.is-unread:hover { background: #e8f1fc; }
.sx-mail-row.is-unread.is-active {
  background: #dbeafe;
  border-left-color: #1d4ed8;
}
.sx-mail-row.is-unread .sx-mail-row__from,
.sx-mail-row.is-unread .sx-mail-row__subject {
  font-weight: 800;
  color: #0f172a;
}
.sx-mail-row.is-unread .sx-mail-row__preview {
  color: #475569;
  font-weight: 500;
}
.sx-mail-row.is-unread .sx-mail-row__when {
  color: #1d4ed8;
  font-weight: 700;
}
.sx-mail-row.is-read .sx-mail-row__from {
  font-weight: 500;
  color: #64748b;
}
.sx-mail-row.is-read .sx-mail-row__subject {
  font-weight: 500;
  color: #64748b;
}
.sx-mail-row.is-read .sx-mail-row__preview {
  color: #94a3b8;
}
.sx-mail-row.is-read .sx-mail-row__avatar {
  opacity: 0.72;
  filter: saturate(0.85);
}
.sx-mail-row__link {
  display: grid;
  grid-template-columns: 2.25rem minmax(0, 1fr);
  column-gap: 0.65rem;
  align-items: start;
  padding: 0.7rem 0.55rem 0.7rem 0.7rem;
  min-width: 0;
  color: inherit;
  text-decoration: none !important;
}
.sx-mail-row__aside {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 0.28rem;
  min-width: 0;
  width: 4.75rem;
  padding: 0.7rem 0.55rem 0.55rem 0;
  box-sizing: border-box;
}
.sx-mail-row__when {
  font-size: 0.72rem;
  line-height: 1.2;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: right;
  min-height: 1rem;
}
.sx-mail-row__meta-icons {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.3rem;
  min-height: 0.85rem;
}
.sx-mail-row__dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: #2563eb;
  box-shadow: 0 0 0 2px #f0f7ff;
}
.sx-mail-row__avatar {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: linear-gradient(135deg, #1d4ed8, #38bdf8);
  color: #fff;
  font-weight: 700;
  font-size: 0.88rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  position: relative;
  overflow: hidden;
  margin-top: 0;
}
.sx-mail-row__avatar .sx-email-avatar__img,
.sx-mail-read__avatar .sx-email-avatar__img,
.prj-avatar .sx-email-avatar__img,
.sx-email-avatar__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.sx-email-avatar__img.is-loaded { opacity: 1; }
[data-email-avatar].has-photo .sx-email-avatar__ini { opacity: 0; }
.sx-email-avatar__ini {
  position: relative;
  z-index: 0;
  line-height: 1;
}
.sx-mail-row__main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding-top: 0.05rem;
}
.sx-mail-row__from-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  max-width: 100%;
}
.sx-mail-row__from {
  font-size: 0.88rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
  text-overflow: ellipsis;
  min-width: 0;
}
.sx-mail-row__subject {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
  text-overflow: ellipsis;
}
.sx-mail-row__preview {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
  text-overflow: ellipsis;
}
.sx-mail-row__tag {
  flex: 0 0 auto;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  background: rgba(15, 118, 110, 0.12);
  color: #0f766e;
  align-self: center;
  text-transform: uppercase;
}
.sx-mail-row__tag--lead {
  background: rgba(37, 99, 235, 0.14);
  color: #1d4ed8;
}
.sx-mail-row__tag--prospect {
  background: rgba(124, 58, 237, 0.14);
  color: #6d28d9;
}
.sx-mail-row__tag--cliente {
  background: rgba(15, 118, 110, 0.14);
  color: #0f766e;
}
.sx-mail-row__tag--ex {
  background: rgba(100, 116, 139, 0.18);
  color: #475569;
}
.sx-mail-row__crm {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  width: 100%;
  min-height: 32px;
  box-sizing: border-box;
}
.sx-mail-row__crm-form { margin: 0; }
.sx-mail-row__crm-spacer {
  display: block;
  width: 2.85rem;
  height: 32px;
}
.sx-mail-row__crm-btn,
.sx-mail-row__crm-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  min-width: 2.85rem;
  padding: 0.25rem 0.4rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
  color: #1d4ed8;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none !important;
  cursor: pointer;
  white-space: nowrap;
}
.sx-mail-row__crm-btn:hover,
.sx-mail-row__crm-link:hover {
  border-color: #2563eb;
  background: #eff6ff;
}
@media (max-width: 768px) {
  .sx-mail-row {
    grid-template-columns: minmax(0, 1fr) 3.4rem;
    min-height: 64px;
  }
  .sx-mail-row__aside {
    width: 3.4rem;
    padding: 0.65rem 0.55rem 0.5rem 0;
  }
  .sx-mail-row__crm { display: none; }
  .sx-mail-row__link {
    grid-template-columns: 2rem minmax(0, 1fr);
    padding: 0.65rem 0.45rem 0.65rem 0.65rem;
    column-gap: 0.55rem;
  }
  .sx-mail-row__avatar {
    width: 2rem;
    height: 2rem;
    font-size: 0.8rem;
  }
  .sx-mail-row__when { font-size: 0.7rem; }
}
.sx-mail-read__crm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
  margin-right: auto;
}
.sx-mail-read__crm-form { margin: 0; }
.sx-mail-read__crm-name {
  display: block;
  margin: 0;
  margin-right: auto;
  font-size: 0.78rem;
}
.sx-mail-read__sender-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
  width: 100%;
  margin-top: 0.45rem;
}
.sx-mail-read__quick-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  flex: 0 0 auto;
  margin-left: auto;
}
.sx-mail__empty-list {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.sx-mail__read {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  background: #fff;
}
.sx-mail-read__head {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.9rem 1.15rem;
  border-bottom: 1px solid var(--border);
  background: #fff;
}
.sx-mail-read__back {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none !important;
  font-size: 1.1rem;
  flex: 0 0 auto;
}
.sx-mail-read__head-main { min-width: 0; flex: 1; }
.sx-mail-read__head-main h2 {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.3;
  word-break: break-word;
}
.sx-mail-read__meta {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.4;
}
.sx-mail-read__meta strong { color: var(--text); }
.sx-mail-read__actions,
.sx-mail-read__head-tools {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex: 0 0 auto;
}
.sx-mail-read__sender {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1.15rem;
  border-bottom: 1px solid var(--border);
  background: #fafbfc;
}
.sx-mail-read__avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: linear-gradient(135deg, #1d4ed8, #38bdf8);
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
}
.sx-mail-read__sender-main {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  font-size: 0.86rem;
}
.sx-mail-read__sender-main strong { color: var(--text); }
.sx-mail-read__addr {
  color: var(--muted);
  font-size: 0.8rem;
  word-break: break-all;
}
.sx-mail-read__to { font-size: 0.78rem; }
.sx-mail-read__when {
  flex: 0 0 auto;
  font-size: 0.78rem;
  color: var(--muted);
}
.sx-mail-read__body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 1.15rem 1.25rem 5rem;
}
.sx-mail-read__footer {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(6px);
}
.sx-mail-read__action {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 44px;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  color: #334155;
  text-decoration: none !important;
  font-weight: 600;
  font-size: 0.88rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}
.sx-mail-read__action:hover {
  border-color: #93c5fd;
  color: #1d4ed8;
  background: #eff6ff;
}
.sx-mail-read__action--danger {
  color: #b91c1c;
  border-color: #fecaca;
  background: #fff5f5;
}
.sx-mail-read__action--danger:hover {
  color: #991b1b;
  border-color: #f87171;
  background: #fee2e2;
}
.sx-mail-read__delete-form { margin: 0; }
.sx-mail-read__action .sx-icon { width: 1.1rem; height: 1.1rem; }
.sx-mail-read__action--icon {
  width: 44px;
  min-width: 44px;
  height: 44px;
  padding: 0;
  justify-content: center;
  border-radius: 10px;
}
.sx-mail-read__action--icon span { display: none; }
.sx-mail-read__action--reply-all .sx-icon {
  width: 1.2rem;
  height: 1.2rem;
}
.sx-mail__group-banner {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  padding: 0.45rem 0.85rem;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
  font-size: 0.82rem;
}
.sx-mail__group-banner a { font-weight: 600; }
.sx-mail-ctx {
  position: fixed;
  z-index: 2600;
  min-width: 12.5rem;
  max-width: min(18rem, calc(100vw - 1rem));
  padding: 0.3rem;
  margin: 0;
  list-style: none;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 0.65rem;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.16);
}
.sx-mail-ctx[hidden] { display: none !important; }
.sx-mail-ctx__item,
.sx-mail-ctx button {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 40px;
  padding: 0.4rem 0.7rem;
  border: 0;
  border-radius: 0.45rem;
  background: transparent;
  color: #0f172a;
  font: inherit;
  font-size: 0.88rem;
  text-align: left;
  cursor: pointer;
}
.sx-mail-ctx__item:hover,
.sx-mail-ctx button:hover { background: #f1f5f9; }
.sx-mail-ctx__item--danger { color: #b91c1c; }
.sx-mail-ctx__sep {
  height: 1px;
  margin: 0.25rem 0.35rem;
  background: #e2e8f0;
}
.sx-mail-ctx__label {
  padding: 0.35rem 0.7rem 0.15rem;
  font-size: 0.7rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.sx-mail-groups {
  max-width: 820px;
  margin: 0 auto;
  padding: 1rem 1rem 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.sx-mail-groups__head h1 { margin: 0.35rem 0 0.25rem; }
.sx-mail-groups__back { font-weight: 600; text-decoration: none; }
.sx-mail-groups__form,
.sx-mail-groups__rule-form,
.sx-mail-groups__form-inline {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.sx-mail-groups__form-inline,
.sx-mail-groups__rule-form {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-end;
}
.sx-mail-groups__form-inline select,
.sx-mail-groups__rule-form select,
.sx-mail-groups__rule-form input,
.sx-mail-groups__form input,
.sx-mail-groups__form select {
  min-height: 44px;
  flex: 1 1 10rem;
}
.sx-mail-groups__card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.sx-mail-groups__card-head h2 { margin: 0; font-size: 1.1rem; }
.sx-mail-groups__card-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.sx-mail-groups__rules {
  list-style: none;
  margin: 0 0 0.75rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.sx-mail-groups__rules li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: #fff;
}
@media (max-width: 768px) {
  .sx-mail-groups__form-inline,
  .sx-mail-groups__rule-form { flex-direction: column; align-items: stretch; }
}
.sx-mail-read__text {
  white-space: pre-wrap;
  line-height: 1.55;
  font-size: 0.92rem;
  color: var(--text);
  word-break: break-word;
}
.sx-mail-read__html {
  line-height: 1.5;
  font-size: 0.92rem;
  color: var(--text);
  overflow-x: auto;
  max-width: 100%;
  word-break: break-word;
}
.sx-mail-read__html img {
  max-width: 100%;
  height: auto;
}
.sx-mail-read__html table {
  max-width: 100%;
  border-collapse: collapse;
}
.sx-mail-read__html a {
  color: #2563eb;
  word-break: break-all;
}
.sx-mail-read__source {
  margin-top: 1.25rem;
  padding-top: 0.85rem;
  border-top: 1px dashed var(--border);
  font-size: 0.82rem;
  color: var(--muted);
}
.sx-mail-read__source summary {
  cursor: pointer;
  font-weight: 600;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  color: #64748b;
}
.sx-mail-read__source-pre {
  margin: 0.65rem 0 0;
  padding: 0.75rem 0.85rem;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid var(--border);
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.78rem;
  line-height: 1.45;
  color: #334155;
  max-height: 280px;
  overflow: auto;
}
.sx-mail-attachments {
  margin-bottom: 1rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(15, 118, 110, 0.08);
}
.sx-mail-attachments__label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 0.5rem;
}
.sx-mail-attachments__label .sx-icon { width: 0.95rem; height: 0.95rem; }
.sx-mail-attachments__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.sx-mail-attachments__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  text-decoration: none !important;
  color: var(--text);
  min-height: 44px;
}
.sx-mail-attachments__item:hover { border-color: var(--accent); }
.sx-mail-attachments__name {
  font-size: 0.86rem;
  word-break: break-all;
}
.sx-mail-attachments__size {
  flex: 0 0 auto;
  font-size: 0.75rem;
  color: var(--muted);
}
.sx-mail-row__attach {
  display: inline-flex;
  color: var(--muted);
}
.sx-mail-row__attach .sx-icon { width: 0.85rem; height: 0.85rem; }
.sx-mail-row__tag--sg {
  background: rgba(59, 130, 246, 0.16);
  color: #1d4ed8;
}
.sx-mail-row__tag--doc {
  background: rgba(16, 185, 129, 0.16);
  color: #047857;
}
.sx-mail-row__tag--forn {
  background: rgba(245, 158, 11, 0.18);
  color: #b45309;
}
.sx-mail-compose__to-wrap {
  position: relative;
}
.sx-mail-compose__suggest {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 2px);
  z-index: 20;
  max-height: 240px;
  overflow-y: auto;
}
.sx-mail-compose__suggest .sg-enroll-suggest__item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.55rem;
  text-align: left;
}
.sx-mail-compose__suggest .sg-enroll-suggest__item.is-active,
.sx-mail-compose__suggest .sg-enroll-suggest__item:hover {
  background: #eff6ff;
}
.sx-mail-compose__kind {
  margin-left: auto;
  font-size: 0.68rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.sx-mail-compose__to-hint {
  margin: 0.15rem 0 0;
  font-size: 0.78rem;
}
.sx-kv {
  display: grid;
  gap: 0.55rem;
  margin: 0;
}
.sx-kv > div {
  display: grid;
  grid-template-columns: 8rem minmax(0, 1fr);
  gap: 0.5rem;
  align-items: start;
}
.sx-kv dt {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
}
.sx-kv dd { margin: 0; word-break: break-word; }
@media (max-width: 768px) {
  .sx-kv > div { grid-template-columns: 1fr; gap: 0.15rem; }
}
.sx-mail-compose__file-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.sx-mail-compose__file-label .sx-icon { width: 0.95rem; height: 0.95rem; }
.sx-mail-compose__files {
  width: 100%;
  min-height: 44px;
  padding: 0.45rem 0.55rem;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: var(--surface);
}
.sx-mail-read__placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
  color: var(--muted);
}
.sx-mail-read__placeholder-icon {
  width: 4rem;
  height: 4rem;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}
.sx-mail-read__placeholder-icon .sx-icon { width: 1.75rem; height: 1.75rem; }
.sx-mail-read__placeholder h2 {
  margin: 0 0 0.5rem;
  color: var(--text);
  font-family: var(--font-display);
}
.sx-mail-read__placeholder p { margin: 0.25rem 0; max-width: 28rem; line-height: 1.45; }

.sx-mail-compose {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 1rem 1.15rem 1.5rem;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.sx-mail-compose label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  margin-top: 0.35rem;
}
.sx-mail-compose input,
.sx-mail-compose textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  font: inherit;
  background: #fff;
}
.sx-mail-compose textarea {
  min-height: 220px;
  resize: vertical;
  line-height: 1.45;
}
.sx-mail-compose__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

/* Impostazioni caselle — stesso linguaggio Bitrix/StarGem */
.sx-mail-settings {
  margin: -1.25rem -1.5rem -2rem;
  min-height: calc(100dvh - var(--topbar-h, 64px));
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.sx-mail-settings__nav {
  background: linear-gradient(180deg, #0b1f2a 0%, #123044 100%);
  color: var(--sidebar-text);
  border-right: 1px solid #163445;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
}
.sx-mail-settings__nav-head {
  padding: 1rem 1rem 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sx-mail-settings__nav-head h1 {
  margin: 0.35rem 0 0.15rem;
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: #fff;
}
.sx-mail-settings__back {
  color: #99f6e4;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none !important;
}
.sx-mail-settings__new {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.75rem 0.75rem 0.35rem;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  background: rgba(20, 184, 166, 0.2);
  color: #99f6e4;
  text-decoration: none !important;
  font-weight: 700;
  min-height: 44px;
}
.sx-mail-settings__new.is-active,
.sx-mail-settings__new:hover {
  background: rgba(20, 184, 166, 0.32);
  color: #fff;
}
.sx-mail-settings__list {
  list-style: none;
  margin: 0;
  padding: 0.35rem 0.55rem 1rem;
}
.sx-mail-settings__item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.65rem 0.55rem;
  border-radius: 8px;
  color: var(--sidebar-text);
  text-decoration: none !important;
  min-height: 52px;
}
.sx-mail-settings__item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.sx-mail-settings__item.is-active {
  background: rgba(20, 184, 166, 0.18);
  color: #5eead4;
}
.sx-mail-settings__item-icon {
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  background: rgba(15, 118, 110, 0.35);
  color: #99f6e4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.sx-mail-settings__item-main {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.sx-mail-settings__item-main strong {
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
  text-overflow: ellipsis;
}
.sx-mail-settings__item-main span {
  font-size: 0.72rem;
  color: #7f96a6;
  white-space: nowrap;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
  text-overflow: ellipsis;
}
.sx-mail-settings__flags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  justify-content: flex-end;
  max-width: 5.5rem;
}
.sx-mail-pill {
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 0.12rem 0.3rem;
  border-radius: 4px;
  background: rgba(255,255,255,0.1);
  color: #c5d4de;
}
.sx-mail-pill--ok { background: rgba(34, 197, 94, 0.25); color: #86efac; }
.sx-mail-pill--accent { background: rgba(20, 184, 166, 0.25); color: #99f6e4; }
.sx-mail-settings__form {
  padding: 1.25rem 1.5rem 2rem;
  overflow-y: auto;
  max-width: 720px;
}
.sx-mail-settings__form-head h2 {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
}
.sx-mail-settings__grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.sx-mail-settings__block {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  background: #f8fafb;
}
.sx-mail-settings__block h3 {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  color: #0b1f2a;
}
.sx-mail-settings__block label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  margin: 0.55rem 0 0.25rem;
}
.sx-mail-settings__block input[type="text"],
.sx-mail-settings__block input[type="password"],
.sx-mail-settings__block input[type="number"],
.sx-mail-settings__block input:not([type]) {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  font: inherit;
  background: #fff;
}
.sx-mail-settings__row2 {
  display: grid;
  grid-template-columns: 1fr 7rem;
  gap: 0.65rem;
}
.sx-mail-settings__chk {
  display: flex !important;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600 !important;
  color: var(--text) !important;
  margin-top: 0.65rem !important;
}
.sx-mail-settings__chk input {
  width: auto;
  min-height: auto;
}
.sx-mail-settings__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-top: 0.25rem;
}
@media (max-width: 960px) {
  .sx-mail-settings {
    margin: -1rem -1rem -2rem;
    grid-template-columns: 1fr;
    min-height: auto;
  }
  .sx-mail-settings__nav { max-height: 40vh; }
  .sx-mail-shell--compose .sx-mail__list { display: none; }
  .sx-mail-shell--compose .sx-mail__nav { display: none; }
}

#sx-mail-ajax.is-ajax-loading { opacity: 0.55; pointer-events: none; }

@media (max-width: 960px) {
  .sx-mail-shell {
    margin: -1rem -1rem -2rem;
    height: calc(100dvh - var(--topbar-h, 64px) - var(--tab-h, 64px));
  }
  .sx-mail {
    grid-template-columns: 1fr;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }
  .sx-mail-shell:not(.sx-mail-shell--read) .sx-mail__read { display: none; }
  .sx-mail-shell--read .sx-mail__nav { display: none; }
  .sx-mail-shell--read .sx-mail__list { display: none; }
  .sx-mail-shell--read .sx-mail-read__back { display: inline-flex; }
}
@media (max-width: 768px) {
  .sx-mail-shell {
    height: calc(100dvh - var(--topbar-h, 64px) - var(--tab-h, 64px));
  }
}

/* ——— Allineamento mobile Studio Gem (enroll / scheda / WA) ———
   Tab bar attiva ≤960px; polish touch e stack ≤768px (~375–768). */
@media (max-width: 768px) {
  /* Controlli touch Studio Gem */
  .sg-enroll input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
  .sg-enroll select,
  .sg-enroll textarea,
  .sg-enroll .btn,
  .sg-modal-scheda input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
  .sg-modal-scheda select,
  .sg-modal-scheda textarea,
  .sg-wa-bot-page .btn,
  .sg-wa-bot-page input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
  .sg-wa-bot-page select,
  .sg-wa-bot-page textarea {
    min-height: 44px;
  }
  .sg-enroll .btn-sm,
  .sg-modal-scheda .btn-sm,
  .sg-enroll-warn__btn.btn-sm,
  .sg-enroll-modal .btn-sm {
    min-height: 44px;
    padding: 0.45rem 0.85rem;
  }

  /* Tab pill: scroll comodo su mobile */
  .sg-enroll-tabs,
  .sg-scheda-tabs {
    gap: 0.35rem;
    scroll-padding-inline: 0.65rem;
  }
  .sg-enroll-tabs__btn {
    margin-left: 0;
    font-size: 0.875rem;
  }
  .sg-scheda-tabs__btn {
    margin-left: 0;
    font-size: 0.68rem;
  }
  .sg-enroll-tabs__btn:first-child,
  .sg-scheda-tabs__btn:first-child {
    margin-left: 0;
  }

  /* Nuova iscrizione: footer sopra tab bar */
  .sg-enroll {
    padding-bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px));
  }
  .sg-enroll__footer {
    position: sticky;
    bottom: calc(var(--tab-h, 64px) + env(safe-area-inset-bottom, 0px));
    z-index: 8;
    margin: 0.75rem -0.15rem 0;
    padding: 0.65rem 0.35rem calc(0.55rem + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(180deg, rgba(238, 242, 246, 0.2) 0%, var(--bg, #eef2f6) 28%);
    border-top: 1px solid var(--border, #d7dee8);
  }
  .sg-enroll__footer-actions {
    flex-direction: column;
  }
  .sg-enroll__footer-actions .btn {
    width: 100%;
    flex: 1 1 auto;
  }
  .sg-enroll__actions-top {
    flex-direction: column;
    align-items: stretch;
  }
  .sg-enroll__actions-top .btn {
    width: 100%;
  }
  .sg-enroll-minor-toggle {
    min-height: 44px;
    width: 100%;
  }
  .sg-enroll-warn {
    flex-direction: column;
    align-items: stretch;
  }
  .sg-enroll-warn__btn {
    width: 100%;
    margin-left: 0;
  }
  .sg-enroll-snapshot__grid {
    grid-template-columns: 1fr;
  }
  .sg-form-grid,
  .sg-form-grid--3,
  .sg-enroll .sg-form-grid {
    grid-template-columns: 1fr !important;
  }

  /* Scheda iscritto / entity modal */
  .entity-modal__panel--scheda,
  .entity-modal__panel--xl.entity-modal__panel--scheda {
    width: 100%;
    max-height: min(94dvh, 100%);
    height: min(94dvh, 100%);
    margin-top: 0;
    border-radius: 14px 14px 0 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .entity-modal__body--scheda {
    min-height: 0;
    flex: 1 1 auto;
  }
  .entity-modal__body--scheda .sg-attivita-shell > .sg-attivita-shell__head {
    padding: 0.7rem 0.75rem 0.55rem;
  }
  .entity-modal__body--scheda .sg-attivita-shell__title {
    font-size: 1.05rem;
  }
  .entity-modal__body--scheda .sg-corso-scheda-tabs > .sg-scheda-tabs,
  .entity-modal__body--scheda .sg-attivita-shell > .sg-attivita-shell__tabs {
    margin: 0 0.75rem 0.55rem;
    padding: 0.28rem;
  }
  .entity-modal__body--scheda .sg-corso-scheda-tabs > .sg-scheda-panels,
  .entity-modal__body--scheda .sg-attivita-shell > .sg-attivita-shell__scroll,
  .entity-modal__body--scheda .sg-attivita-shell > .sg-attivita-shell__body {
    padding: 0 0.75rem 1rem;
  }
  .entity-modal__body--scheda .sg-attivita-shell > .sg-attivita-shell__foot,
  .entity-modal__body--scheda .sg-attivita-shell > .sg-modal-simple__foot {
    padding: 0.6rem 0.75rem calc(0.6rem + env(safe-area-inset-bottom, 0px));
  }
  .entity-modal__body--scheda .sg-attivita-shell__foot-actions {
    width: 100%;
    justify-content: stretch;
  }
  .entity-modal__body--scheda .sg-attivita-shell__foot-actions .btn {
    flex: 1 1 auto;
    justify-content: center;
  }
  .entity-modal__body--scheda .sg-scheda-tabs--corso {
    flex-wrap: wrap;
    row-gap: 0.35rem;
  }
  .sg-modal-scheda__cf {
    max-width: none;
  }
  .sg-modal-scheda .sg-tessera-cell input {
    min-height: 44px;
  }
  .sg-modal-scheda__foot {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 0.4rem;
    padding: 0.55rem 0.65rem max(0.55rem, env(safe-area-inset-bottom, 0px));
  }
  .sg-modal-scheda__foot-actions {
    margin-left: 0;
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.4rem;
  }
  .sg-modal-scheda__foot .btn,
  .sg-modal-scheda__foot-actions .btn {
    flex: 1 1 calc(50% - 0.25rem);
    min-height: 40px;
    width: auto;
    font-size: 0.82rem;
    padding: 0.45rem 0.55rem;
  }
  .sg-modal-scheda__foot .btn-primary {
    flex: 1 1 100%;
  }
  .sg-scheda-page {
    margin-bottom: 0.75rem;
  }
  .sg-form-span--wa {
    flex-direction: column;
    align-items: stretch;
  }
  .sg-wa-attivo-field {
    width: 100%;
  }
  .sg-wa-attivo-field .sg-toggle {
    min-height: 44px;
  }
  .sg-form-span--wa .sg-tessera-btn,
  .sg-form-span--wa .btn {
    width: 100%;
    min-height: 44px;
  }
  .sg-tessera-grid {
    grid-template-columns: 1fr;
  }
  .sg-tessera-actions,
  .sg-tessera-actions--main {
    flex-direction: column;
    align-items: stretch;
  }
  .sg-tessera-btn {
    width: 100%;
    min-height: 44px;
  }
  .sg-wa-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
  }
  .sg-iscr-inline {
    flex-direction: column;
    align-items: stretch;
  }
  .sg-iscr-inline input,
  .sg-iscr-inline select,
  .sg-iscr-inline .btn {
    max-width: 100% !important;
    width: 100%;
    min-height: 44px;
  }

  /* Bot WhatsApp impostazioni */
  .sg-wa-bot-page {
    max-width: 100%;
    padding-bottom: 0.5rem;
  }
  .sg-wa-subnav {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    padding-bottom: 0.55rem;
  }
  .sg-wa-subnav__link {
    flex: 0 0 auto;
    min-height: 36px;
  }
  .sg-wa-status {
    flex-direction: column;
    align-items: flex-start;
  }
  .sg-wa-status__actions {
    margin-left: 0;
    width: 100%;
  }
  .sg-wa-status__actions .btn {
    width: 100%;
    min-height: 44px;
  }
  .sg-wa-bot-page .btn-row,
  .sg-wa-bot-page .form-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .sg-wa-bot-page .btn-row .btn,
  .sg-wa-bot-page .form-actions .btn {
    width: 100%;
    min-height: 44px;
  }
  .sg-wa-bot-page .card {
    max-width: 100% !important;
  }
  .sg-wa-bot-page .form-actions.sg-wa-bot-actions {
    position: sticky;
    bottom: calc(0.35rem + env(safe-area-inset-bottom, 0px));
  }
  .sg-wa-bot-page .sg-toggle {
    min-height: 44px;
    width: 100%;
  }
  .sg-wa-bot-page textarea,
  .sg-wa-bot-page input:not([type="checkbox"]) {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }
  .sg-wa-bot-page .crm-hero-table-wrap,
  .sg-wa-bot-page div[style*="overflow-x"] {
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
  }
  .sg-wa-bot-add-forms {
    grid-template-columns: 1fr !important;
  }

  /* Chat WA: header e chip */
  .sx-wab__side-head {
    flex-wrap: wrap;
    gap: 0.45rem;
  }
  .sx-wab__icon-btn,
  .sx-wab__back {
    min-width: 44px;
    min-height: 44px;
  }
  .sx-wab__chip {
    min-height: 36px;
    padding: 0.35rem 0.7rem;
  }
  .sx-wab__composer {
    padding-bottom: max(0.55rem, env(safe-area-inset-bottom, 0px));
  }
  .sg-wa-dialog {
    width: min(100vw - 0.75rem, 100%);
    max-height: 90dvh;
  }
  .sg-wa-dialog__close {
    min-width: 44px;
    min-height: 44px;
  }
}

/* Tra 769 e 960: tab bar già presente — clearance minima footer enroll/scheda */
@media (max-width: 960px) and (min-width: 769px) {
  .sg-enroll__footer {
    padding-bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px));
  }
  .sg-modal-scheda__foot {
    padding-bottom: max(0.85rem, env(safe-area-inset-bottom, 0px));
  }
  .sg-wa-bot-page .form-actions {
    margin-bottom: 0.75rem;
  }
}


/* ——— Programmazione / Calendario Attività (Studio Gem) ——— */
body.sg-prog-page .sx-main {
  max-width: none;
  width: 100%;
  padding-left: 1rem;
  padding-right: 1rem;
}
.sg-prog {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding-bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px));
  min-width: 0;
  width: 100%;
}
body.sg-prog-page .sg-prog {
  /* lascia spazio a topbar: la griglia scrolla sotto chrome fissa */
  --sg-prog-days-h: 0rem;
  min-height: calc(100dvh - var(--topbar-h, 64px) - 1.5rem);
}
.sg-prog__chrome {
  position: sticky;
  top: var(--topbar-h, 64px);
  z-index: 28;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin: 0;
  padding: 0.28rem 0 0.35rem;
  background: var(--bg, #eef2f6);
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  box-shadow: 0 8px 16px -12px rgba(15, 23, 42, 0.35);
}
.sg-prog__filters {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin: 0;
  min-width: 0;
}
.sg-prog__band {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.5rem;
  padding: 0.4rem 0.55rem;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #d8dee8);
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  min-width: 0;
}
.sg-prog__band--nav {
  align-items: center;
}
.sg-prog__nav-host {
  display: contents;
}
.sg-prog__nav-left {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.45rem;
  order: 1;
  min-width: 0;
}
.sg-prog__day-pills {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0.28rem;
  overflow-x: auto;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.sg-prog__day-pill {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.02rem;
  min-width: 2.55rem;
  padding: 0.22rem 0.36rem;
  border: 1px solid #d0d7e2;
  border-radius: 8px;
  background: #fff;
  color: #0f172a;
  text-decoration: none;
  line-height: 1.1;
  flex: 0 0 auto;
}
.sg-prog__day-pill:hover {
  border-color: var(--accent, #0f766e);
  color: var(--accent, #0f766e);
}
.sg-prog__day-pill.is-today:not(.is-active) {
  border-color: rgba(15, 118, 110, 0.45);
}
.sg-prog__day-pill.is-active {
  background: var(--accent, #0f766e);
  border-color: var(--accent, #0f766e);
  color: #fff;
}
.sg-prog__day-pill-dow,
.sg-prog__day-pill-mon {
  font-size: 0.65rem;
  font-weight: 650;
  text-transform: lowercase;
  letter-spacing: 0.02em;
  opacity: 0.85;
}
.sg-prog__day-pill-num {
  font-size: 0.9rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.sg-prog__nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.sg-prog__nav-btn-ico {
  width: 0.95rem;
  height: 0.95rem;
  flex: 0 0 auto;
}
.sg-prog__search-expand {
  order: 3;
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-left: 0;
  min-height: 34px;
  border: 1px solid #d0d7e2;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.sg-prog__search-expand:hover {
  border-color: var(--accent, #0f766e);
}
.sg-prog__search-expand:focus-within,
.sg-prog__search-expand.is-open {
  border-color: var(--accent, #0f766e);
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.18);
}
.sg-prog__search-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.15rem;
  height: 2.15rem;
  flex: 0 0 auto;
  color: #475569;
  pointer-events: none;
}
.sg-prog__search-ico .sx-icon {
  width: 1rem;
  height: 1rem;
}
.sg-prog__search-expand input[type="search"] {
  width: 0;
  min-width: 0;
  min-height: 34px;
  padding: 0;
  border: 0;
  outline: none;
  box-shadow: none;
  background: transparent;
  color: var(--text, #0f172a);
  opacity: 0;
  transition: width 0.2s ease, opacity 0.15s ease, padding 0.2s ease;
}
.sg-prog__search-expand input[type="search"]:focus {
  outline: none;
  box-shadow: none;
  border: 0;
}
.sg-prog__search-expand:hover input[type="search"],
.sg-prog__search-expand:focus-within input[type="search"],
.sg-prog__search-expand.is-open input[type="search"] {
  width: min(14rem, 42vw);
  padding: 0.25rem 0.65rem 0.25rem 0;
  opacity: 1;
}
.sg-prog__band--filters,
.sg-prog__band--bulk {
  align-items: flex-end;
}
.sg-prog__fields {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.5rem;
  align-items: flex-end;
  width: 100%;
  min-width: 0;
}
.sg-prog__field {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  flex: 1 1 9.5rem;
  min-width: 8rem;
  margin: 0;
}
.sg-prog__field--apply {
  flex: 0 0 auto;
  min-width: 0;
}
.sg-prog__field-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
  line-height: 1.2;
}
.sg-prog__field-control {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
}
.sg-prog__filters select,
.sg-prog__filters .sg-prog__combo input[type="search"] {
  width: 100%;
  min-height: 40px;
  max-width: 100%;
  min-width: 0;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #d0d7e2);
  border-radius: 8px;
  color: var(--text, #0f172a);
}
.sg-prog__filters-day {
  font-weight: 600;
}
.sg-prog__apply {
  min-height: 40px;
  min-width: 6.5rem;
}
.sg-prog__combo {
  position: relative;
  width: 100%;
  min-width: 0;
}
.sg-prog__combo input[type="search"] {
  padding: 0.35rem 0.65rem;
}
.sg-prog__combo .sg-enroll-suggest {
  z-index: 40;
  max-height: 16rem;
}
.sg-enroll-suggest__item--muted {
  color: #64748b;
  font-style: italic;
}
.sg-prog__period {
  display: inline-flex;
  order: 2;
  margin-left: auto;
  border: 1px solid #d0d7e2;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  flex: 0 0 auto;
}
.sg-prog__period-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0.25rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 650;
  color: #475569;
  text-decoration: none;
  border-right: 1px solid #e2e8f0;
  white-space: nowrap;
}
.sg-prog__period-btn:last-child {
  border-right: 0;
}
.sg-prog__period-btn:hover {
  color: var(--accent, #0f766e);
  background: #f8fafc;
}
.sg-prog__period-btn.is-active {
  background: var(--accent, #0f766e);
  color: #fff;
}
.sg-prog__vista {
  display: inline-flex;
  order: 4;
  border: 1px solid #d0d7e2;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  flex: 0 0 auto;
}
.sg-prog__vista-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 34px;
  padding: 0.25rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 650;
  color: #475569;
  text-decoration: none;
  border-right: 1px solid #e2e8f0;
}
.sg-prog__vista-btn:last-child {
  border-right: 0;
}
.sg-prog__vista-btn.is-active {
  background: var(--accent, #0f766e);
  color: #fff;
}
.sg-prog__vista-ico {
  width: 0.9rem;
  height: 0.9rem;
  flex: 0 0 auto;
}
@media (max-width: 720px) {
  .sg-prog__period,
  .sg-prog__search-expand {
    margin-left: 0;
  }
  .sg-prog__period {
    width: 100%;
    order: 3;
  }
  .sg-prog__period-btn {
    flex: 1 1 auto;
  }
  .sg-prog__search-expand {
    order: 4;
  }
  .sg-prog__vista {
    width: 100%;
    order: 5;
  }
  .sg-prog__vista-btn {
    flex: 1 1 auto;
    justify-content: center;
  }
  .sg-prog__search-expand:hover input[type="search"],
  .sg-prog__search-expand:focus-within input[type="search"],
  .sg-prog__search-expand.is-open input[type="search"] {
    width: min(11rem, 55vw);
  }
}
.sg-prog-list {
  list-style: none;
  margin: 0.35rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.sg-prog-list__item {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  border-left: 4px solid var(--sg-block-accent, #0f766e);
}
.sg-prog-list__item.is-unplaced {
  opacity: 0.85;
  border-style: dashed;
}
.sg-prog-list__link {
  display: grid;
  grid-template-columns: minmax(7rem, 11rem) minmax(0, 1fr) auto;
  gap: 0.55rem 0.85rem;
  align-items: center;
  padding: 0.65rem 0.8rem;
  text-decoration: none;
  color: inherit;
}
.sg-prog-list__when {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  font-size: 0.82rem;
}
.sg-prog-list__day {
  font-weight: 650;
  color: #0f172a;
}
.sg-prog-list__main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.sg-prog-list__title {
  font-size: 0.92rem;
  color: #0f172a;
}
.sg-prog-list__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.65rem;
  font-size: 0.75rem;
  color: #64748b;
}
.sg-prog-list__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
  justify-content: flex-end;
}
@media (max-width: 720px) {
  .sg-prog-list__link {
    grid-template-columns: 1fr;
  }
}
.sg-prog__week-nav {
  min-width: 2.25rem;
  justify-content: center;
  font-size: 1.15rem;
  line-height: 1;
  padding-left: 0.55rem;
  padding-right: 0.55rem;
}
.sg-prog__vai-a {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.sg-prog__vai-a-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  border: 0;
  padding: 0;
  margin: 0;
}
.sg-prog.is-move-mode [data-sg-prog-drop] {
  cursor: crosshair;
}
.sg-prog.is-move-mode [data-sg-prog-drop]:hover,
.sg-prog-grid__cell.is-drop-target {
  outline: 2px solid var(--accent, #0f766e);
  outline-offset: -2px;
  background: rgba(15, 118, 110, 0.08);
}
.sg-prog-block.is-move-source {
  outline: 2px dashed var(--accent, #0f766e);
  outline-offset: 1px;
  opacity: 0.85;
}
.sg-prog-ctx-menu {
  position: fixed;
  /* Sopra float card (5200) e chrome griglia; sotto Teo/chat FAB (10050+) */
  z-index: 8000;
  min-width: 11.5rem;
  display: flex;
  flex-direction: column;
  padding: 0.35rem;
  background: #fff;
  border: 1px solid #d8dee8;
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16);
}
.sg-prog-ctx-menu__item {
  appearance: none;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 0.45rem 0.65rem;
  border-radius: 6px;
  font: inherit;
  font-size: 0.86rem;
  cursor: pointer;
  color: #0f172a;
}
.sg-prog-ctx-menu__item:hover:not(:disabled) {
  background: #ecfdf5;
  color: #0f766e;
}
.sg-prog-ctx-menu__item--danger {
  color: #b91c1c;
  font-weight: 600;
}
.sg-prog-ctx-menu__item--danger:hover:not(:disabled) {
  background: #fef2f2;
  color: #991b1b;
}
.sg-prog-ctx-menu__item:disabled,
.sg-prog-ctx-menu__item.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.sg-prog-grid-wrap {
  overflow: auto;
  border: 1px solid var(--border, #d8dee8);
  border-radius: 10px;
  background: var(--surface, #fff);
  max-width: 100%;
  width: 100%;
  -webkit-overflow-scrolling: touch;
  /* Altezza viewport: scroll interno → thead sticky resta leggibile */
  max-height: calc(
    100dvh
    - var(--topbar-h, 64px)
    - var(--sg-prog-chrome-h, 7.5rem)
    - var(--sg-prog-days-h, 3.35rem)
    - 1.75rem
  );
}
.sg-prog-grid {
  /* Celle fisse portrait: ~+20% larghezza vs 7.5rem, senza gutter */
  --sg-prog-cell-w: 9rem;
  --sg-prog-cell-h: 9.25rem;
  --sg-prog-cell-pad: 0;
  border-collapse: collapse;
  border-spacing: 0;
  table-layout: fixed;
  width: max-content;
  min-width: 100%;
  font-size: 0.78rem;
  color: var(--text, #0f172a);
  background: var(--surface, #fff);
}
.sg-prog-grid th,
.sg-prog-grid td {
  border: 1px solid #e8edf4;
  vertical-align: top;
}
.sg-prog-grid thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f4f7fb;
  color: #1e293b;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.55rem 0.35rem;
  white-space: nowrap;
  width: var(--sg-prog-cell-w);
  min-width: var(--sg-prog-cell-w);
  max-width: var(--sg-prog-cell-w);
  font-size: 0.68rem;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 1px 0 #e8edf4;
}
body.sg-prog-page .sg-prog-grid-wrap {
  scroll-margin-top: calc(var(--topbar-h, 64px) + var(--sg-prog-chrome-h, 7.5rem));
}
.sg-prog-grid__ore {
  position: sticky;
  left: 0;
  z-index: 3;
  background: #f8fafc !important;
  min-width: 3.6rem !important;
  width: 3.6rem !important;
  max-width: 3.6rem !important;
  text-align: right;
  padding: 0.25rem 0.4rem !important;
  color: var(--muted, #64748b);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}
.sg-prog-grid thead .sg-prog-grid__ore {
  z-index: 4;
}
.sg-prog-grid__studio {
  text-align: center;
  white-space: normal !important;
  line-height: 1.2;
  vertical-align: middle;
}
.sg-prog-grid__studio-name {
  display: block;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.sg-prog-grid__studio-meta {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--muted, #64748b);
  text-transform: none;
  letter-spacing: 0;
}
.sg-prog-grid--day {
  --sg-prog-cell-w: 11rem;
}
.sg-prog-grid--day.sg-prog-grid--few {
  width: 100%;
  --sg-prog-cell-w: min(32rem, calc(100vw - 8rem));
}
.sg-prog-grid--day.sg-prog-grid--few thead th:not(.sg-prog-grid__ore),
.sg-prog-grid--day.sg-prog-grid--few .sg-prog-grid__cell {
  width: auto;
  min-width: var(--sg-prog-cell-w);
  max-width: none;
}
.sg-prog__day-context {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem 1rem;
  margin: 0 0 0.55rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid #d8dee8;
  border-radius: 10px;
  background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
}
.sg-prog__day-context-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #0f172a;
  text-transform: capitalize;
}
.sg-prog__day-context-sub {
  margin: 0.15rem 0 0;
  font-size: 0.8rem;
}
.sg-prog-grid__cell {
  width: var(--sg-prog-cell-w);
  min-width: var(--sg-prog-cell-w);
  max-width: var(--sg-prog-cell-w);
  height: var(--sg-prog-cell-h);
  min-height: var(--sg-prog-cell-h);
  padding: var(--sg-prog-cell-pad);
  box-sizing: border-box;
  vertical-align: top;
  position: relative;
  z-index: 0;
}
.sg-prog-grid__cell--empty {
  background: #f8fafc;
  cursor: cell;
}
/* Box vuoto stessa footprint della card corso (flush, zero gutter) */
.sg-prog-grid__cell--empty::after {
  content: "";
  display: block;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  min-height: calc(var(--sg-prog-cell-h) - 2 * var(--sg-prog-cell-pad));
  border: 1px solid #e2e8f0;
  border-radius: 0;
  background: #fcfdff;
  pointer-events: none;
}
.sg-prog-grid__cell--empty:hover {
  background: #f1f5f9;
}
.sg-prog-grid__cell--empty:hover::after {
  border-color: rgba(15, 118, 110, 0.4);
  background: rgba(15, 118, 110, 0.05);
}
.sg-prog-grid__cell--block {
  background: var(--surface, #fff);
  /* rowspan > 1: l’altezza segue le righe; min = 1 cella */
  height: auto;
  min-height: var(--sg-prog-cell-h);
}
.sg-prog-block {
  --sg-block-accent: #0f766e;
  display: flex;
  flex-direction: column;
  gap: 0.06rem;
  width: 100%;
  height: 100%;
  min-height: calc(var(--sg-prog-cell-h) - 2 * var(--sg-prog-cell-pad));
  max-height: 100%;
  padding: 0.28rem 0.32rem 0;
  border-radius: 0;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-left: 5px solid var(--sg-block-accent);
  color: var(--text, #0f172a);
  text-decoration: none !important;
  box-sizing: border-box;
  position: relative;
  z-index: 1;
  overflow: hidden;
  box-shadow: none;
}
.sg-prog-block:hover,
.sg-prog-block:focus-visible {
  border-color: #cbd5e1;
  border-left-color: var(--sg-block-accent);
  background: #fff;
  text-decoration: none !important;
}
.sg-prog-block.is-hover-source {
  opacity: 0.55;
}
/* Float fuori griglia: card opaca completa (no scale dentro overflow:hidden) */
.sg-prog-block-float {
  --sg-block-accent: #0f766e;
  position: fixed;
  z-index: 5200;
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  width: auto;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  max-width: min(22rem, calc(100vw - 1rem));
  padding: 0.45rem 0.5rem 0;
  margin: 0;
  border-radius: 8px;
  background: #fff !important;
  border: 1px solid #cbd5e1;
  border-left: 5px solid var(--sg-block-accent);
  color: var(--text, #0f172a);
  text-decoration: none !important;
  box-sizing: border-box;
  overflow: visible !important;
  box-shadow:
    0 14px 36px rgba(15, 23, 42, 0.18),
    0 4px 12px rgba(15, 23, 42, 0.1);
  pointer-events: none;
  isolation: isolate;
}
.sg-prog-block-float,
.sg-prog-block-float:hover,
.sg-prog-block-float:focus,
.sg-prog-block-float * {
  text-decoration: none !important;
}
.sg-prog-block-float .sg-prog-block__title,
.sg-prog-block-float .sg-prog-block__titolo,
.sg-prog-block-float .sg-prog-block__livello,
.sg-prog-block-float .sg-prog-block__studio,
.sg-prog-block-float .sg-prog-block__sub,
.sg-prog-block-float .sg-prog-block__dates,
.sg-prog-block-float .sg-prog-block__det,
.sg-prog-block-float .sg-prog-block__sku {
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  word-break: break-word;
}
.sg-prog-block-float .sg-prog-block__badges {
  max-width: none;
  flex-wrap: wrap;
}
.sg-prog-block-float .sg-prog-block__badge {
  max-width: none;
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  border-radius: 2px;
}
.sg-prog-block-float .sg-prog-block__det,
.sg-prog-block-float .sg-prog-block__sku {
  display: block !important;
}
.sg-prog-block-float .sg-prog-block__stat--disp {
  display: inline !important;
}
.sg-prog-block-float .sg-prog-block__stats {
  flex-wrap: wrap;
  overflow: visible;
}
.sg-prog-block-float .sg-prog-block__sku {
  margin-left: -0.5rem;
  margin-right: -0.5rem;
}
.sg-prog-block__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.25rem;
  flex: 0 0 auto;
}
.sg-prog-block__time {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--sg-block-accent);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.sg-prog-block__badges {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.14rem;
  justify-content: flex-end;
  max-width: 55%;
}
.sg-prog-block__badge {
  display: inline-flex;
  align-items: center;
  padding: 0.05rem 0.22rem;
  border-radius: 2px;
  font-size: 0.48rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.2;
  text-transform: uppercase;
  max-width: 4.6rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sg-prog-block__badge--cat {
  background: var(--sg-block-accent);
  color: #fff;
}
.sg-prog-block__badge--tipo {
  background: #e2e8f0;
  color: #0f172a;
}
.sg-prog-block__badge--prova {
  background: #0369a1;
  color: #fff;
}
.sg-prog-block__title,
.sg-prog-block__titolo,
.sg-prog-block__livello,
.sg-prog-block__studio,
.sg-prog-block__sub,
.sg-prog-block__dates,
.sg-prog-block__det {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.2;
}
.sg-prog-block__title {
  font-weight: 800;
  font-size: 0.74rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #0f172a;
}
.sg-prog-block__title--tipo {
  font-weight: 700;
  font-size: 0.62rem;
  color: #475569;
}
.sg-prog-block__titolo {
  font-size: 0.74rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: 0.01em;
  min-height: 0.88rem;
}
.sg-prog-block__livello {
  font-size: 0.58rem;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  min-height: 0.7rem;
}
.sg-prog-block__sub {
  font-size: 0.6rem;
  color: #64748b;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  min-height: 0.72rem;
}
.sg-prog-block__dates {
  font-size: 0.55rem;
  font-weight: 650;
  color: #0f766e;
  font-variant-numeric: tabular-nums;
  min-height: 0.68rem;
}
.sg-prog-block__dates.is-empty {
  min-height: 0;
}
.sg-prog-block__det {
  font-size: 0.55rem;
  color: #64748b;
  font-weight: 500;
  min-height: 0.66rem;
}
.sg-prog-block__livello.is-empty,
.sg-prog-block__titolo.is-empty,
.sg-prog-block__studio.is-empty,
.sg-prog-block__sub.is-empty,
.sg-prog-block__dates.is-empty,
.sg-prog-block__det.is-empty {
  visibility: hidden;
}
.sg-prog-block__stats {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.28rem 0.45rem;
  margin-top: auto;
  padding-top: 0.12rem;
  font-size: 0.58rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
}
.sg-prog-block__stats--mini {
  flex-wrap: wrap;
  gap: 0.2rem 0.35rem;
  font-size: 0.54rem;
}
.sg-prog-block__stat--u { color: #0284c7; }
.sg-prog-block__stat--d { color: #e11d48; }
.sg-prog-block__stat--cap { color: #0f172a; }
.sg-prog-block__stat--disp { color: #059669; }
.sg-prog-block__stat--disp.is-low { color: #dc2626; }
.sg-prog-block__sku {
  display: block;
  margin: 0.16rem -0.32rem 0;
  padding: 0.16rem 0.32rem;
  background: #f8fafc;
  border-top: 1px solid #e8edf4;
  font-size: 0.48rem;
  color: #64748b;
  line-height: 1.2;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 0 0 auto;
}
.sg-prog-block__studio {
  font-size: 0.56rem;
  font-weight: 700;
  color: var(--accent, #0f766e);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  min-height: 0.68rem;
}
.sg-prog-block--compact {
  padding: 0.24rem 0.28rem 0.2rem;
  min-height: 0;
  height: 100%;
  flex: 1 1 auto;
  margin-bottom: 0;
}
.sg-prog-block--compact .sg-prog-block__title {
  font-size: 0.66rem;
}
.sg-prog-block--compact .sg-prog-block__det,
.sg-prog-block--compact .sg-prog-block__sku {
  display: none;
}
.sg-prog-block--compact .sg-prog-block__stat--disp {
  display: none;
}
.sg-prog-stack {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 100%;
  height: 100%;
  min-height: calc(var(--sg-prog-cell-h) - 2 * var(--sg-prog-cell-pad));
  max-height: 100%;
  overflow: auto;
  box-sizing: border-box;
}
.sg-prog-grid--week thead th {
  text-align: center;
  white-space: normal;
}
.sg-prog-grid__daylink {
  color: inherit;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.12rem;
  line-height: 1.15;
}
.sg-prog-grid__daylink:hover {
  color: var(--accent, #0f766e);
}
.sg-prog-grid__dayname {
  display: block;
  font-weight: 750;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: lowercase;
}
.sg-prog-grid__daydate {
  display: block;
  font-weight: 600;
  font-size: 0.72rem;
  color: var(--muted, #64748b);
  text-transform: none;
  letter-spacing: 0;
  margin-top: 0;
}
.sg-prog-grid__cell--stack {
  background: var(--surface, #fff);
  vertical-align: top;
  height: var(--sg-prog-cell-h);
  min-height: var(--sg-prog-cell-h);
  max-height: var(--sg-prog-cell-h);
  overflow: hidden;
}
.sg-prog-grid__cell.is-overlap,
.sg-prog-grid__cell--stack.is-overlap {
  background: #fef2f2;
  box-shadow: inset 0 0 0 2px #dc2626;
}
.sg-prog-block.is-overlap {
  border-color: #dc2626 !important;
  background: #fff1f2;
  box-shadow: 0 0 0 1px #dc2626;
}
.sg-prog-block__badge--overlap {
  background: #dc2626;
  color: #fff;
}
.sg-prog-block.is-dragging {
  opacity: 0.55;
  box-shadow: none !important;
  z-index: 1 !important;
}
.sg-prog-grid__cell.is-drop-target {
  outline: 2px dashed #0f766e;
  outline-offset: -2px;
  background: #ecfdf5;
}
.sg-prog-table-wrap {
  overflow: auto;
  border: 1px solid var(--border, #d8dee8);
  border-radius: 10px;
  background: var(--surface, #fff);
  max-width: 100%;
  width: 100%;
  -webkit-overflow-scrolling: touch;
  /* Altezza viewport: scroll interno → thead sticky resta leggibile (come griglia/mese) */
  max-height: calc(
    100dvh
    - var(--topbar-h, 64px)
    - var(--sg-prog-chrome-h, 7.5rem)
    - var(--sg-prog-days-h, 3.35rem)
    - 1.75rem
  );
}
.sg-prog-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}
.sg-prog-table th,
.sg-prog-table td {
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid #e8edf4;
  border-right: 0;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}
.sg-prog-table th {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  background: #f8fafc;
  position: sticky;
  top: 0;
  z-index: 2;
  box-shadow: 0 1px 0 #e8edf4;
}
.sg-prog-table--lista td.sg-prog-table__corso {
  white-space: normal;
  min-width: 16rem;
  max-width: 28rem;
  line-height: 1.25;
}
/* Lista: orario / insegnanti su 2 righe → colonne strette ~ header */
.sg-prog-table--lista th.sg-prog-table__orario,
.sg-prog-table--lista td.sg-prog-table__orario {
  width: 3.4rem;
  max-width: 3.6rem;
  padding-left: 0.4rem;
  padding-right: 0.4rem;
  white-space: normal;
  vertical-align: middle;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.sg-prog-table--lista th.sg-prog-table__insegnante,
.sg-prog-table--lista td.sg-prog-table__insegnante {
  width: 5.6rem;
  max-width: 6.2rem;
  padding-left: 0.4rem;
  padding-right: 0.4rem;
  white-space: normal;
  vertical-align: middle;
  line-height: 1.2;
}
.sg-prog-table--lista th.sg-prog-table__insegnante--2,
.sg-prog-table--lista td.sg-prog-table__insegnante--2 {
  width: 6.4rem;
  max-width: 7rem;
}
.sg-prog-table--lista .sg-prog-table__orario .sg-prog-table__cell,
.sg-prog-table--lista .sg-prog-table__insegnante .sg-prog-table__cell {
  max-width: none;
  width: 100%;
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  line-height: 1.2;
  padding-left: 0.1rem;
  padding-right: 0.1rem;
}
.sg-prog-table__stack-line {
  display: block;
}
.sg-prog-table__titolo-line {
  display: block;
  color: #0f172a;
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
  line-height: 1.3;
}
.sg-prog-table__titolo-line:hover {
  text-decoration: underline;
  color: #0f766e;
}
.sg-prog-table__tipo {
  font-size: 0.8rem;
  font-weight: 650;
  color: #0f766e;
  margin-top: 0.12rem;
  line-height: 1.25;
}
.sg-prog-table__title {
  color: #0f766e;
  font-weight: 700;
  text-decoration: none;
}
.sg-prog-table__title:hover {
  text-decoration: underline;
}
.sg-prog-table__dates {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  font-size: 0.82rem;
  color: #475569;
}
.sg-prog-table__sub {
  font-size: 0.75rem;
  margin-top: 0.15rem;
  line-height: 1.3;
}
.sg-prog-table__check {
  width: 2rem;
  text-align: center;
}
.sg-prog-table__foot {
  margin: 0;
  padding: 0.55rem 0.75rem 0.7rem;
  font-size: 0.82rem;
  border-top: 1px solid #e8edf4;
}
.sg-prog-table__row.is-overlap {
  background: #fef2f2;
}
.sg-prog-table__row.is-unplaced {
  opacity: 0.75;
}
.sg-prog-table__cell {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0.15rem 0.25rem;
  border-radius: 4px;
  cursor: pointer;
  color: inherit;
  font: inherit;
  text-align: left;
  max-width: 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sg-prog-table__cell--multi {
  max-width: 16rem;
  overflow: visible;
  text-overflow: unset;
  white-space: normal;
}
.sg-prog-table__cell:hover {
  background: #ecfdf5;
  color: #0f766e;
}
.sg-prog-det-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}
.sg-prog-det-chip {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  background: #ecfdf5;
  color: #0f766e;
  border: 1px solid #a7f3d0;
  white-space: nowrap;
}
.sg-prog-cell-menu {
  position: fixed;
  /* Allineato al ctx-menu: sopra float card, sotto Teo/chat FAB */
  z-index: 8000;
  min-width: 12rem;
  max-width: 18rem;
  max-height: min(22rem, 70vh);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.45rem;
  background: #fff;
  border: 1px solid #d8dee8;
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.14);
}
.sg-prog-cell-menu--multi {
  min-width: 14rem;
}
.sg-prog-cell-menu__search,
.sg-prog-cell-menu__input {
  width: 100%;
  min-height: 2rem;
  padding: 0.3rem 0.5rem;
  border: 1px solid #d5dee9;
  border-radius: 8px;
  font: inherit;
  font-size: 0.84rem;
}
.sg-prog-cell-menu__label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.72rem;
  color: #64748b;
}
.sg-prog-cell-menu__list {
  overflow: auto;
  max-height: 16rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.sg-prog-cell-menu__item {
  appearance: none;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 0.4rem 0.55rem;
  border-radius: 6px;
  font: inherit;
  font-size: 0.84rem;
  cursor: pointer;
  color: #0f172a;
}
.sg-prog-cell-menu__item:hover,
.sg-prog-cell-menu__item.is-active {
  background: #ecfdf5;
  color: #0f766e;
}
.sg-prog-cell-menu__empty {
  padding: 0.5rem;
  font-size: 0.8rem;
}
.sg-prog-cell-menu__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.4rem;
}
.sg-prog-bulk {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.5rem;
  align-items: flex-end;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border, #e2e8f0);
  background: #f8fafc;
}
.sg-prog__band--bulk {
  /* sticky insieme al chrome: stessa banda filtri */
  width: 100%;
}
.sg-prog__band--bulk[hidden] {
  display: none !important;
}
.sg-prog-bulk__count {
  display: inline-flex;
  align-items: center;
  align-self: flex-end;
  min-height: 40px;
  margin: 0 0.15rem 0 0;
  padding: 0.28rem 0.7rem;
  border-radius: 8px;
  background: #ecfdf5;
  color: var(--accent, #0f766e);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  line-height: 1.2;
  white-space: nowrap;
}
.sg-prog-bulk__field {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  flex: 1 1 9.5rem;
  min-width: 8rem;
  max-width: 16rem;
  margin: 0;
}
.sg-prog-bulk__label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
  line-height: 1.2;
}
.sg-prog-bulk__control {
  display: flex;
  align-items: center;
  min-width: 0;
  width: 100%;
}
.sg-prog__band--bulk select,
.sg-prog__band--bulk input[type="search"],
.sg-prog-bulk__control select,
.sg-prog-bulk__control input {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  margin: 0;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #d0d7e2);
  border-radius: 8px;
  color: var(--text, #0f172a);
  font-size: 0.84rem;
}
.sg-prog-bulk__actions {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  flex: 0 0 auto;
  min-width: 0;
  margin: 0;
}
.sg-prog-bulk__btns {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}
.sg-prog-bulk__btns .btn {
  min-height: 40px;
}
.sg-prog-month {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border, #d8dee8);
  border-radius: 10px;
  overflow: auto;
  background: var(--surface, #fff);
  width: 100%;
  max-height: calc(
    100dvh
    - var(--topbar-h, 64px)
    - var(--sg-prog-chrome-h, 7.5rem)
    - var(--sg-prog-days-h, 3.35rem)
    - 1.75rem
  );
}
.sg-prog-month__head,
.sg-prog-month__week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}
.sg-prog-month__head {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f4f7fb;
  border-bottom: 1px solid var(--border, #d8dee8);
  box-shadow: 0 1px 0 #e8edf4;
}
.sg-prog-month__hcell {
  padding: 0.55rem 0.4rem;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #1e293b;
  border-right: 1px solid #e8edf4;
}
.sg-prog-month__hcell:last-child {
  border-right: none;
}
.sg-prog-month__week {
  border-bottom: 1px solid #e8edf4;
  min-height: 9.5rem;
}
.sg-prog-month__week:last-child {
  border-bottom: none;
}
.sg-prog-month__cell {
  border-right: 1px solid #e8edf4;
  padding: 0.35rem;
  min-height: 9.5rem;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}
.sg-prog-month__cell:last-child {
  border-right: none;
}
.sg-prog-month__cell.is-out {
  background: #f8fafc;
  opacity: 0.55;
}
.sg-prog-month__cell.is-today {
  background: rgba(15, 118, 110, 0.06);
  box-shadow: inset 0 0 0 2px rgba(15, 118, 110, 0.35);
}
.sg-prog-month__cell-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem;
}
.sg-prog-month__daynum {
  font-weight: 700;
  font-size: 0.85rem;
  color: #0f172a;
  text-decoration: none;
}
.sg-prog-month__daynum:hover {
  color: var(--accent, #0f766e);
}
.sg-prog-month__daynum.is-muted {
  color: #94a3b8;
  font-weight: 500;
}
.sg-prog-month__n {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--accent, #0f766e);
  background: rgba(15, 118, 110, 0.12);
  border-radius: 999px;
  padding: 0.05rem 0.35rem;
}
.sg-prog-month__list {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  overflow: auto;
  max-height: 7.5rem;
  min-height: 0;
}
.sg-prog-month__more {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--accent, #0f766e);
  text-decoration: none;
  padding: 0.15rem 0.2rem;
}
.sg-prog-month__more:hover {
  text-decoration: underline;
}
.sg-prog-unplaced {
  font-size: 0.85rem;
  color: #475569;
}
.sg-prog-unplaced ul {
  margin: 0.4rem 0 0;
  padding-left: 1.1rem;
}
.sg-prog-week {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.sg-prog-week__day-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  align-items: center;
  margin-bottom: 0.45rem;
}
.sg-prog-week__day-head h2 {
  margin: 0;
  font-size: 1.05rem;
}
.sg-prog-days {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  gap: 0.35rem;
  justify-content: center;
  overflow-x: auto;
  padding: 0.45rem 0.15rem calc(0.45rem + env(safe-area-inset-bottom, 0px));
  background: rgba(238, 242, 246, 0.96);
  border-top: 1px solid var(--border, #d8dee8);
  backdrop-filter: blur(6px);
  -webkit-overflow-scrolling: touch;
}
.sg-prog-days__sep {
  flex: 0 0 auto;
  width: 1px;
  align-self: stretch;
  margin: 0.2rem 0.25rem;
  background: #cbd5e1;
}
.sg-prog__empty-wrap {
  padding: 1.25rem 0.5rem 1.5rem;
  text-align: center;
}
.sg-prog__empty-wrap--banner {
  padding: 0.65rem 0.75rem;
  margin: 0 0 0.65rem;
  text-align: left;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
}
.sg-prog__empty {
  margin: 0;
  font-size: 0.92rem;
}
.sg-prog__empty-wrap--banner .sg-prog__empty {
  font-size: 0.82rem;
}
.sg-prog__empty-actions {
  margin: 0.85rem 0 0;
}
.sg-prog__empty-wrap--banner .sg-prog__empty-actions {
  margin: 0;
}
.sg-prog-days__btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-height: 40px;
  padding: 0.35rem 0.7rem;
  border-radius: 8px;
  border: 1px solid #d0d7e2;
  background: var(--surface, #fff);
  color: #334155;
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}
.sg-prog-days__btn.is-active {
  background: var(--accent, #0f766e);
  border-color: var(--accent, #0f766e);
  color: #fff;
}
.sg-prog-days__btn.is-today:not(.is-active) {
  border-color: #14b8a6;
  color: var(--accent, #0f766e);
}
.sg-prog-days__n {
  display: inline-flex;
  min-width: 1.2rem;
  justify-content: center;
  padding: 0.05rem 0.3rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
  font-size: 0.68rem;
}
.sg-prog-days__btn.is-active .sg-prog-days__n {
  background: rgba(255, 255, 255, 0.22);
}
.sg-prog-tipo {
  border: none;
  border-radius: 14px;
  padding: 0;
  width: min(100% - 1.5rem, 28rem);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
}
.sg-prog-tipo::backdrop {
  background: rgba(11, 31, 42, 0.5);
}
.sg-prog-tipo__panel {
  padding: 1rem 1.15rem 1.15rem;
}
.sg-prog-tipo__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}
.sg-prog-tipo__head h2 {
  margin: 0;
  font-size: 1.15rem;
}
.sg-prog-tipo select {
  width: 100%;
  min-height: 44px;
}
@media (max-width: 768px) {
  .sg-prog__fields {
    align-items: stretch;
  }
  .sg-prog__field {
    flex: 1 1 calc(50% - 0.35rem);
    min-width: 0;
  }
  .sg-prog__field--apply {
    flex: 1 1 100%;
  }
  .sg-prog__apply {
    width: 100%;
    min-height: 44px;
  }
  .sg-prog__filters select,
  .sg-prog__filters .sg-prog__combo input[type="search"] {
    min-height: 44px;
  }
  .sg-prog-grid thead th {
    min-width: 6.5rem;
    font-size: 0.7rem;
  }
  .sg-prog-grid__cell {
    min-width: 6.5rem;
  }
  .sg-prog-days__btn {
    min-height: 44px;
  }
}

/* ——— Parametri listini (Studio Gem) ——— */
.sg-parametri__modal-sub {
  margin: 0.2rem 0 0;
  font-size: 0.85rem;
}
.sg-parametri__modal-form .sg-parametri__form {
  margin-bottom: 0.5rem;
}
.sg-parametri {
  max-width: 72rem;
}
.sg-parametri__head {
  margin-bottom: 0.75rem;
}
.sg-parametri__title {
  font-size: 1.35rem;
  margin: 0;
}
.sg-parametri__lead {
  margin: 0.35rem 0 0;
  max-width: 40rem;
  line-height: 1.45;
}
.sg-parametri__tabs {
  margin-bottom: 0.85rem;
}
/* Pill / segmented switcher (teal active, stile calendario) */
.sg-parametri__seg {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 0.95rem;
}
.sg-parametri__seg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.15rem;
  padding: 0.35rem 0.9rem;
  border: 1px solid #d0d7e2;
  border-radius: 999px;
  background: #fff;
  color: #0f172a;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.sg-parametri__seg-btn:hover {
  border-color: var(--accent, #0f766e);
  color: var(--accent, #0f766e);
}
.sg-parametri__seg-btn.is-active,
.sg-parametri__seg-btn[aria-selected="true"] {
  background: var(--accent, #0f766e);
  border-color: var(--accent, #0f766e);
  color: #fff;
}
.sg-parametri__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.55rem 0.65rem;
  margin: 0 0 0.85rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  background: #f8fafc;
}
.sg-parametri__field {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  flex: 1 1 9.5rem;
  min-width: 8rem;
  margin: 0;
}
.sg-parametri__field--wide {
  flex: 1 1 16rem;
}
.sg-parametri__field--apply {
  flex: 0 0 auto;
  min-width: 0;
}
.sg-parametri__filter-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
  line-height: 1.2;
}
.sg-parametri__field-control {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
  width: 100%;
}
.sg-parametri__field-control select,
.sg-parametri__field-control input[type="search"],
.sg-parametri__field-control input[type="text"] {
  width: 100%;
  min-height: 40px;
  margin: 0;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #d0d7e2);
  border-radius: 8px;
  color: var(--text, #0f172a);
}
.sg-parametri__field--apply .btn {
  min-height: 40px;
  min-width: 6.5rem;
}
.sg-parametri__bar > input[type="search"],
.sg-parametri__bar > select {
  margin: 0;
  min-width: 0;
  flex: 1 1 10rem;
}
.sg-parametri__bar-main {
  display: flex;
  flex: 1 1 18rem;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}
.sg-parametri__bar-main select,
.sg-parametri__bar-main input {
  margin: 0;
  width: 100%;
}
.sg-parametri__bar-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted, #64748b);
  margin: 0;
}
.sg-parametri__switch {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 44px;
  margin: 0;
  font-size: 0.9rem;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.sg-parametri__switch input {
  width: auto;
  min-height: auto;
  margin: 0;
}
.sg-parametri__default-cell {
  width: 3.25rem;
  text-align: center;
  vertical-align: middle;
}
.sg-parametri__default-cell input[type="radio"] {
  display: inline-block;
}
.sg-parametri__panel,
.sg-parametri__list,
.sg-parametri__empty {
  margin-top: 0;
}
.sg-parametri__list {
  margin-bottom: 0.85rem;
}
.sg-parametri__panel {
  margin-top: 0.85rem;
}
.sg-parametri__panel--edit {
  border-color: #93c5fd;
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.12);
}
.sg-parametri__list-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  margin-bottom: 0.65rem;
}
.sg-parametri__list-head .sg-parametri__h2 {
  margin: 0;
}
.sg-parametri__count {
  font-weight: 600;
  font-size: 0.78rem;
  vertical-align: middle;
}
.sg-parametri__empty-msg {
  margin: 0.25rem 0 0.15rem;
  font-size: 0.9rem;
  line-height: 1.45;
}
.sg-parametri__h2 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.5rem;
}
.sg-parametri__h2-sub {
  font-weight: 400;
  font-size: 0.85rem;
  color: var(--muted, #64748b);
}
.sg-parametri__hint {
  margin: 0 0 0.85rem;
  font-size: 0.86rem;
  line-height: 1.4;
  max-width: 46rem;
}
.sg-parametri__form {
  margin-top: 0.25rem;
}
.sg-parametri__section-label {
  margin: 0.35rem 0 0;
  padding-top: 0.35rem;
  border-top: 1px solid var(--border, #e2e8f0);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted, #64748b);
}
.sg-parametri__section-label:first-of-type {
  border-top: 0;
  padding-top: 0;
  margin-top: 0;
}
.sg-parametri__field-label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.875rem;
  font-weight: 600;
}
.sg-parametri__field-hint {
  margin: 0.35rem 0 0;
  font-size: 0.75rem;
}
.sg-parametri__cats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}
.sg-parametri__cats-empty {
  margin: 0;
  font-size: 0.85rem;
}
/* Tag uniformi: stessa altezza/padding, selezione solo bordo/sfondo */
.sg-parametri__cat {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  height: 1.85rem;
  min-height: 1.85rem;
  max-height: 1.85rem;
  padding: 0 0.65rem;
  margin: 0;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 999px;
  background: #f8fafc;
  color: #475569;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  text-align: center;
  user-select: none;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.sg-parametri__cat::before {
  content: none;
  display: none;
}
.sg-parametri__cat span {
  display: block;
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sg-parametri__cat input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}
.sg-parametri__cat:hover:not(:has(input:disabled)) {
  border-color: #99f6e4;
  background: #f0fdfa;
  color: #0f766e;
}
.sg-parametri__cat:has(input:checked) {
  background: #ccfbf1;
  border-color: var(--accent, #0f766e);
  color: var(--accent, #0f766e);
  font-weight: 600;
}
.sg-parametri__cat:has(input:checked)::before {
  content: none;
  display: none;
}
.sg-parametri__cat:has(input:focus-visible) {
  outline: 2px solid var(--accent, #0f766e);
  outline-offset: 2px;
}
.sg-parametri__cat:has(input:disabled) {
  opacity: 0.55;
  cursor: not-allowed;
}
.sg-parametri__checks {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 1.25rem;
}
.sg-parametri__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.25rem;
}
.sg-parametri__actions .btn {
  min-height: 44px;
}
.sg-parametri__row-actions {
  margin: 0;
  justify-content: flex-end;
}
.sg-parametri__row-actions form {
  margin: 0;
}
.sg-parametri__price {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.sg-parametri__pack {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
  max-width: 28rem;
}
.sg-parametri__pack-title {
  display: inline-block;
  line-height: 1.25;
}
.sg-parametri__pack-desc {
  font-size: 0.82rem;
  line-height: 1.35;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: pre-line;
}
.sg-parametri__pack-meta {
  font-size: 0.78rem;
  line-height: 1.3;
  opacity: 0.9;
}
.sg-parametri__meta-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
}
.sg-parametri__chip {
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.45rem;
  border-radius: 6px;
  background: #f1f5f9;
  color: #334155;
  font-size: 0.75rem;
  line-height: 1.3;
}
.sg-parametri__chip--accent {
  background: #ecfdf5;
  color: #047857;
}
.sg-parametri__list tr.is-selected td {
  background: #f8fbff;
}
.sg-parametri__card-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: flex-start;
  justify-content: space-between;
}
.sg-parametri__form textarea {
  width: 100%;
  min-height: 4.5rem;
  resize: vertical;
}
@media (max-width: 768px) {
  .sg-parametri__bar {
    flex-direction: column;
    align-items: stretch;
  }
  .sg-parametri__field,
  .sg-parametri__field--wide,
  .sg-parametri__field--apply,
  .sg-parametri__bar-main,
  .sg-parametri__bar > input[type="search"],
  .sg-parametri__bar > select,
  .sg-parametri__bar > .btn {
    width: 100%;
    flex: 1 1 auto;
  }
  .sg-parametri__field--apply .btn {
    width: 100%;
  }
  .sg-parametri__seg {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    padding-bottom: 0.15rem;
  }
  .sg-parametri__switch {
    width: 100%;
  }
  .sg-parametri__list-head {
    flex-direction: column;
    align-items: stretch;
  }
  .sg-parametri__list-head .btn {
    width: 100%;
    min-height: 44px;
  }
  .sg-parametri__row-actions {
    width: 100%;
    justify-content: stretch;
  }
  .sg-parametri__row-actions .btn,
  .sg-parametri__row-actions form {
    flex: 1 1 auto;
  }
  .sg-parametri__row-actions .btn {
    min-height: 44px;
  }
  .sg-parametri__actions .btn {
    flex: 1 1 auto;
  }
}

/* ——— PWA update bar ——— */
.sx-pwa-update {
  position: fixed;
  left: 50%;
  bottom: calc(0.85rem + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 5000;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: calc(100vw - 1.5rem);
  padding: 0.7rem 0.9rem;
  border-radius: 999px;
  background: #0b1f2a;
  color: #fff;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.28);
}
.sx-pwa-update__btn {
  border: 0;
  border-radius: 999px;
  min-height: 36px;
  padding: 0.35rem 0.85rem;
  background: #14b8a6;
  color: #042f2e;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.sx-pwa-update__btn:hover { background: #2dd4bf; }
html.sx-pwa-standalone body.is-app .tabbar {
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* ——— Progetti board (griglia / elenco / kanban) ——— */
.prj-page { min-width: 0; }
.prj-head { margin-bottom: 1rem; }
.prj-head__title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
  margin-bottom: 0.85rem;
}
.prj-head__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 2.4vw, 1.45rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text);
}
.prj-head__count { color: var(--muted); font-weight: 600; }
.prj-head__new { min-height: 44px; }

.prj-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.55rem;
}
.prj-toolbar__search {
  position: relative;
  flex: 1 1 180px;
  min-width: 0;
}
.prj-toolbar__search-icon {
  position: absolute;
  left: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
  display: grid;
  place-items: center;
}
.prj-toolbar__search input {
  width: 100%;
  min-height: 44px;
  padding: 0.55rem 0.75rem 0.55rem 2.35rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font: inherit;
}
.prj-toolbar__stato {
  flex: 0 1 10rem;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 0.4rem 0.65rem;
  font: inherit;
}
.prj-view-toggle {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #f8fafc;
}
.prj-view-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 40px;
  padding: 0.35rem 0.7rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.prj-view-btn.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}
.prj-view-btn:hover { color: var(--text); }
@media (max-width: 768px) {
  .prj-view-btn span { display: none; }
  .prj-view-btn { min-width: 44px; justify-content: center; }
  .prj-toolbar__stato { flex: 1 1 100%; }
}

.prj-empty { padding: 1.25rem; }

.prj-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
}
@media (min-width: 700px) {
  .prj-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1100px) {
  .prj-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.prj-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  min-width: 0;
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}
.prj-card:hover {
  border-color: #b7c4d3;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
  transform: translateY(-1px);
}
.prj-card__link {
  display: block;
  padding: 1rem 1.05rem 0.95rem;
  color: inherit;
  text-decoration: none;
  min-height: 100%;
}
.prj-card__link:hover { text-decoration: none; }
.prj-card__name {
  margin: 0 0 0.75rem;
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
}
.prj-card__owner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
}
.prj-card__owner-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.88rem;
  color: var(--muted);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prj-avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  background: linear-gradient(145deg, #ccfbf1 0%, #99f6e4 100%);
  color: #0f766e;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
}
.prj-avatar--sm { width: 28px; height: 28px; font-size: 0.68rem; }
.prj-avatar--lg { width: 48px; height: 48px; font-size: 0.95rem; }

.sx-clienti-list__row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.sx-clienti-list__main { min-width: 0; flex: 1; }

.prj-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid transparent;
  white-space: nowrap;
}
.prj-badge--ok { background: #dcfce7; color: #15803d; border-color: #bbf7d0; }
.prj-badge--warn { background: #ffedd5; color: #c2410c; border-color: #fed7aa; }
.prj-badge--wait { background: #e0f2fe; color: #0369a1; border-color: #bae6fd; }
.prj-badge--done { background: #f1f5f9; color: #475569; border-color: #e2e8f0; }
.prj-badge--muted { background: #f8fafc; color: #64748b; border-color: #e2e8f0; }

.prj-progress {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.75rem;
}
.prj-progress__track {
  flex: 1 1 auto;
  height: 8px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
  min-width: 0;
}
.prj-progress__bar {
  height: 100%;
  border-radius: inherit;
  background: #14b8a6;
  transition: width 0.35s ease;
}
.prj-progress__bar--warn { background: #f97316; }
.prj-progress__bar--wait { background: #38bdf8; }
.prj-progress__bar--done,
.prj-progress__bar--muted { background: #94a3b8; }
.prj-progress__pct {
  flex: 0 0 auto;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  min-width: 2.4rem;
  text-align: right;
}

.prj-card__deadline {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: var(--muted);
}
.prj-card__deadline strong { color: var(--text); font-weight: 600; }
.prj-card__deadline.is-overdue,
.prj-kcard__meta.is-overdue,
.prj-overdue { color: var(--danger); }
.prj-card__deadline.is-overdue strong { color: var(--danger); }

.prj-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0;
}
.prj-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
  font-size: 0.9rem;
}
.prj-table th,
.prj-table td {
  text-align: left;
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.prj-table th {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 700;
  background: #f8fafc;
}
.prj-table__name {
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}
.prj-table__name:hover { text-decoration: underline; color: var(--accent); }
.prj-cell-person {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}
.prj-table__actions {
  display: flex;
  gap: 0.25rem;
  white-space: nowrap;
}

.prj-icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
}
.prj-icon-btn:hover {
  background: #f1f5f9;
  color: var(--text);
  text-decoration: none;
}

.prj-ring {
  --p: 0;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: conic-gradient(#14b8a6 calc(var(--p) * 1%), #e2e8f0 0);
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--text);
}
.prj-ring > span {
  width: 30px;
  height: 30px;
  border-radius: inherit;
  background: var(--surface);
  display: grid;
  place-items: center;
}

.prj-kanban {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  align-items: start;
}
@media (min-width: 900px) {
  .prj-kanban { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.prj-kanban__col {
  background: #f1f5f9;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.65rem;
  min-width: 0;
}
.prj-kanban__col-head h2 {
  margin: 0 0 0.65rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #475569;
}
.prj-kanban__cards {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-height: 4rem;
}
.prj-kanban__empty {
  margin: 0.35rem 0.15rem;
  font-size: 0.82rem;
}
.prj-kcard {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.prj-kcard:hover {
  border-color: #b7c4d3;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}
.prj-kcard__link {
  display: block;
  padding: 0.75rem 0.8rem 0.7rem;
  color: inherit;
  text-decoration: none;
  padding-right: 2.4rem;
}
.prj-kcard__link:hover { text-decoration: none; }
.prj-kcard__name {
  margin: 0 0 0.55rem;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.3;
}
.prj-kcard__owner {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.45rem;
  min-width: 0;
}
.prj-kcard__owner span:last-child {
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.prj-kcard__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  font-size: 0.78rem;
  color: var(--muted);
}
.prj-kcard__edit {
  position: absolute;
  right: 0.35rem;
  bottom: 0.35rem;
  width: 36px;
  height: 36px;
}

@media (prefers-reduced-motion: reduce) {
  .prj-card,
  .prj-kcard,
  .prj-progress__bar { transition: none; }
}

/* Posta: pager + loading anteprima AJAX */
.sx-mail__pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.75rem 0.65rem 1rem;
  border-top: 1px solid var(--border);
}
.sx-mail__pager-label {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
}
.sx-mail-read__loading {
  display: grid;
  place-content: center;
  gap: 0.35rem;
  min-height: 12rem;
  padding: 1.5rem;
  text-align: center;
  color: var(--muted);
}
.sx-mail__read.is-loading {
  opacity: 0.85;
}
.sx-mail-read__loading p { margin: 0; }

.sx-mail__account-meta.is-error { color: var(--danger); font-weight: 600; }
.sx-mail-read__imap-error {
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #991b1b;
}
.sx-mail-read__imap-error strong {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.95rem;
}
.sx-mail-read__imap-error p { margin: 0.35rem 0 0; font-size: 0.88rem; line-height: 1.45; }
.sx-mail-read__imap-error-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.85rem;
  margin-top: 0.75rem !important;
}
.sx-mail-read__imap-error-actions .muted { font-size: 0.8rem; color: #7f1d1d; }
.sx-mail-settings__last-error {
  margin: 0.65rem 0 0;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #991b1b;
  font-size: 0.82rem;
  line-height: 1.4;
}

/* ——— Scheda progetto (modale / pagina) ——— */
.prj-scheda {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  background: #fff;
  color: var(--text);
}
/* Form scheda: deve essere colonna flex così body scrolla e footer resta visibile */
.prj-scheda > form,
.act-scheda > form#gcal-event-form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  margin: 0;
}
.prj-scheda--page {
  height: auto;
  max-width: 72rem;
  margin: 0 auto;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
}
.prj-scheda--page > form {
  height: auto;
}
.prj-scheda__head {
  flex: 0 0 auto;
  padding: 1rem 1.15rem 0.85rem;
  border-bottom: 1px solid #e8eef4;
  background: linear-gradient(180deg, #f8fbfc 0%, #fff 70%);
}
.prj-scheda__title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}
.prj-scheda__title {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 2.4vw, 1.55rem);
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.25;
}
.prj-scheda__x {
  width: 40px;
  height: 40px;
  margin-left: auto;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 1.45rem;
  line-height: 1;
  cursor: pointer;
}
.prj-scheda__x:hover { background: #f1f5f9; color: var(--text); }
.prj-scheda__x:focus { outline: none; }
.prj-scheda__x:focus-visible { outline: 2px solid #94a3b8; outline-offset: 1px; }
.prj-scheda__meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1.25rem;
  margin-top: 0.65rem;
}
.prj-scheda__chip {
  display: inline-flex;
  align-items: center;
  padding: 0.22rem 0.65rem;
  border-radius: 999px;
  background: #eef2f6;
  color: #475569;
  font-size: 0.75rem;
  font-weight: 650;
}
.prj-scheda__chip--soft { background: #f1f5f9; color: var(--muted); font-weight: 600; }
.prj-scheda__progress {
  margin-left: auto;
  min-width: min(100%, 11rem);
  flex: 0 1 12rem;
}
.prj-scheda__progress-label {
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 0.28rem;
  text-align: right;
}
.prj-scheda__progress-label strong { color: var(--text); }
.prj-scheda__progress-track {
  height: 8px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
}
.prj-scheda__progress-bar {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0f766e, #14b8a6);
  transition: width 0.3s ease;
}

.prj-scheda__body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(15rem, 17.5rem);
  flex: 1;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
}
.prj-scheda__main {
  min-width: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 1rem 1.15rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}
.prj-scheda__aside {
  min-width: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 1rem 0.95rem 1.15rem;
  background: #f6f9fb;
  border-left: 1px solid #e8eef4;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.prj-scheda__section { min-width: 0; }
.prj-scheda__section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}
.prj-scheda__section-title,
.prj-scheda__aside-title {
  margin: 0 0 0.55rem;
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
}
.prj-scheda__section-head .prj-scheda__section-title { margin: 0; }

.prj-scheda label {
  display: block;
  font-size: 0.78rem;
  font-weight: 650;
  color: #64748b;
  margin: 0.7rem 0 0.28rem;
}
.prj-scheda input[type="text"],
.prj-scheda input[type="date"],
.prj-scheda input:not([type]),
.prj-scheda select,
.prj-scheda textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.55rem 0.75rem;
  background: #fff;
  font: inherit;
  box-sizing: border-box;
}
.prj-scheda textarea { min-height: 7rem; resize: vertical; }
.prj-scheda input.is-overdue { border-color: #fca5a5; color: var(--danger); }

.prj-scheda__cliente-wrap {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.prj-scheda__cliente-wrap select { flex: 1; min-width: 0; }

.prj-scheda__stati {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.prj-scheda__stato {
  position: relative;
  margin: 0 !important;
  cursor: pointer;
}
.prj-scheda__stato input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.prj-scheda__stato span {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: #f1f5f9;
  color: #64748b;
}
.prj-scheda__stato--ok span { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.prj-scheda__stato--wait span { background: #ffedd5; color: #c2410c; border-color: #fed7aa; }
.prj-scheda__stato--danger span { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.prj-scheda__stato--done span { background: #f1f5f9; color: #475569; border-color: #e2e8f0; }
.prj-scheda__stato--muted span { background: #f8fafc; color: #64748b; border-color: #e2e8f0; }
.prj-scheda__chip--warn {
  background: #ffedd5;
  color: #c2410c;
}
.prj-scheda__hint {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
}
.act-scheda__chk {
  display: flex !important;
  align-items: flex-start;
  gap: 0.55rem;
  margin: 0 0 0.55rem !important;
  font-size: 0.88rem !important;
  font-weight: 600 !important;
  color: var(--text) !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  cursor: pointer;
}
.act-scheda__chk input {
  width: auto;
  min-height: auto;
  margin-top: 0.2rem;
  flex: 0 0 auto;
}
.act-scheda__chk span { line-height: 1.35; }

/* —— Azioni e ore (scheda attività) —— */
.act-scheda__azioni {
  margin: 0.35rem 0 0;
  padding: 0.95rem 0.9rem 1rem;
  border: 1px solid #e8eef4;
  border-radius: 12px;
  background: #f8fafc;
}
.act-scheda__azioni--inline { margin-top: 0.35rem; }
.act-scheda__azioni-hint,
.act-scheda__azioni-hint--inline {
  margin: 0.85rem 0 0;
  font-size: 0.86rem;
}
.act-scheda__azioni-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}
.act-scheda__azioni-head .prj-scheda__section-title { margin: 0; }
.act-scheda__azioni-tot {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.act-scheda__azioni-form {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin: 0.55rem 0 0;
}
.act-scheda__azioni-form--row {
  display: grid;
  grid-template-columns: minmax(7rem, 1.5fr) 4.25rem minmax(7.5rem, 8.75rem) 4.25rem auto auto;
  gap: 0.4rem 0.45rem;
  align-items: end;
  margin: 0.55rem 0 0;
}
.act-scheda__azioni-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}
.act-scheda__azioni-field label {
  margin: 0 !important;
  font-size: 0.72rem !important;
}
.act-scheda__azioni-field-spacer {
  display: block;
  height: 1em;
  visibility: hidden;
}
.act-scheda__azioni-form--row .act-scheda__azioni-field input {
  min-height: 40px;
  font-size: 0.88rem;
  width: 100%;
}
.act-scheda__azioni-field--ore input,
.act-scheda__azioni-field--tariffa input {
  min-width: 0;
}
.act-scheda__azioni-field--submit .btn {
  min-height: 40px;
  white-space: nowrap;
}
.act-scheda__azioni-form--row.is-editing {
  outline: 2px solid rgba(15, 118, 110, 0.25);
  outline-offset: 4px;
  border-radius: 10px;
  padding: 0.35rem;
  background: #f0fdfa;
}
.act-scheda__azioni-list li.is-editing {
  background: #f0fdfa;
}
.act-scheda__azioni-field-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 650;
  color: #64748b;
  margin: 0 0 0.2rem;
}
.act-scheda__azioni-submit-row {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}
.sx-toggle--compact {
  min-height: 40px !important;
  margin: 0 !important;
}
.sx-toggle--compact .sx-toggle__text {
  font-size: 0.78rem;
}
.act-scheda__azioni-list {
  list-style: none;
  margin: 0.65rem 0 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}
.act-scheda__azioni-list li {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid #eef2f6;
  min-height: 44px;
}
.act-scheda__azioni-list li:last-child { border-bottom: 0; }
.act-scheda__azioni-item-main { min-width: 0; flex: 1; }
.act-scheda__azioni-item-main strong {
  display: block;
  font-size: 0.92rem;
  font-weight: 650;
  word-break: break-word;
}
.act-scheda__azioni-item-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.35rem;
  margin-top: 0.2rem;
  font-size: 0.78rem;
}
.act-scheda__azioni-item-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  flex: 0 0 auto;
}
.act-scheda__azioni-item-actions form { margin: 0; }
.act-scheda__pill {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #f1f5f9;
  font-size: 0.72rem;
  font-weight: 600;
  color: #475569;
}
.act-scheda__pill--ok {
  border-color: #a7f3d0;
  background: #ecfdf5;
  color: #047857;
}
.prj-scheda__foot {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.9rem 1.15rem calc(1.35rem + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid #e8eef4;
  background: #fff;
  box-shadow: 0 -6px 16px rgba(15, 23, 42, 0.04);
  z-index: 2;
}
.entity-modal__body--scheda .prj-scheda__foot,
.gcal-modal__panel--scheda .prj-scheda__foot,
.act-scheda .prj-scheda__foot {
  padding-bottom: calc(1.6rem + env(safe-area-inset-bottom, 0px));
}
.prj-scheda__foot .btn {
  min-height: 44px;
  padding-left: 1.1rem;
  padding-right: 1.1rem;
}
@media (max-width: 900px) {
  .act-scheda__azioni-form--row {
    grid-template-columns: 1fr 1fr;
  }
  .act-scheda__azioni-field--desc { grid-column: 1 / -1; }
  .act-scheda__azioni-field--billable { align-self: center; }
  .act-scheda__azioni-field--submit { grid-column: 1 / -1; }
  .act-scheda__azioni-field--submit .btn { width: 100%; min-height: 44px; }
}
@media (max-width: 768px) {
  .act-scheda__azioni {
    margin: 0.25rem 0 0;
    padding: 0.75rem 0.7rem 0.85rem;
  }
  .act-scheda__azioni-list li {
    flex-direction: column;
    align-items: stretch;
  }
  .act-scheda__azioni-list li .btn {
    width: 100%;
    min-height: 44px;
  }
  .act-scheda__azioni-item-actions { width: 100%; }
  .prj-scheda__foot {
    padding: 0.75rem 0.85rem calc(1.35rem + env(safe-area-inset-bottom, 0px));
  }
  .prj-scheda__foot .btn {
    flex: 1 1 auto;
    justify-content: center;
  }
}

.prj-scheda__stato input:checked + span {
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.22);
  transform: translateY(-1px);
}
.prj-scheda__stato input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.prj-scheda__dates {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.prj-scheda__acts {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
  background: #fff;
}
.prj-scheda__acts li { border-bottom: 1px solid #eef2f6; }
.prj-scheda__acts li:last-child { border-bottom: 0; }
.prj-scheda__acts a {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.7rem 0.85rem;
  color: inherit;
  text-decoration: none;
  min-height: 44px;
}
.prj-scheda__acts a:hover { background: #f8fafc; text-decoration: none; }
.prj-scheda__act-title { font-weight: 650; font-size: 0.92rem; }
.prj-scheda__act-meta { font-size: 0.78rem; color: var(--muted); }
.prj-scheda__acts li.is-done .prj-scheda__act-title {
  color: var(--muted);
  text-decoration: line-through;
}
.prj-scheda__empty { margin: 0.35rem 0 0; font-size: 0.88rem; }

.prj-scheda__aside-block {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.75rem 0.8rem;
}
.prj-scheda__aside-block textarea {
  min-height: 8rem;
  border-color: #e2e8f0;
}
.prj-scheda__details summary {
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 36px;
}
.prj-scheda__details summary::-webkit-details-marker { display: none; }
.prj-scheda__details summary::after {
  content: "›";
  font-size: 1.1rem;
  color: #94a3b8;
  transition: transform 0.15s ease;
}
.prj-scheda__details[open] summary::after { transform: rotate(90deg); }
.prj-scheda__dl {
  margin: 0.65rem 0 0;
  display: grid;
  gap: 0.55rem;
}
.prj-scheda__dl div { min-width: 0; }
.prj-scheda__dl dt {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #94a3b8;
  font-weight: 700;
}
.prj-scheda__dl dd {
  margin: 0.15rem 0 0;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}

.prj-scheda__actions {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.prj-scheda__action {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font-weight: 650;
  font-size: 0.88rem;
  text-decoration: none;
}
.prj-scheda__action:hover {
  border-color: #99f6e4;
  background: #f0fdfa;
  color: #0f766e;
  text-decoration: none;
}

/* —— Scheda cliente (stesso linguaggio prj-scheda) —— */
.cli-scheda .prj-scheda__title-row .prj-avatar {
  flex: 0 0 auto;
}
.cli-scheda__facts {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem 1rem;
}
.cli-scheda__facts--wide { grid-column: 1 / -1; }
.cli-scheda__facts dt {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #94a3b8;
  font-weight: 700;
}
.cli-scheda__facts dd {
  margin: 0.2rem 0 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
}
.cli-scheda__facts a { color: #0f766e; font-weight: 650; }
.cli-scheda__mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88rem;
  letter-spacing: 0.02em;
}
.cli-scheda__note-free {
  margin: 0.85rem 0 0;
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  white-space: pre-wrap;
  font-size: 0.9rem;
  color: #475569;
}
.cli-scheda__nota-form {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-bottom: 0.85rem;
}
.cli-scheda__nota-form textarea,
.cli-scheda__wa-form textarea {
  width: 100%;
  min-height: 5.5rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.55rem 0.75rem;
  font: inherit;
  box-sizing: border-box;
  resize: vertical;
}
.cli-scheda__notes {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.cli-scheda__notes li {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
  background: #fff;
}
.cli-scheda__note-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.65rem;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}
.cli-scheda__note-body {
  white-space: pre-wrap;
  font-size: 0.92rem;
  line-height: 1.45;
}
.cli-scheda__aside-id {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.65rem;
}
.cli-scheda__aside-id p { margin: 0.15rem 0 0; font-size: 0.8rem; }
.cli-scheda__wa-submit {
  width: 100%;
  margin-top: 0.5rem;
  min-height: 42px;
}
.cli-scheda__action-btn {
  width: 100%;
  cursor: pointer;
  font: inherit;
}
.cli-scheda__wa-log {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.cli-scheda__wa-log li p {
  margin: 0.3rem 0 0.15rem;
  font-size: 0.84rem;
  line-height: 1.35;
  color: var(--text);
}
.cli-scheda__wa-log .muted { font-size: 0.72rem; }

.cli-storico__summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0 0 1rem;
}
.cli-storico__chip {
  display: inline-flex;
  align-items: baseline;
  gap: 0.3rem;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border, #e2e8f0);
  background: #f8fafc;
  font-size: 0.78rem;
  color: #334155;
  min-height: 36px;
}
.cli-storico__chip strong { font-size: 0.95rem; color: #0f172a; }
.cli-storico__chip-sub { color: #64748b; font-size: 0.72rem; }
.cli-storico__chip--in { background: #ecfeff; border-color: #a5f3fc; }
.cli-storico__chip--out { background: #eff6ff; border-color: #bfdbfe; }
.cli-storico__chip--wa { background: #ecfdf5; border-color: #a7f3d0; }
.cli-storico__chip--altro { background: #fff7ed; border-color: #fed7aa; }

.cli-storico__timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.cli-storico__item {
  display: grid;
  grid-template-columns: 14px 1fr;
  gap: 0.65rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid #f1f5f9;
}
.cli-storico__item:last-child { border-bottom: 0; }
.cli-storico__rail {
  width: 10px;
  height: 10px;
  margin-top: 0.35rem;
  border-radius: 999px;
  background: #94a3b8;
  box-shadow: 0 0 0 3px #f1f5f9;
}
.cli-storico__item--email.cli-storico__item--in .cli-storico__rail { background: #0891b2; }
.cli-storico__item--email.cli-storico__item--out .cli-storico__rail { background: #2563eb; }
.cli-storico__item--whatsapp .cli-storico__rail { background: #059669; }
.cli-storico__item--nota .cli-storico__rail { background: #d97706; }
.cli-storico__item--attivita .cli-storico__rail { background: #7c3aed; }
.cli-storico__item--trattativa .cli-storico__rail,
.cli-storico__item--progetto .cli-storico__rail { background: #ea580c; }
.cli-storico__top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.35rem 0.75rem;
  align-items: baseline;
}
.cli-storico__kind {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
}
.cli-storico__when { font-size: 0.72rem; color: #94a3b8; }
.cli-storico__title {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.9rem;
  font-weight: 650;
  color: var(--text, #0f172a);
  text-decoration: none;
  word-break: break-word;
}
a.cli-storico__title:hover { text-decoration: underline; color: #0f766e; }
.cli-storico__meta {
  margin: 0.2rem 0 0;
  font-size: 0.78rem;
  line-height: 1.35;
}

@media (max-width: 768px) {
  .cli-storico__chip { flex: 1 1 calc(50% - 0.45rem); justify-content: center; }
}

@media (max-width: 860px) {
  .prj-scheda__body {
    grid-template-columns: 1fr;
    overflow: auto;
  }
  .prj-scheda__aside {
    border-left: 0;
    border-top: 1px solid #e8eef4;
  }
  .prj-scheda__progress {
    margin-left: 0;
    width: 100%;
    flex: 1 1 100%;
  }
  .prj-scheda__progress-label { text-align: left; }
  .prj-scheda__dates { grid-template-columns: 1fr; }
  .cli-scheda__facts { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .prj-scheda__progress-bar,
  .prj-scheda__stato input:checked + span,
  .prj-scheda__details summary::after { transition: none; }
}

/* ——— Metodi pagamento (catalogo) ——— */
.sg-metodi { padding-bottom: 1.25rem; }
.sg-metodi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.85rem;
  margin-top: 0.85rem;
}
.sg-metodo-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem 1.05rem;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background:
    linear-gradient(165deg, #ffffff 0%, #f8fafc 55%, #f1f5f9 100%);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.sg-metodo-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
  transform: translateY(-1px);
}
.sg-metodo-card.is-off {
  opacity: 0.72;
  background: #f8fafc;
}
.sg-metodo-card__mark {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}
.sg-metodo-icon {
  display: inline-flex;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}
.sg-metodo-icon svg { display: block; width: 40px; height: 40px; }
.sg-metodo-card__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}
.sg-metodo-card__desc {
  margin: 0.3rem 0 0;
  font-size: 0.82rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.sg-metodo-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.35rem;
  font-size: 0.78rem;
}
.sg-metodo-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: auto;
  padding-top: 0.15rem;
}
.sg-metodo-card__toggle { margin: 0; display: inline; }
@media (prefers-reduced-motion: reduce) {
  .sg-metodo-card,
  .sg-metodo-card:hover { transition: none; transform: none; }
}

/* ——— GemTeam (Team Manager in-app) ——— */
.gt-page { max-width: 1100px; }
.gt-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.4rem;
  margin: 0.75rem 0 1.25rem;
  padding: 0.4rem;
  background: #f1f5f9;
  border-radius: 12px;
}
@media (min-width: 720px) {
  .gt-tabs { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
.gt-tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: #475569;
  font: inherit;
  font-weight: 600;
  font-size: 0.88rem;
  padding: 0.55rem 0.4rem;
  border-radius: 8px;
  cursor: pointer;
}
.gt-tab:hover { background: #e2e8f0; }
.gt-tab.is-active {
  background: #fff;
  color: #0f172a;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}
.gt-section-title {
  margin: 0 0 0.85rem;
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.gt-live-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.25);
}
.gt-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.75rem;
  margin-bottom: 1rem;
  overflow-x: auto;
}
.gt-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}
.gt-toolbar__right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}
.gt-form-inline {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.65rem 0.75rem;
  align-items: end;
  margin-bottom: 1rem;
}
.gt-form-inline label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #64748b;
}
.gt-form-inline input,
.gt-form-inline select {
  font: inherit;
  padding: 0.4rem 0.5rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  color: #0f172a;
}
.gt-date { font: inherit; padding: 0.35rem 0.5rem; border-radius: 8px; border: 1px solid #cbd5e1; }
.gt-num { text-align: right; font-variant-numeric: tabular-nums; }
.gt-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
}
.gt-badge--in { background: #dcfce7; color: #166534; }
.gt-badge--out { background: #e2e8f0; color: #475569; }
.gt-badge--wait { background: #fef9c3; color: #854d0e; }
.gt-kpi--in .sg-kpi__v { color: #059669; }
.gt-kpi--out .sg-kpi__v { color: #64748b; }
.gt-kpi--wait .sg-kpi__v { color: #ca8a04; }
.gt-hint { font-size: 0.82rem; margin-top: 0.5rem; }
.gt-stub { padding: 1.25rem; }
.gt-view-toggle { display: inline-flex; gap: 0.25rem; }
.gt-view-btn.is-active {
  background: #0f172a;
  color: #fff;
  border-color: #0f172a;
}
.gt-week-label { margin-bottom: 0.75rem; font-size: 0.9rem; }
.gt-week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.5rem;
}
@media (max-width: 900px) {
  .gt-week-grid { grid-template-columns: 1fr 1fr; }
}
.gt-week-col {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  min-height: 8rem;
  background: #f8fafc;
}
.gt-week-col.is-selected { border-color: #0ea5e9; background: #f0f9ff; }
.gt-week-head {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 0.5rem 0.6rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 1px solid #e2e8f0;
}
.gt-week-head span { font-weight: 500; color: #64748b; font-size: 0.85em; }
.gt-week-body { padding: 0.4rem 0.5rem 0.6rem; display: flex; flex-direction: column; gap: 0.35rem; }
.gt-week-item {
  font-size: 0.78rem;
  line-height: 1.35;
  padding: 0.35rem 0.4rem;
  border-radius: 6px;
  background: #fff;
  border: 1px solid #e2e8f0;
  position: relative;
}
.gt-week-del {
  position: absolute;
  top: 0.15rem;
  right: 0.25rem;
  border: 0;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}
.gt-week-del:hover { color: #dc2626; }
.gt-week-empty { font-size: 0.8rem; padding: 0.25rem; }
.gt-presenze-summary { margin-bottom: 0.75rem; font-size: 0.9rem; }
.gt-actions { white-space: nowrap; }
.gt-toggle {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.gt-toggle input { width: auto; min-height: auto; }
.gt-modal {
  border: none;
  border-radius: 14px;
  padding: 0;
  width: min(100%, 560px);
  max-width: calc(100vw - 2rem);
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.22);
  background: transparent;
}
.gt-modal::backdrop {
  background: rgba(15, 23, 42, 0.45);
}
.gt-modal__panel {
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: min(90vh, 720px);
}
.gt-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid #e2e8f0;
}
.gt-modal__head h3 {
  margin: 0;
  font-size: 1.05rem;
}
.gt-modal__x {
  border: none;
  background: transparent;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: #64748b;
  border-radius: 8px;
  padding: 0.15rem 0.4rem;
}
.gt-modal__x:hover { background: #f1f5f9; color: #0f172a; }
.gt-modal__body {
  padding: 1rem 1.1rem;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.gt-modal__body label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.88rem;
  color: #334155;
}
.gt-modal__body input,
.gt-modal__body select {
  font: inherit;
  padding: 0.45rem 0.55rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
}
.gt-modal__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
@media (max-width: 560px) {
  .gt-modal__grid { grid-template-columns: 1fr; }
}
.gt-modal__foot {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.85rem 1.1rem;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
}
.btn-sm { padding: 0.25rem 0.55rem; font-size: 0.8rem; }


/* ——— Import wizard CSV/XLS ——— */
.sg-badge--err { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.sg-import__head {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.25rem;
}
.sg-import__title {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.sg-import__lead { margin: 0.35rem 0 0; max-width: 42rem; }
.sg-import__section-title {
  margin: 0 0 0.65rem;
  font-size: 1.05rem;
}
.sg-import__entity-badge {
  margin: 0 0 0.85rem;
  font-size: 0.9rem;
}
.sg-import__entity-badge a { margin-left: 0.5rem; }
.sg-import__tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
}
.sg-import__tile {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8fafc;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, background 0.15s;
}
.sg-import__tile:hover {
  border-color: var(--accent);
  background: #fff;
}
.sg-import__tile.is-disabled {
  opacity: 0.55;
  pointer-events: none;
}
.sg-import-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.sg-import-steps__item {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.35rem 0.7rem;
  border-radius: 6px;
  background: #f1f5f9;
  color: #64748b;
}
.sg-import-steps__item.is-active {
  background: var(--accent);
  color: #fff;
}
.sg-import-steps__item.is-done {
  background: #ecfdf5;
  color: #047857;
}
.sg-import-drop {
  border: 1.5px dashed var(--border);
  border-radius: 12px;
  padding: 1.75rem 1.25rem;
  text-align: center;
  background: #fafbfc;
}
.sg-import-drop.is-drag {
  border-color: var(--accent);
  background: #f0f9ff;
}
.sg-import-map select {
  width: 100%;
  min-width: 10rem;
  font: inherit;
  padding: 0.35rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
}
.sg-import-preview-wrap { max-height: 220px; overflow: auto; }
.sg-import-summary {
  margin-bottom: 0.85rem;
}
.sg-import-summary__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0.75rem 1rem;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
}
.sg-import__meta {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0 0 0.75rem;
}
.sg-import-options {
  display: grid;
  gap: 1rem;
  margin: 0 0 1.15rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8fafc;
}
.sg-import-options__field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}
.sg-import-options__field .req { color: #b91c1c; }
.sg-import-options__field select {
  width: 100%;
  max-width: 22rem;
  font: inherit;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
}
.sg-import-options__modes {
  margin: 0;
  padding: 0;
  border: 0;
}
.sg-import-options__modes legend {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.45rem;
  padding: 0;
}
.sg-import-match-keys {
  margin-top: 0.25rem;
}
.sg-import-match-keys__hint {
  margin: 0 0 0.65rem;
  font-size: 0.85rem;
  max-width: 40rem;
}
.sg-import-match-keys__grid {
  display: grid;
  gap: 0.55rem;
}
.sg-import-match-keys__row {
  display: grid;
  grid-template-columns: 8.5rem minmax(8rem, 1fr) auto minmax(8rem, 1fr);
  gap: 0.45rem;
  align-items: center;
}
.sg-import-match-keys__label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #334155;
}
.sg-import-match-keys__label .req { color: #b91c1c; }
.sg-import-match-keys__arrow {
  color: #64748b;
  font-weight: 600;
}
.sg-import-match-keys__row select {
  width: 100%;
  font: inherit;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
}
@media (max-width: 720px) {
  .sg-import-match-keys__row {
    grid-template-columns: 1fr;
    gap: 0.3rem;
  }
  .sg-import-match-keys__arrow { display: none; }
}
.sg-import-mode-default {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.75rem;
}
.sg-import-mode-default__off,
.sg-import-mode-default__on {
  font-size: 0.88rem;
  font-weight: 600;
  color: #64748b;
}
.sg-import-mode-default.is-overwrite .sg-import-mode-default__on,
.sg-import-mode-default:not(.is-overwrite) .sg-import-mode-default__off {
  color: var(--text, #0f172a);
}
.sg-import-mode-default__toggle {
  margin: 0 !important;
  min-height: 0 !important;
}
.sg-import-mode-default__hint {
  margin: 0.45rem 0 0;
  font-size: 0.8rem;
  line-height: 1.35;
  max-width: 36rem;
}
.sg-import-map th:nth-child(3),
.sg-import-map td:nth-child(3) {
  white-space: nowrap;
  width: 1%;
}
.sg-import-row-mode {
  margin: 0 !important;
  min-height: 0 !important;
  gap: 0.4rem;
  font-size: 0.8rem;
}
.sg-import-row-mode input {
  width: 2.2rem !important;
  max-width: 2.2rem !important;
  min-width: 2.2rem !important;
  height: 1.2rem !important;
}
.sg-import-row-mode input::after {
  width: 0.9rem;
  height: 0.9rem;
  left: 0.12rem;
}
.sg-import-row-mode input:checked::after {
  left: calc(100% - 1.05rem);
}
.sg-import-row-mode__label {
  font-weight: 600;
  color: #475569;
  min-width: 5.5rem;
}
.sg-import-row-mode--off {
  font-size: 0.8rem;
}
.sg-import-constants__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: 0.75rem 1rem;
}
.sg-import-constants__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
}
.sg-import-constants__switch {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}
.sg-import-constants__switch-off,
.sg-import-constants__switch-on {
  font-size: 0.82rem;
  font-weight: 600;
  color: #64748b;
}
.sg-import-constants.is-enabled .sg-import-constants__switch-on,
.sg-import-constants:not(.is-enabled) .sg-import-constants__switch-off {
  color: var(--text, #0f172a);
}
.sg-import-constants__toggle {
  margin: 0 !important;
  min-height: 0 !important;
}
.sg-import-constants__field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}
.sg-import-constants__field select {
  width: 100%;
  min-height: 2.1rem;
}
.sg-import-log {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
}
.sg-import-log__label {
  font-weight: 600;
  line-height: 1.35;
  word-break: break-word;
}
.sg-import-log__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.sg-import-log__chip {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #475569;
}
.sg-import-log__chip--entity {
  background: #f0fdfa;
  border-color: #99f6e4;
  color: #0f766e;
}
.sg-import-log__chip--season {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}
.sg-import-log__chip--sku {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.7rem;
}
.sg-import-log__hint {
  font-size: 0.78rem;
  color: #64748b;
  line-height: 1.3;
}
.sg-import__logs-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}
.sg-import-run-meta {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
  gap: 0.75rem 1.25rem;
  margin: 0;
}
.sg-import-run-meta dt {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  margin: 0;
}
.sg-import-run-meta dd {
  margin: 0.15rem 0 0;
  font-weight: 600;
}


/* ——— Comunicazioni Segreteria (chat inbox) ——— */
.sg-comm {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(280px, 1.45fr);
  gap: 1rem;
  align-items: stretch;
  min-height: min(72vh, 640px);
}
.sg-comm__inbox,
.sg-comm__pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0;
  overflow: hidden;
}
.sg-comm__inbox-head {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border, #e5e7eb);
  font-weight: 600;
  font-size: 0.9rem;
  flex-shrink: 0;
}
.sg-comm__list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow: auto;
  flex: 1;
}
.sg-comm__list > li {
  border-bottom: 1px solid var(--border, #f3f4f6);
}
.sg-comm__row {
  display: block;
  padding: 0.75rem 1rem;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s ease;
}
.sg-comm__row:hover { background: #f8fafc; }
.sg-comm__row.is-unread { background: #fffbeb; }
.sg-comm__row.is-active {
  background: color-mix(in srgb, var(--accent, #0f766e) 10%, #fff);
  box-shadow: inset 3px 0 0 var(--accent, #0f766e);
}
.sg-comm__row-top {
  display: flex;
  gap: 0.45rem;
  align-items: baseline;
  margin-bottom: 0.2rem;
}
.sg-comm__row-subj {
  flex: 1;
  font-size: 0.9rem;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sg-comm__badge-nuovo {
  font-size: 0.68rem;
  font-weight: 700;
  color: #92400e;
  background: #fef3c7;
  padding: 1px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}
.sg-comm__status {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  flex-shrink: 0;
  text-transform: lowercase;
}
.sg-comm__status--nuovo,
.sg-comm__status--in_attesa { color: #92400e; background: #fef3c7; }
.sg-comm__status--aperta { color: #166534; background: #dcfce7; }
.sg-comm__status--chiusa { color: #64748b; background: #f1f5f9; }
.sg-comm__row-meta { font-size: 0.8rem; }
.sg-comm__row-preview {
  font-size: 0.78rem;
  margin-top: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sg-comm__empty-list { padding: 1rem; margin: 0; }
.sg-comm__pane { padding: 0; }
.sg-comm__placeholder {
  display: grid;
  place-items: center;
  flex: 1;
  min-height: 280px;
  padding: 1.5rem;
}
.sg-comm__pane-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  align-items: flex-start;
  justify-content: space-between;
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--border, #e5e7eb);
  flex-shrink: 0;
}
.sg-comm__pane-titles h2 {
  margin: 0 0 0.2rem;
  font-size: 1.05rem;
}
.sg-comm__pane-titles .muted { margin: 0; font-size: 0.82rem; }
.sg-comm__pane-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}
.sg-comm__msgs {
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 1rem 1.1rem;
  background:
    linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  min-height: 220px;
  max-height: min(48vh, 420px);
}
.sg-comm__row-msg { display: flex; max-width: 100%; }
.sg-comm__row-msg--out { justify-content: flex-end; }
.sg-comm__row-msg--in { justify-content: flex-start; }
.sg-comm__bubble {
  max-width: 92%;
  border-radius: 14px;
  padding: 0.55rem 0.75rem;
  border: 1px solid transparent;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.sg-comm__bubble--out {
  background: color-mix(in srgb, var(--accent, #0f766e) 14%, #fff);
  border-color: color-mix(in srgb, var(--accent, #0f766e) 28%, #fff);
  border-bottom-right-radius: 4px;
}
.sg-comm__bubble--in {
  background: #fff;
  border-color: #e2e8f0;
  border-bottom-left-radius: 4px;
}
.sg-comm__bubble-meta {
  display: flex;
  gap: 0.5rem;
  justify-content: space-between;
  font-size: 0.68rem;
  font-weight: 700;
  color: #64748b;
  margin-bottom: 0.2rem;
}
.sg-comm__bubble-body {
  font-size: 0.9rem;
  white-space: pre-wrap;
  color: #0f172a;
  line-height: 1.4;
}
.sg-comm__composer-wrap {
  padding: 0.75rem 1.1rem 1rem;
  border-top: 1px solid var(--border, #e5e7eb);
  background: #fff;
  flex-shrink: 0;
}
.sg-comm__composer {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.sg-comm__composer textarea {
  width: 100%;
  border: 1px solid #d0d7e2;
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  font: inherit;
  resize: vertical;
  min-height: 72px;
}
.sg-comm__composer textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--accent, #0f766e) 35%, transparent);
  border-color: var(--accent, #0f766e);
}
.sg-comm__composer .btn { align-self: flex-end; min-width: 6.5rem; }
.sg-comm__closed-hint { margin: 0; font-size: 0.82rem; }

/* Platform alert: messaggi portale */
.sg-comm-alert {
  display: none;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 0 0 0.85rem;
  padding: 0.65rem 0.9rem;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--accent, #0f766e) 35%, #fff);
  background: color-mix(in srgb, var(--accent, #0f766e) 10%, #fff);
  color: #0f172a;
}
.sg-comm-alert.is-visible { display: flex; }
.sg-comm-alert__text { flex: 1; min-width: 12rem; font-size: 0.88rem; margin: 0; }
.sg-comm-alert__text strong { color: var(--accent, #0f766e); }
.sg-comm-alert__cta {
  font-weight: 700;
  font-size: 0.84rem;
  color: #fff;
  background: var(--accent, #0f766e);
  border-radius: 8px;
  padding: 0.4rem 0.85rem;
  text-decoration: none;
}
.sg-comm-alert__cta:hover { filter: brightness(1.05); }
.sg-comm-alert__dismiss {
  border: 0;
  background: transparent;
  color: #64748b;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.15rem 0.35rem;
}
.sx-nav-badge--comm {
  background: #b45309;
}
.sx-nav-badge--msg {
  background: #c62828;
}

/* ——— Today (Studio Gem) ——— */
.sg-today-hero {
  align-items: flex-end;
  margin-bottom: 0.75rem;
}
.sg-today-hero .sg-dash-hero__title {
  font-size: 1.35rem;
}
.sg-today-hero__chip {
  font-size: 0.78rem;
  font-weight: 700;
  color: #64748b;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  padding: 0.3rem 0.65rem;
  white-space: nowrap;
}
/* Riga 1 KPI + righe 2–4 shortcut ≈ 4 fasce compatte */
.sg-today-kpi {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.45rem;
  margin-bottom: 0.55rem;
}
@media (max-width: 900px) {
  .sg-today-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.sg-today-kpi__card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  color: inherit;
  text-decoration: none;
}
a.sg-today-kpi__card--link:hover {
  border-color: #cbd5e1;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
}
.sg-today-kpi__k {
  font-size: 0.62rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.sg-today-kpi__v {
  font-size: 1.2rem;
  font-weight: 800;
  margin-top: 0.08rem;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.sg-today-kpi__h {
  font-size: 0.68rem;
  color: #64748b;
  margin-top: 0.1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sg-today-shortcuts {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.4rem;
  margin-bottom: 0.85rem;
}
@media (max-width: 1100px) {
  .sg-today-shortcuts { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .sg-today-shortcuts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.sg-today-sc {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.55rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  min-height: 2.85rem;
  min-width: 0;
}
.sg-today-sc:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}
.sg-today-sc__ico {
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 9px;
  background: #eef2f6;
  color: #1e293b;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}
.sg-today-sc__ico .sx-icon {
  width: 1.55rem;
  height: 1.55rem;
  stroke-width: 1.65;
}
.sg-today-sc__txt {
  min-width: 0;
  flex: 1;
}
.sg-today-sc__label {
  display: block;
  font-weight: 750;
  font-size: 0.8rem;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sg-today-sc__hint {
  display: block;
  font-size: 0.65rem;
  color: #64748b;
  margin-top: 0.08rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sg-today-sc__badge {
  position: absolute;
  top: 0.25rem;
  right: 0.3rem;
}
.sg-today-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 0.65rem;
}
@media (max-width: 900px) {
  .sg-today-grid { grid-template-columns: 1fr; }
}
.sg-today-panel {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
}
.sg-today-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid #e2e8f0;
}
.sg-today-panel__title {
  margin: 0;
  font-size: 0.86rem;
  font-weight: 800;
}
.sg-today-panel__link {
  font-size: 0.72rem;
  font-weight: 700;
  color: #c62828;
  text-decoration: none;
}
.sg-today-panel__body {
  padding: 0.15rem 0.3rem 0.3rem;
  max-height: 15.4rem;
  overflow: auto;
}
.sg-today-panel__body--cal {
  max-height: 15.4rem; /* ~30% meno del precedente 22rem */
}
.sg-today-panel--full { margin-bottom: 0.65rem; }
.sg-today-panel--full .sg-today-panel__body { max-height: 12.6rem; }
.sg-today-panel__badge {
  font-size: 0.65rem;
  font-weight: 700;
  color: #64748b;
  background: #eef2f6;
  border-radius: 999px;
  padding: 0.15rem 0.5rem;
}
.sg-today-panel--stub { opacity: 0.92; }
.sg-today-panel__foot {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.65rem 0.55rem;
  border-top: 1px solid #e2e8f0;
  background: #fafbfc;
}

/* Giorno attuale compatto (sostituisce mini-mese) */
.sg-today-dayview {
  margin: 0.25rem 0.35rem 0.35rem;
  padding: 0.4rem 0.5rem 0.35rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}
.sg-today-dayview__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}
.sg-today-dayview__date {
  font-size: 0.78rem;
  font-weight: 800;
  color: #0f172a;
}
.sg-today-dayview__clock {
  font-size: 0.78rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #c62828;
}
.sg-today-dayview__now {
  margin-top: 0.35rem;
  height: 0;
  border-top: 1px dashed #fecaca;
  position: relative;
}
.sg-today-dayview__now span {
  position: absolute;
  left: 0;
  top: -0.55rem;
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #c62828;
  background: #f8fafc;
  padding-right: 0.35rem;
}

.sg-today-panel--cal .sg-today-day {
  padding: 0.42rem 0.45rem;
  border-radius: 8px;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 0.45rem;
}
.sg-today-panel--cal .sg-today-day__title { font-size: 0.82rem; }
.sg-today-panel--cal .sg-today-day__meta { font-size: 0.7rem; margin-top: 0.05rem; }
.sg-today-panel--cal .sg-today-day__time { font-size: 0.72rem; }
.sg-today-day.is-past {
  opacity: 0.48;
}
.sg-today-day.is-past .sg-today-day__title {
  text-decoration: line-through;
  text-decoration-color: #cbd5e1;
}
.sg-today-day.is-now {
  background: #fff5f5;
  box-shadow: inset 3px 0 0 #c62828;
}
.sg-today-day.is-now .sg-today-day__time { color: #c62828; }
.sg-today-pill--now {
  background: #c62828;
  color: #fff;
}

/* Mini calendario (legacy, non più in Today) */
.sg-mini-cal {
  margin: 0.35rem 0.4rem 0.65rem;
  padding: 0.55rem 0.5rem 0.45rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}
.sg-mini-cal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}
.sg-mini-cal__month {
  font-size: 0.78rem;
  font-weight: 800;
}
.sg-mini-cal__open {
  font-size: 0.68rem;
  font-weight: 700;
  color: #c62828;
  text-decoration: none;
}
.sg-mini-cal__dow,
.sg-mini-cal__week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.15rem;
}
.sg-mini-cal__dow {
  margin-bottom: 0.2rem;
}
.sg-mini-cal__dow span {
  text-align: center;
  font-size: 0.58rem;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
}
.sg-mini-cal__day {
  position: relative;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 7px;
  text-decoration: none;
  color: inherit;
  font-size: 0.72rem;
  font-weight: 650;
  min-height: 1.7rem;
}
a.sg-mini-cal__day:hover { background: #e2e8f0; }
.sg-mini-cal__day.is-out { color: #cbd5e1; }
.sg-mini-cal__day.is-today {
  background: #c62828;
  color: #fff;
  font-weight: 800;
}
.sg-mini-cal__day.has-items:not(.is-today) {
  background: #fff;
  box-shadow: inset 0 0 0 1px #e2e8f0;
}
.sg-mini-cal__dot {
  position: absolute;
  bottom: 0.15rem;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #c62828;
}
.sg-mini-cal__day.is-today .sg-mini-cal__dot { background: #fff; }

.sg-today-day__when {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  min-width: 3.4rem;
}
.sg-today-day__date {
  font-size: 0.65rem;
  font-weight: 700;
  color: #64748b;
}
.sg-today-upcoming .sg-today-day {
  grid-template-columns: 3.6rem minmax(0, 1fr) auto;
}

.sg-today-work {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
  margin-bottom: 1rem;
}
@media (max-width: 900px) {
  .sg-today-work { grid-template-columns: 1fr; }
}
.sg-today-todo {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.55rem 0.5rem;
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
}
.sg-today-todo:hover { background: #f8fafc; }
.sg-today-todo__prio {
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-size: 0.65rem;
  font-weight: 800;
  background: #e9eef3;
  color: #5c6570;
  flex: 0 0 auto;
}
.sg-today-todo__prio--urgente,
.sg-today-todo__prio--alta { background: #f0e2e6; color: #7a5a62; }
.sg-today-todo__prio--bassa { background: #eef2f6; color: #94a3b8; }
.sg-today-todo__title {
  display: block;
  font-weight: 700;
  font-size: 0.84rem;
  line-height: 1.2;
}
.sg-today-todo__meta {
  display: block;
  font-size: 0.7rem;
  color: #64748b;
  margin-top: 0.1rem;
}
.sg-today-empty {
  margin: 0.75rem 0.55rem;
  color: #64748b;
  font-size: 0.88rem;
  line-height: 1.45;
}
.sg-today-empty a { color: #c62828; font-weight: 700; text-decoration: none; }
.sg-today-day {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  gap: 0.65rem;
  align-items: center;
  padding: 0.7rem 0.55rem;
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
}
.sg-today-day:hover { background: #f8fafc; }
.sg-today-day__time {
  font-size: 0.78rem;
  font-weight: 800;
  color: #64748b;
  font-variant-numeric: tabular-nums;
}
.sg-today-day__title { font-weight: 750; font-size: 0.9rem; }
.sg-today-day__meta { font-size: 0.75rem; color: #64748b; margin-top: 0.12rem; }
.sg-today-pill {
  display: inline-flex;
  align-items: center;
  min-height: 1.45rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 650;
  background: #e9eef3;
  color: #5c6570;
}
.sg-today-pill--warn { background: #f0e2e6; color: #7a5a62; }
.sg-today-msg {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 0.65rem;
  align-items: start;
  padding: 0.7rem 0.55rem;
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
}
.sg-today-msg:hover { background: #f8fafc; }
.sg-today-msg__av {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #334155;
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 0.7rem;
  font-weight: 800;
}
.sg-today-msg__av--portal { background: #5f8f97; }
.sg-today-msg__av--chat { background: #7c6cf0; }
.sg-today-msg__from { font-weight: 750; font-size: 0.86rem; }
.sg-today-msg__preview {
  font-size: 0.76rem;
  color: #64748b;
  margin-top: 0.12rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sg-today-msg__src {
  font-size: 0.65rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.15rem;
}
.sg-today-msg__aside {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
}
.sg-today-msg__time { font-size: 0.68rem; color: #64748b; white-space: nowrap; }
.sg-today-msg__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #c62828;
  margin-top: 0.15rem;
}
.sg-msg-hub {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1.15rem;
}
@media (max-width: 700px) {
  .sg-msg-hub { grid-template-columns: 1fr; }
}
.sg-msg-hub__card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1rem 1.1rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  text-decoration: none;
  color: inherit;
}
.sg-msg-hub__card:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}
.sg-msg-hub__ico {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 10px;
  background: #f1f5f9;
  display: grid;
  place-items: center;
  color: #334155;
  flex: 0 0 auto;
}
.sg-msg-hub__body { flex: 1; min-width: 0; }
.sg-msg-hub__k {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.sg-msg-hub__v {
  display: block;
  font-weight: 800;
  font-size: 1.05rem;
  margin-top: 0.15rem;
}
.sg-msg-hub__h {
  display: block;
  font-size: 0.78rem;
  color: #64748b;
  margin-top: 0.15rem;
}

/* Teo knock-on-glass interrupt */
.teo-knock {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
.teo-knock.is-open {
  pointer-events: auto;
  opacity: 1;
  visibility: visible;
}
.teo-knock__glass {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(15, 23, 42, 0.18), rgba(15, 23, 42, 0.55));
  backdrop-filter: blur(2px);
  animation: teo-knock-glass-shimmer 2.4s ease-in-out infinite;
}
.teo-knock__panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  max-width: 28rem;
  text-align: center;
}
.teo-knock__figure {
  width: min(42vw, 280px);
  height: auto;
  filter: drop-shadow(0 18px 28px rgba(15, 23, 42, 0.35));
  animation: teo-knock-tap 1.1s cubic-bezier(0.36, 0.07, 0.19, 0.97) infinite;
  transform-origin: 50% 90%;
  user-select: none;
  pointer-events: none;
}
.teo-knock__ripple {
  position: absolute;
  width: min(48vw, 320px);
  height: min(48vw, 320px);
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.45);
  animation: teo-knock-ripple 1.1s ease-out infinite;
  pointer-events: none;
}
.teo-knock__card {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 16px;
  padding: 1rem 1.15rem 1.1rem;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.22);
}
.teo-knock__who {
  display: block;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent, #0f766e);
  margin-bottom: 0.25rem;
}
.teo-knock__line {
  margin: 0 0 0.85rem;
  font-size: 1rem;
  line-height: 1.35;
  color: #0f172a;
}
.teo-knock__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}
.teo-knock__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 1rem;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.88rem;
  text-decoration: none;
  color: #fff;
  background: var(--accent, #0f766e);
}
.teo-knock__dismiss {
  min-height: 40px;
  padding: 0 0.9rem;
  border-radius: 8px;
  border: 1px solid #d0d7e2;
  background: #fff;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  color: #475569;
}
@keyframes teo-knock-tap {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  18% { transform: translate(-3px, -10px) rotate(-2deg); }
  28% { transform: translate(2px, 4px) rotate(1.5deg); }
  38% { transform: translate(-1px, -6px) rotate(-1deg); }
  48% { transform: translate(0, 2px) rotate(0.5deg); }
  60% { transform: translate(0, 0) rotate(0deg); }
}
@keyframes teo-knock-ripple {
  0% { transform: scale(0.55); opacity: 0.55; }
  70% { opacity: 0.12; }
  100% { transform: scale(1.15); opacity: 0; }
}
@keyframes teo-knock-glass-shimmer {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.92; }
}
@media (max-width: 800px) {
  .sg-comm {
    grid-template-columns: 1fr;
    min-height: 0;
  }
  .sg-comm__inbox { max-height: 40vh; }
  .sg-comm__msgs { max-height: 42vh; }
}

/* —— StarGem UI dialog (confirm/alert proprietari) —— */
.sg-ui-dialog {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: calc(100vw - 2rem);
}
.sg-ui-dialog::backdrop {
  background: rgba(11, 31, 42, 0.55);
}
.sg-ui-dialog__panel {
  margin: 0;
  width: min(100vw - 2rem, 420px);
  background: #fff;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 18px 48px rgba(11, 31, 42, 0.28);
  overflow: hidden;
  font-family: "IBM Plex Sans", sans-serif;
}
.sg-ui-dialog__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem 0.55rem;
  border-bottom: 1px solid #eef2f6;
}
.sg-ui-dialog__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #64748b;
  text-transform: uppercase;
}
.sg-ui-dialog__mark {
  width: 18px;
  height: 18px;
  border-radius: 4px;
}
.sg-ui-dialog__x {
  border: 0;
  background: transparent;
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  font-size: 1.35rem;
  line-height: 1;
  color: #64748b;
  cursor: pointer;
}
.sg-ui-dialog__x:hover { background: #f1f5f9; color: #0f172a; }
.sg-ui-dialog__body {
  padding: 1rem 1.1rem 0.35rem;
}
.sg-ui-dialog__title {
  margin: 0 0 0.45rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f172a;
  font-family: "IBM Plex Sans Condensed", "IBM Plex Sans", sans-serif;
}
.sg-ui-dialog__msg {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.45;
  color: #334155;
  white-space: pre-wrap;
}
.sg-ui-dialog__foot {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.85rem 1.1rem 1rem;
}
.sg-ui-dialog--danger .sg-ui-dialog__title { color: #991b1b; }
.sg-ui-dialog[open] { z-index: 4000; }

/* —— Vetrina copertine AI —— */
.sg-vetrina-cats {
  display: grid;
  gap: 1rem;
  max-width: 44rem;
}
.sg-vetrina-cat {
  display: grid;
  gap: 0.35rem;
  padding: 0.85rem 0.9rem;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
}
.sg-vetrina-cat__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.sg-vetrina-cat__name {
  font-size: 0.95rem;
}
.sg-vetrina-cat__thumb {
  width: 72px;
  height: 40px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  background: #f1f5f9;
}
.sg-vetrina-cat__lbl {
  margin: 0.35rem 0 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
}
.sg-vetrina-cat textarea {
  width: 100%;
  min-height: 4.2rem;
  resize: vertical;
  font: inherit;
  font-size: 0.88rem;
}
.sg-vetrina-cat__url-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.sg-vetrina-cat__url-row input[type="url"] {
  flex: 1 1 12rem;
  min-width: 0;
}
.sg-vetrina-cat__status {
  margin: 0.15rem 0 0;
  font-size: 0.8rem;
}

/* ── Searchable selects (SgSelectSearch) ───────────────────────── */
.sg-select-search {
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
}
/* Kill native face completely: filter/prog select rules (width/min-height/padding-left)
   otherwise leave the OS <select> text visible under the custom control. */
.sg-select-search > select.sg-select-search__native,
select.sg-select-search__native {
  position: absolute !important;
  left: 0 !important;
  top: 0 !important;
  right: auto !important;
  bottom: auto !important;
  width: 1px !important;
  height: 1px !important;
  max-width: 1px !important;
  max-height: 1px !important;
  min-width: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  appearance: none !important;
  -webkit-appearance: none !important;
  font-size: 0 !important;
  line-height: 0 !important;
  color: transparent !important;
  background: transparent !important;
  box-shadow: none !important;
  z-index: -1 !important;
  -webkit-text-fill-color: transparent !important;
}
.sg-select-search__control {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  min-height: 42px;
  padding: 0.45rem 0.65rem 0.45rem 0.7rem;
  margin: 0;
  border: 1px solid var(--border, #d0d7e2);
  border-radius: 8px;
  background: #fff;
  color: var(--text, #0f172a);
  font: inherit;
  font-size: 0.92rem;
  text-align: left;
  cursor: pointer;
  box-sizing: border-box;
}
.sg-select-search__control:hover:not(:disabled) {
  border-color: #94a3b8;
}
.sg-select-search__control:focus {
  outline: none;
}
.sg-select-search__control:focus-visible,
.sg-select-search.is-open .sg-select-search__control {
  border-color: var(--accent, #0f766e);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15);
}
.sg-select-search.is-disabled .sg-select-search__control,
.sg-select-search__control:disabled {
  opacity: 0.62;
  cursor: not-allowed;
  background: #f8fafc;
}
.sg-select-search__value {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sg-select-search.is-placeholder .sg-select-search__value {
  color: var(--muted, #64748b);
  font-weight: 500;
}
.sg-select-search__caret {
  flex: 0 0 auto;
  width: 0.55rem;
  height: 0.55rem;
  border-right: 2px solid #64748b;
  border-bottom: 2px solid #64748b;
  transform: rotate(45deg) translateY(-2px);
  opacity: 0.75;
}
.sg-select-search.is-open .sg-select-search__caret {
  transform: rotate(225deg) translateY(-1px);
  border-color: var(--accent, #0f766e);
}
.sg-select-search__panel {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.45rem;
  background: #fff;
  border: 1px solid #d0d7e2;
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14);
  overflow: hidden;
}
.sg-select-search__panel[hidden] {
  display: none !important;
}
.sg-select-search__search {
  position: relative;
  flex: 0 0 auto;
}
.sg-select-search__input {
  width: 100% !important;
  min-height: 36px !important;
  margin: 0 !important;
  padding: 0.4rem 0.65rem 0.4rem 2rem !important;
  border: 1px solid #d0d7e2 !important;
  border-radius: 8px !important;
  background: #f8fafc !important;
  font: inherit !important;
  font-size: 0.88rem !important;
  box-shadow: none !important;
}
.sg-select-search__input:focus {
  outline: none !important;
  border-color: var(--accent, #0f766e) !important;
  background: #fff !important;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12) !important;
}
.sg-select-search__search::before {
  content: "";
  position: absolute;
  left: 0.7rem;
  top: 50%;
  width: 0.7rem;
  height: 0.7rem;
  border: 1.75px solid #64748b;
  border-radius: 50%;
  transform: translateY(-55%);
  pointer-events: none;
  opacity: 0.85;
  z-index: 1;
}
.sg-select-search__search::after {
  content: "";
  position: absolute;
  left: 1.28rem;
  top: 58%;
  width: 0.4rem;
  height: 1.75px;
  background: #64748b;
  transform: rotate(45deg);
  pointer-events: none;
  opacity: 0.85;
  z-index: 1;
}
.sg-select-search__list {
  position: relative !important;
  left: auto !important;
  right: auto !important;
  top: auto !important;
  flex: 1 1 auto;
  max-height: none;
  min-height: 0;
  overflow: auto;
  margin: 0 !important;
  padding: 0.15rem !important;
  border: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
}
.sg-select-search__option {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.sg-select-search__option.is-selected {
  background: rgba(15, 118, 110, 0.1);
  color: #0f766e;
  font-weight: 600;
}
.sg-select-search__option.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.sg-select-search__check {
  flex: 0 0 1rem;
  width: 1rem;
  text-align: center;
  color: var(--accent, #0f766e);
  font-weight: 700;
}
.sg-select-search__opt-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sg-select-search__empty {
  padding: 0.65rem 0.55rem;
  color: var(--muted, #64748b);
  font-size: 0.86rem;
  text-align: center;
}
.sg-filter-control .sg-select-search__control,
.sg-filter-bar .sg-select-search__control,
.sg-filter-row .sg-select-search__control,
.sg-parametri__field-control .sg-select-search__control {
  min-height: 40px;
}
.sx-tenant-switch .sg-select-search {
  width: auto;
  min-width: 7rem;
}
.sx-tenant-switch .sg-select-search__control {
  min-height: 32px;
  padding: 0.25rem 0.5rem;
  border-color: transparent;
  background: transparent;
  font-size: 0.85rem;
}
