/* =============================================================================
   Gestionale JEM Fitness Center — Design system
   Token → base → layout → componenti → pagine. Nessun framework.
   Il colore primario (--brand) è impostato dal layout da Società → Parametri.
   ============================================================================= */

/* ---------------------------------------------------------------- Token ---- */
:root {
  --brand: #e52784;
  --brand-strong: color-mix(in oklab, var(--brand) 82%, #000);
  --brand-soft: color-mix(in oklab, var(--brand) 12%, transparent);
  --brand-ring: color-mix(in oklab, var(--brand) 40%, transparent);
  --on-brand: #fff;

  --bg: #f5f5f5;
  --bg-accent: radial-gradient(1200px 600px at 100% -10%, color-mix(in oklab, var(--brand) 9%, transparent), transparent 60%);
  --surface: #ffffff;
  --surface-2: #f4f4f4;
  --surface-3: #e5e5e5;
  --glass: rgba(255, 255, 255, 0.72);
  --text: #222222;
  --text-2: #474747;
  --muted: #777777;
  --faint: #9a9a9a;
  --border: rgba(34, 34, 34, 0.09);
  --border-strong: #cccccc;

  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --info: #0284c7;

  /* Palette categorie validata (daltonismo e contrasto) con lo strumento dataviz */
  --cat-sala: #222222;
  --cat-corsi: #16a34a;
  --cat-discipline: #ea580c;
  --cat-personal: #7c3aed;
  /* Coppia entrate/uscite validata con lo strumento dataviz */
  --fin-entrate: #2563eb;
  --fin-uscite: #e0662b;

  --shadow-xs: 0 1px 2px rgba(43, 43, 43, 0.05);
  --shadow-sm: 0 1px 2px rgba(43, 43, 43, 0.04), 0 2px 6px rgba(43, 43, 43, 0.04);
  --shadow-md: 0 1px 2px rgba(43, 43, 43, 0.05), 0 8px 24px -6px rgba(43, 43, 43, 0.1);
  --shadow-lg: 0 2px 6px rgba(43, 43, 43, 0.06), 0 24px 48px -12px rgba(43, 43, 43, 0.22);

  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;

  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, monospace;

  --sb-w: 264px;
  --sb-w-espansa: 264px;
  --sb-w-compressa: 76px;
  --topbar-h: 64px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  color-scheme: light;
}

:root[data-theme="dark"] {
  --brand-strong: color-mix(in oklab, var(--brand) 78%, #fff);
  --brand-soft: color-mix(in oklab, var(--brand) 18%, transparent);
  --bg: #121212;
  --bg-accent: radial-gradient(1200px 600px at 100% -10%, color-mix(in oklab, var(--brand) 14%, transparent), transparent 60%);
  --surface: #212121;
  --surface-2: #2a2a2a;
  --surface-3: #333333;
  --glass: rgba(33, 33, 33, 0.74);
  --text: #f2f2f2;
  --text-2: #d0d0d0;
  --muted: #a3a3a3;
  --faint: #6f6f6f;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #f87171;
  --info: #38bdf8;
  --cat-sala: #e5e5e5;
  --cat-corsi: #22c55e;
  --cat-discipline: #fb923c;
  --cat-personal: #a78bfa;
  --fin-entrate: #3b82f6;
  --fin-uscite: #e0662b;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3), 0 2px 6px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px -6px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 2px 6px rgba(0, 0, 0, 0.4), 0 24px 48px -12px rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}

/* ----------------------------------------------------------------- Base ---- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-rendering: optimizeLegibility; }
body {
  margin: 0;
  font: 400 14px/1.55 var(--font);
  font-feature-settings: "cv11", "ss01";
  color: var(--text);
  background: var(--bg-accent), var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -0.015em; color: var(--text); }
h1 { font-size: 24px; font-weight: 650; }
h2 { font-size: 17px; font-weight: 620; }
h3 { font-size: 15px; font-weight: 600; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img, svg { display: block; }
.num, table { font-variant-numeric: tabular-nums; }

.icon {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
}
.icon-sm { width: 16px; height: 16px; }
.icon-xs { width: 14px; height: 14px; }
.icon-lg { width: 22px; height: 22px; }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: var(--radius-xs); }

::selection { background: var(--brand-ring); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; top: 12px; left: 12px; z-index: 100; transform: translateY(-160%);
  background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: var(--radius-sm); font-weight: 600;
  transition: transform .2s var(--ease);
}
.skip-link:focus { transform: none; }

/* Scrollbar discreta */
* { scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }

/* --------------------------------------------------------------- Layout ---- */
.app {
  display: grid;
  grid-template-columns: var(--sb-w) minmax(0, 1fr);
  min-height: 100vh;
}
html.sb-compressa { --sb-w: var(--sb-w-compressa); }

.main-col { min-width: 0; display: flex; flex-direction: column; }
.content {
  flex: 1;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 28px 32px 56px;
}

/* -------------------------------------------------------------- Sidebar ---- */
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  z-index: 40;
  overflow: hidden;
}
.sb-head {
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 16px 0 18px;
  border-bottom: 1px solid var(--border);
  flex: none;
}
.brand-mark {
  width: 36px; height: 36px; flex: none;
  display: grid; place-items: center;
  border-radius: 11px;
  background: linear-gradient(135deg, color-mix(in oklab, var(--brand) 85%, #fff), var(--brand-strong));
  color: var(--on-brand);
  font-weight: 750; font-size: 13px; letter-spacing: .02em;
  box-shadow: 0 6px 16px -6px var(--brand-ring), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.brand-mark img { width: 100%; height: 100%; object-fit: contain; border-radius: inherit; }
.brand-text { min-width: 0; line-height: 1.2; }
.brand-text strong { display: block; font-size: 13.5px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text span { font-size: 12px; color: var(--muted); white-space: nowrap; }

.sb-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 12px 10px 16px; }
.sb-label {
  font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--faint); padding: 14px 12px 6px; white-space: nowrap;
}
.sb-link, .sb-group-btn {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  width: 100%; min-height: 38px;
  padding: 8px 12px;
  border: 0; border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-2);
  font-size: 13.5px; font-weight: 500; text-align: left;
  white-space: nowrap;
  transition: background-color .15s, color .15s;
}
.sb-link:hover, .sb-group-btn:hover { background: var(--surface-2); color: var(--text); }
.sb-link .icon, .sb-group-btn > .icon:first-child { color: var(--muted); transition: color .15s; }
.sb-link:hover .icon, .sb-group-btn:hover > .icon:first-child { color: var(--text); }
.sb-link.is-active {
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-weight: 600;
}
.sb-link.is-active .icon { color: var(--brand); }
.sb-link.is-active::before {
  content: ""; position: absolute; left: -10px; top: 9px; bottom: 9px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--brand);
}
.sb-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.sb-chevron { margin-left: auto; color: var(--faint); transition: transform .25s var(--ease); }
.sb-group.is-open > .sb-group-btn .sb-chevron { transform: rotate(90deg); }
.sb-group.has-active > .sb-group-btn { color: var(--text); }
.sb-group.has-active > .sb-group-btn > .icon:first-child { color: var(--brand); }

.sb-sub { overflow: hidden; }
.sb-group:not(.is-open) > .sb-sub { height: 0; }
.sb-sub-inner { padding: 2px 0 6px 20px; position: relative; }
.sb-sub-inner::before {
  content: ""; position: absolute; left: 21px; top: 4px; bottom: 10px; width: 1px; background: var(--border-strong);
}
.sb-sub .sb-link { min-height: 34px; padding-left: 22px; font-size: 13px; }
.sb-sub .sb-link .icon { width: 16px; height: 16px; }
.sb-sub .sb-link.is-active::before { display: none; }

.sb-foot { padding: 10px; border-top: 1px solid var(--border); flex: none; }
.sb-collapse-btn .icon-close { display: block; }
.sb-collapse-btn .icon-open { display: none; }
html.sb-compressa .sb-collapse-btn .icon-close { display: none; }
html.sb-compressa .sb-collapse-btn .icon-open { display: block; }

/* Sidebar compressa: solo icone, tooltip e menu a comparsa per le sezioni */
@media (min-width: 1024px) {
  html.sb-compressa .sb-head { padding: 0 20px; }
  html.sb-compressa .brand-text,
  html.sb-compressa .sb-text,
  html.sb-compressa .sb-chevron,
  html.sb-compressa .sb-label { opacity: 0; pointer-events: none; }
  html.sb-compressa .sb-label { height: 12px; padding: 0; }
  html.sb-compressa .sb-link, html.sb-compressa .sb-group-btn { justify-content: flex-start; padding-left: 17px; }
  html.sb-compressa .sb-nav { overflow: visible; }
  html.sb-compressa .sidebar { overflow: visible; }
  html.sb-compressa .sb-group > .sb-sub { height: 0 !important; }
  html.sb-compressa .sb-group { position: relative; }
  html.sb-compressa .sb-group:hover > .sb-flyout,
  html.sb-compressa .sb-group:focus-within > .sb-flyout { opacity: 1; visibility: visible; transform: none; }

  html.sb-compressa [data-tooltip]:hover::after,
  html.sb-compressa [data-tooltip]:focus-visible::after {
    content: attr(data-tooltip);
    position: absolute; left: calc(100% + 12px); top: 50%; transform: translateY(-50%);
    background: var(--text); color: var(--bg);
    font-size: 12px; font-weight: 550; padding: 6px 10px; border-radius: var(--radius-xs);
    white-space: nowrap; box-shadow: var(--shadow-md); z-index: 60; pointer-events: none;
  }
  html.sb-compressa .sb-group:hover > [data-tooltip]::after { display: none; }
}
.sb-flyout {
  position: absolute; left: calc(100% + 8px); top: -6px; z-index: 60;
  min-width: 232px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  opacity: 0; visibility: hidden; transform: translateX(-4px);
  transition: opacity .15s, transform .2s var(--ease), visibility .15s;
}
.sb-flyout::before { content: ""; position: absolute; left: -12px; top: 0; bottom: 0; width: 12px; }
.sb-flyout-title { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); padding: 8px 10px 4px; }
.sb-flyout .sb-link { min-height: 34px; font-size: 13px; padding-left: 10px; }
.sb-flyout .sb-link .sb-text { opacity: 1 !important; }
.sb-flyout .sb-link.is-active::before { display: none; }
html:not(.sb-compressa) .sb-flyout { display: none; }

.sb-backdrop { display: none; }

/* --------------------------------------------------------------- Topbar ---- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 24px 0 20px;
  background: var(--glass);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar .topbar-menu { display: none; }
.breadcrumb { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 13px; color: var(--muted); }
.breadcrumb ol { display: flex; align-items: center; gap: 6px; list-style: none; margin: 0; padding: 0; min-width: 0; }
.breadcrumb li { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.breadcrumb li:not(:last-child)::after {
  content: ""; width: 5px; height: 5px; border-right: 1.5px solid var(--faint); border-top: 1.5px solid var(--faint);
  transform: rotate(45deg); margin: 0 4px 0 2px;
}
.breadcrumb a:hover { color: var(--text); }
.breadcrumb [aria-current] { color: var(--text); font-weight: 550; overflow: hidden; text-overflow: ellipsis; }
.topbar-spacer { flex: 1; }

.search-trigger {
  display: flex; align-items: center; gap: 10px;
  width: 280px; height: 38px; padding: 0 8px 0 12px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
  color: var(--muted); font-size: 13px;
  transition: border-color .15s, background-color .15s, box-shadow .15s;
}
.search-trigger:hover { border-color: var(--border-strong); background: var(--surface); }
.search-trigger span { flex: 1; text-align: left; }
.kbd {
  display: inline-flex; align-items: center; gap: 2px;
  font: 600 11px/1 var(--font); color: var(--muted);
  padding: 4px 6px; border-radius: 6px;
  background: var(--surface); border: 1px solid var(--border-strong);
  box-shadow: 0 1px 0 var(--border-strong);
}

/* --------------------------------------------------------------- Bottoni ---- */
.btn {
  --btn-bg: var(--surface); --btn-fg: var(--text); --btn-bd: var(--border-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 14px;
  border: 1px solid var(--btn-bd); border-radius: 10px;
  background: var(--btn-bg); color: var(--btn-fg);
  font-weight: 560; font-size: 13.5px; white-space: nowrap;
  box-shadow: var(--shadow-xs);
  transition: background-color .15s, border-color .15s, box-shadow .15s, color .15s;
  user-select: none;
}
.btn:hover { --btn-bg: var(--surface-2); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary {
  --btn-bg: var(--brand); --btn-fg: var(--on-brand); --btn-bd: transparent;
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .14), rgba(255, 255, 255, 0));
  box-shadow: 0 1px 2px rgba(43, 43, 43, .12), 0 6px 16px -6px var(--brand-ring), inset 0 1px 0 rgba(255, 255, 255, .2);
}
.btn-primary:hover { --btn-bg: var(--brand-strong); }
.btn-ghost { --btn-bg: transparent; --btn-bd: transparent; box-shadow: none; color: var(--text-2); }
.btn-ghost:hover { --btn-bg: var(--surface-2); color: var(--text); }
.btn-icon { width: 38px; padding: 0; }
.btn-sm { height: 32px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn-lg { height: 44px; padding: 0 18px; font-size: 14.5px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn .spinner { display: none; }
.btn.is-loading .spinner { display: block; animation: spin .8s linear infinite; }
.btn.is-loading .btn-label-icon { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- Avatar ---- */
.avatar {
  width: 34px; height: 34px; flex: none; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 12.5px; font-weight: 650; color: #fff; letter-spacing: .02em;
  background: linear-gradient(135deg, var(--brand), color-mix(in oklab, var(--brand) 40%, #7c3aed));
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--border-strong);
}
.user-btn {
  display: flex; align-items: center; gap: 10px;
  height: 44px; padding: 0 8px 0 5px;
  border: 1px solid transparent; border-radius: 12px; background: transparent;
  transition: background-color .15s, border-color .15s;
}
.user-btn:hover, .user-btn[aria-expanded="true"] { background: var(--surface-2); border-color: var(--border); }
.user-btn-text { text-align: left; line-height: 1.2; }
.user-btn-text strong { display: block; font-size: 13px; font-weight: 600; }
.user-btn-text span { font-size: 11.5px; color: var(--muted); }

/* ------------------------------------------------------- Menu a tendina ---- */
.dropdown { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 70;
  min-width: 260px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  transform-origin: top right;
}
.menu[hidden] { display: none; }
.menu-header { display: flex; align-items: center; gap: 12px; padding: 10px 10px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.menu-header strong { display: block; font-size: 13.5px; }
.menu-header span { font-size: 12px; color: var(--muted); }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--text-2); font-size: 13.5px; text-align: left;
}
.menu-item .icon { color: var(--muted); }
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-2); color: var(--text); outline: none; }
.menu-item.is-danger { color: var(--danger); }
.menu-item.is-danger .icon { color: var(--danger); }
.menu-sep { height: 1px; background: var(--border); margin: 6px 4px; }
.menu-label { font-size: 11.5px; font-weight: 600; color: var(--faint); padding: 8px 10px 6px; }

.segmented {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px;
  padding: 3px; margin: 0 6px 6px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
}
.segmented button {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  height: 30px; border: 0; border-radius: 7px; background: transparent;
  color: var(--muted); font-size: 12.5px; font-weight: 550;
  transition: background-color .15s, color .15s, box-shadow .15s;
}
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ------------------------------------------------------------- Pagina ---- */
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-title { display: flex; align-items: center; gap: 14px; }
.page-icon {
  width: 44px; height: 44px; display: grid; place-items: center; flex: none;
  border-radius: 13px; background: var(--brand-soft); color: var(--brand);
  border: 1px solid color-mix(in oklab, var(--brand) 20%, transparent);
}
.page-sub { color: var(--muted); margin-top: 4px; font-size: 13.5px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-head p { color: var(--muted); font-size: 13px; }

.grid { display: grid; gap: 16px; }
.grid-stats { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-2 { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }

/* Card statistica */
.stat { position: relative; padding: 18px 20px; overflow: hidden; transition: transform .2s var(--ease), box-shadow .2s; }
.stat:hover { box-shadow: var(--shadow-md); }
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stat-label { font-size: 13px; color: var(--muted); font-weight: 520; }
.stat-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--tone-soft, var(--brand-soft)); color: var(--tone, var(--brand)); }
.stat-value { font-size: 30px; font-weight: 680; letter-spacing: -0.03em; margin-top: 10px; line-height: 1.1; }
.stat-meta { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.stat::after {
  content: ""; position: absolute; right: -40px; bottom: -60px; width: 160px; height: 160px; border-radius: 50%;
  background: radial-gradient(closest-side, var(--tone-soft, var(--brand-soft)), transparent); pointer-events: none;
}
.tone-sala { --tone: var(--cat-sala); --tone-soft: color-mix(in oklab, var(--cat-sala) 14%, transparent); }
.tone-corsi { --tone: var(--cat-corsi); --tone-soft: color-mix(in oklab, var(--cat-corsi) 14%, transparent); }
.tone-discipline { --tone: var(--cat-discipline); --tone-soft: color-mix(in oklab, var(--cat-discipline) 14%, transparent); }
.tone-personal { --tone: var(--cat-personal); --tone-soft: color-mix(in oklab, var(--cat-personal) 16%, transparent); }
.tone-warning { --tone: var(--warning); --tone-soft: color-mix(in oklab, var(--warning) 14%, transparent); }
.tone-danger { --tone: var(--danger); --tone-soft: color-mix(in oklab, var(--danger) 13%, transparent); }
.tone-success { --tone: var(--success); --tone-soft: color-mix(in oklab, var(--success) 13%, transparent); }

/* Badge */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 9px; border-radius: 999px;
  font-size: 12px; font-weight: 580; white-space: nowrap;
  color: var(--tone, var(--text-2));
  background: var(--tone-soft, var(--surface-2));
  border: 1px solid color-mix(in oklab, var(--tone, var(--text-2)) 18%, transparent);
}
.badge-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* Tabella semplice */
.table { width: 100%; border-collapse: collapse; }
.table th { font-size: 12px; font-weight: 600; color: var(--muted); text-align: left; padding: 10px 20px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.table td { padding: 12px 20px; border-bottom: 1px solid var(--border); font-size: 13.5px; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background-color .12s; }
.table tbody tr:hover { background: var(--surface-2); }
.cell-person { display: flex; align-items: center; gap: 10px; }
.cell-person small { display: block; color: var(--muted); font-size: 12px; }
.mono { font-family: var(--font-mono); font-size: 12.5px; }
.table-wrap { overflow-x: auto; }

/* Liste */
.list { list-style: none; margin: 0; padding: 6px; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: var(--radius-sm); }
.list-item:hover { background: var(--surface-2); }
.list-item .grow { flex: 1; min-width: 0; }
.list-item small { color: var(--muted); display: block; font-size: 12px; }

/* Barre per categoria */
.bar { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: inherit; background: var(--tone, var(--brand)); transform-origin: left; }

/* Empty state / in costruzione */
.empty {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 56px 24px; gap: 14px;
}
.empty-art { width: 200px; height: auto; margin-bottom: 4px; }
.empty h2 { font-size: 19px; }
.empty p { color: var(--muted); max-width: 520px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: 999px; font-size: 12.5px; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); }

/* -------------------------------------------------------------- Toast ---- */
.toasts {
  position: fixed; right: 20px; bottom: 20px; z-index: 120;
  display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 40px));
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 14px 14px 16px;
  background: var(--glass); backdrop-filter: blur(16px) saturate(160%); -webkit-backdrop-filter: blur(16px) saturate(160%);
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.toast .icon { color: var(--tone, var(--info)); margin-top: 1px; }
.toast-body { flex: 1; min-width: 0; }
.toast-body strong { display: block; font-size: 13.5px; font-weight: 620; }
.toast-body p { font-size: 13px; color: var(--muted); margin-top: 2px; }
.toast-close { border: 0; background: transparent; color: var(--faint); padding: 2px; border-radius: 6px; }
.toast-close:hover { color: var(--text); background: var(--surface-2); }

/* ---------------------------------------------------- Command palette ---- */
.cmdk-overlay {
  position: fixed; inset: 0; z-index: 110;
  background: rgba(20, 20, 20, 0.42);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 12vh 16px 16px;
}
.cmdk-overlay[hidden] { display: none; }
.cmdk {
  width: min(640px, 100%);
  background: var(--glass); backdrop-filter: blur(24px) saturate(170%); -webkit-backdrop-filter: blur(24px) saturate(170%);
  border: 1px solid var(--border-strong); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg); overflow: hidden;
}
.cmdk-input-wrap { display: flex; align-items: center; gap: 12px; padding: 0 18px; border-bottom: 1px solid var(--border); }
.cmdk-input-wrap .icon { color: var(--muted); }
.cmdk-input { flex: 1; height: 58px; border: 0; background: transparent; font-size: 16px; }
.cmdk-input::placeholder { color: var(--faint); }
.cmdk-results { max-height: min(420px, 55vh); overflow-y: auto; padding: 8px; }
.cmdk-group { font-size: 11.5px; font-weight: 600; color: var(--faint); padding: 10px 10px 6px; text-transform: uppercase; letter-spacing: .05em; }
.cmdk-item {
  display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 10px; color: var(--text-2);
  cursor: pointer;
}
.cmdk-item[aria-selected="true"] { background: var(--brand-soft); color: var(--text); }
.cmdk-item-icon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); flex: none; }
.cmdk-item[aria-selected="true"] .cmdk-item-icon { color: var(--brand); border-color: color-mix(in oklab, var(--brand) 30%, transparent); }
.cmdk-item-text { flex: 1; min-width: 0; }
.cmdk-item-text strong { display: block; font-size: 13.5px; font-weight: 560; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmdk-item-text span { font-size: 12px; color: var(--muted); }
.cmdk-enter { opacity: 0; color: var(--muted); }
.cmdk-item[aria-selected="true"] .cmdk-enter { opacity: 1; }
.cmdk-empty { padding: 32px; text-align: center; color: var(--muted); }
.cmdk-foot { display: flex; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); }
.cmdk-foot span { display: inline-flex; align-items: center; gap: 6px; }

/* ------------------------------------------------------------- Form ---- */
.field { display: flex; flex-direction: column; gap: 6px; }
.label { font-size: 13px; font-weight: 560; color: var(--text-2); display: flex; justify-content: space-between; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap > .icon { position: absolute; left: 13px; color: var(--faint); pointer-events: none; transition: color .15s; }
.input {
  width: 100%; height: 44px; padding: 0 14px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 11px;
  font-size: 14px; color: var(--text);
  box-shadow: var(--shadow-xs);
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.input-wrap > .icon + .input { padding-left: 40px; }
.input::placeholder { color: var(--faint); }
.input:hover { border-color: color-mix(in oklab, var(--text) 22%, transparent); }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-ring); }
.input-wrap:focus-within > .icon { color: var(--brand); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.input[aria-invalid="true"]:focus { box-shadow: 0 0 0 4px color-mix(in oklab, var(--danger) 25%, transparent); }
.input-action { position: absolute; right: 6px; height: 32px; width: 32px; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: var(--muted); }
.input-action:hover { background: var(--surface-2); color: var(--text); }
.field-error { font-size: 12.5px; color: var(--danger); min-height: 0; }

.alert {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border-radius: var(--radius);
  font-size: 13.5px;
  color: var(--tone, var(--info));
  background: var(--tone-soft, color-mix(in oklab, var(--info) 10%, transparent));
  border: 1px solid color-mix(in oklab, var(--tone, var(--info)) 25%, transparent);
}
.alert p { color: var(--text); }

/* ------------------------------------------------------------- Login ---- */
.auth { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(420px, 1fr); min-height: 100vh; }
.auth-visual {
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 40px 48px;
  color: #fff;
  background:
    radial-gradient(900px 500px at 15% 0%, color-mix(in oklab, var(--brand) 55%, #fff 0%), transparent 60%),
    linear-gradient(160deg, color-mix(in oklab, var(--brand) 92%, #1f1f1f) 0%, color-mix(in oklab, var(--brand) 45%, #161616) 55%, #0e0e0e 100%);
}
.auth-brand { display: flex; align-items: center; gap: 12px; font-weight: 650; }
.auth-brand .brand-mark { background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .28); box-shadow: none; backdrop-filter: blur(8px); }
.auth-claim { max-width: 520px; }
.auth-claim h2 { color: #fff; font-size: clamp(28px, 3.2vw, 40px); font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; }
.auth-claim p { color: rgba(255, 255, 255, .78); font-size: 15px; margin-top: 14px; max-width: 440px; }
.auth-features { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.auth-features span {
  display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px;
  border-radius: 999px; font-size: 12.5px; font-weight: 550;
  background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .2);
  backdrop-filter: blur(10px);
}
.auth-foot { font-size: 12.5px; color: rgba(255, 255, 255, .6); }

.auth-panel { display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 40px 24px; position: relative; }
.auth-card { width: min(400px, 100%); }
.auth-logo { width: 56px; height: 56px; border-radius: 16px; font-size: 18px; margin-bottom: 22px; }
.auth-card h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.025em; }
.auth-card .page-sub { margin: 6px 0 26px; }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-help { margin-top: 22px; font-size: 12.5px; color: var(--muted); text-align: center; }
.auth-theme { position: absolute; top: 20px; right: 20px; }
.auth-secure { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 28px; font-size: 12px; color: var(--faint); }

/* -------------------------------------------------------- Pagine errore ---- */
.error-page { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; }
.error-box { text-align: center; max-width: 520px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.error-code {
  font-size: 92px; font-weight: 800; letter-spacing: -0.06em; line-height: 1;
  background: linear-gradient(180deg, var(--brand), color-mix(in oklab, var(--brand) 30%, var(--text)));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.error-box p { color: var(--muted); }
.error-debug { width: 100%; text-align: left; font: 12px/1.5 var(--font-mono); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; overflow: auto; max-height: 320px; white-space: pre-wrap; }

/* ----------------------------------------------------------- Motion ---- */
/* Prima che GSAP sia pronto il contenuto parte invisibile; se lo script non
   si carica, un'animazione CSS di sicurezza lo rende visibile comunque. */
html.motion-ok:not(.js-ready) [data-page] { opacity: 0; animation: reveal-fallback 0s 1.2s forwards; }
@keyframes reveal-fallback { to { opacity: 1; } }

.press { transition: transform .12s var(--ease); }
.press:active { transform: scale(.97); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ------------------------------------------------------- Responsive ---- */
@media (max-width: 1180px) {
  .grid-2 { grid-template-columns: 1fr; }
  .search-trigger { width: 220px; }
  .user-btn-text { display: none; }
}

@media (max-width: 1023px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: 288px;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
    transition: transform .3s var(--ease);
  }
  html.sb-aperta .sidebar { transform: none; }
  .sb-backdrop {
    display: block; position: fixed; inset: 0; z-index: 35;
    background: rgba(20, 20, 20, .45); opacity: 0; visibility: hidden; transition: opacity .25s, visibility .25s;
  }
  html.sb-aperta .sb-backdrop { opacity: 1; visibility: visible; }
  .sb-collapse-btn { display: none; }
  .topbar .topbar-menu { display: inline-flex; }
  .content { padding: 22px 20px 48px; }
  .auth { grid-template-columns: 1fr; }
  .auth-visual { min-height: 220px; padding: 28px 24px; }
  .auth-claim h2 { font-size: 26px; }
  .auth-claim p, .auth-features { display: none; }
}

@media (max-width: 640px) {
  .topbar { padding: 0 12px; gap: 6px; }
  .breadcrumb { display: none; }
  .search-trigger { width: 38px; padding: 0; justify-content: center; }
  .search-trigger span, .search-trigger .kbd { display: none; }
  .btn-new-label { display: none; }
  .content { padding: 18px 16px 40px; }
  h1 { font-size: 21px; }
  .stat-value { font-size: 26px; }
  .page-header { align-items: flex-start; }
  .table th, .table td { padding: 10px 14px; }
  .hide-sm { display: none; }
}

/* =============================================================================
   Fase 3 — Form multi-step, upload, dettaglio scheda, modali
   ============================================================================= */

.muted { color: var(--muted); }
.icon-flip { transform: scaleX(-1); }
.is-upper { text-transform: uppercase; }
.is-upper::placeholder { text-transform: none; }
.btn.is-danger { color: var(--danger); }
.btn.is-danger:hover { --btn-bg: color-mix(in oklab, var(--danger) 10%, transparent); }
.req { color: var(--danger); font-weight: 600; }
.field-help { font-size: 12px; color: var(--muted); }
.field.has-error .label { color: var(--danger); }
.field-warning { font-size: 12.5px; color: var(--warning); }

/* Griglia a 12 colonne */
.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px 16px; }
.form-grid > * { grid-column: span 12; }
.col-2 { grid-column: span 2 !important; } .col-3 { grid-column: span 3 !important; } .col-4 { grid-column: span 4 !important; }
.col-5 { grid-column: span 5 !important; } .col-6 { grid-column: span 6 !important; } .col-7 { grid-column: span 7 !important; }
.col-8 { grid-column: span 8 !important; } .col-12 { grid-column: span 12 !important; }

.select {
  appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 19px, calc(100% - 13px) 19px; background-size: 5px 5px; background-repeat: no-repeat;
}
.textarea { height: auto; min-height: 92px; padding: 11px 14px; resize: vertical; line-height: 1.5; }
.input.is-readonly { display: flex; align-items: center; background: var(--surface-2); color: var(--text-2); font-weight: 600; box-shadow: none; }

/* Scelta a pulsanti (radio) */
.choice { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; min-height: 44px; }
.choice-item { flex: 1; position: relative; display: flex; }
.choice-item input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.choice-item span {
  flex: 1; display: grid; place-items: center; padding: 0 12px; border-radius: 9px;
  font-size: 13.5px; font-weight: 550; color: var(--muted); white-space: nowrap;
  transition: background-color .15s, color .15s, box-shadow .15s;
}
.choice-item input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.choice-item input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 1px; }

/* Interruttore */
.switch-row { display: flex; align-items: flex-start; gap: 14px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); cursor: pointer; transition: border-color .15s, background-color .15s; }
.switch-row:hover { border-color: var(--border-strong); }
.switch-row input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch { position: relative; flex: none; width: 40px; height: 24px; border-radius: 999px; background: var(--surface-3); transition: background-color .2s; margin-top: 1px; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(43, 43, 43, .25); transition: transform .25s var(--ease); }
.switch-row input:checked + .switch { background: var(--brand); }
.switch-row input:checked + .switch::after { transform: translateX(16px); }
.switch-row input:focus-visible + .switch { outline: 2px solid var(--brand); outline-offset: 2px; }
.switch-text strong { display: block; font-size: 13.5px; font-weight: 600; }
.switch-text span { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.field.has-error .switch-row { border-color: var(--danger); }

/* Checklist */
.checklist { display: grid; gap: 8px; }
.check-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); cursor: pointer; font-size: 13.5px; transition: border-color .15s, background-color .15s; }
.check-item:hover { border-color: var(--border-strong); }
.check-item input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.check-item em { color: var(--muted); font-style: normal; }
.check-box { flex: none; width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--border-strong); display: grid; place-items: center; color: transparent; background: var(--surface); transition: background-color .15s, border-color .15s, color .15s; }
.check-item input:checked ~ .check-box, .doc-check.is-done .check-box { background: var(--brand); border-color: var(--brand); color: #fff; }
.check-item input:checked ~ span:last-child { color: var(--text); }
.check-item:has(input:checked) { border-color: color-mix(in oklab, var(--brand) 35%, transparent); background: var(--brand-soft); }
.check-item input:focus-visible ~ .check-box { outline: 2px solid var(--brand); outline-offset: 2px; }
.check-item .badge { margin-left: auto; }

/* Upload */
.upload { display: flex; flex-direction: column; gap: 6px; }
.upload-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.upload-drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center;
  min-height: 112px; padding: 18px; border: 1.5px dashed var(--border-strong); border-radius: 14px;
  background: var(--surface-2); color: var(--text-2); font-size: 13.5px; cursor: pointer;
  transition: border-color .15s, background-color .15s;
}
.upload-drop small { color: var(--muted); font-size: 12px; }
.upload-drop u { color: var(--brand); text-decoration: none; font-weight: 600; }
.upload-drop:hover, .upload.is-dragover .upload-drop { border-color: var(--brand); background: var(--brand-soft); }
.upload-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); color: var(--brand); margin-bottom: 4px; }
.upload-file { display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 12px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-xs); }
.upload-thumb { width: 44px; height: 44px; flex: none; border-radius: 10px; overflow: hidden; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.upload-thumb img { width: 100%; height: 100%; object-fit: cover; }
.upload-meta { flex: 1; min-width: 0; }
.upload-meta strong { display: block; font-size: 13.5px; font-weight: 560; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upload-meta small { color: var(--muted); font-size: 12px; }
.upload-state .icon { color: var(--success); }
.upload.is-uploading .upload-state .icon { color: var(--brand); animation: spin .8s linear infinite; }

/* Wizard */
.wizard { display: flex; flex-direction: column; gap: 18px; padding-bottom: 96px; }
.wizard-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.wizard-title h1 { margin-top: 10px; }
.autosave { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: 12.5px; color: var(--muted); box-shadow: var(--shadow-xs); }
.autosave[data-state="saving"] .icon { color: var(--brand); animation: spin .8s linear infinite; }
.autosave[data-state="saved"] .icon { color: var(--success); }
.autosave[data-state="error"] { color: var(--danger); border-color: color-mix(in oklab, var(--danger) 30%, transparent); }
.autosave[data-state="dirty"] .icon { color: var(--warning); }

.stepper { position: relative; padding: 4px 0; }
.stepper ol { position: relative; display: grid; grid-template-columns: repeat(5, 1fr); list-style: none; margin: 0; padding: 0; }
.stepper-track { position: absolute; left: 10%; right: 10%; top: 22px; height: 3px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.stepper-fill { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--brand), color-mix(in oklab, var(--brand) 60%, #8b5cf6)); transform-origin: left; transform: scaleX(0); }
.stepper-item { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; border: 0; background: transparent; padding: 0; color: var(--muted); font-size: 12.5px; font-weight: 550; }
.stepper-dot { position: relative; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 1.5px solid var(--border-strong); font-weight: 650; color: var(--muted); transition: border-color .25s, background-color .25s, color .25s, box-shadow .25s; }
.stepper-check { display: none; }
.stepper-item.is-done .stepper-dot { background: var(--brand); border-color: var(--brand); color: #fff; }
.stepper-item.is-done .stepper-num { display: none; }
.stepper-item.is-done .stepper-check { display: block; }
.stepper-item.is-current .stepper-dot { border-color: var(--brand); color: var(--brand); box-shadow: 0 0 0 5px var(--brand-soft); }
.stepper-item.is-current { color: var(--text); }
.stepper-item.has-error .stepper-dot { border-color: var(--danger); color: var(--danger); box-shadow: 0 0 0 5px color-mix(in oklab, var(--danger) 14%, transparent); }
.stepper-item.has-error .stepper-check { display: none; }
.stepper-item.has-error .stepper-num { display: block; }

.wizard-body { position: relative; }
.step { padding: 26px 28px 28px; }
.step-head { margin-bottom: 22px; }
.step-head p { color: var(--muted); margin-top: 4px; }
.step-section { margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--border); }
.step-section h3 { margin-bottom: 12px; }
.step-note { color: var(--muted); font-size: 13px; margin: -6px 0 12px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head h3 { margin: 0; }
.cf-hint { align-self: end; font-size: 12.5px; color: var(--warning); padding-bottom: 12px; }

.parent-block { padding: 18px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); }
.parent-block + .parent-block { margin-top: 14px; }
.parent-block h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.parent-block-head { display: flex; align-items: center; justify-content: space-between; }
.add-parent { margin-top: 14px; border-style: dashed; }

.quota-card { display: grid; grid-template-columns: 1.3fr 1fr 1fr; margin-top: 20px; border: 1px solid var(--border); border-radius: 16px; overflow: hidden; background: var(--surface); }
.quota-card > div { padding: 16px 20px; display: flex; flex-direction: column; gap: 2px; }
.quota-card > div + div { border-left: 1px solid var(--border); }
.quota-card span { font-size: 12.5px; color: var(--muted); }
.quota-card strong { font-size: 22px; font-weight: 680; letter-spacing: -0.02em; }
.quota-card small { font-size: 12px; color: var(--muted); }
.quota-netta { background: var(--brand-soft); }
.quota-netta strong { color: var(--brand-strong); }

.rate-table td { padding: 8px 12px; }
.rate-table th { padding: 10px 12px; }
.rate-table .input { height: 38px; font-size: 13.5px; }
.rate-table tfoot th, .rate-table tfoot td { background: var(--surface-2); font-weight: 650; padding: 12px; }
.rate-table .rate-diff { color: var(--danger); font-weight: 600; margin-left: 8px; }
.rate-state { display: flex; gap: 4px; }
.rate-state .choice { min-height: 38px; padding: 3px; }

.summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.summary-block { border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.summary-block h4 { display: flex; align-items: center; justify-content: space-between; margin: 0; padding: 10px 14px; font-size: 13px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.summary-block h4 button { border: 0; background: none; color: var(--brand); font-weight: 600; font-size: 12.5px; padding: 0; }
.summary-block dl { margin: 0; padding: 6px 14px 10px; }
.summary-block dl div { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.summary-block dl div:last-child { border-bottom: 0; }
.summary-block dt { color: var(--muted); }
.summary-block dd { margin: 0; text-align: right; font-weight: 550; }

.wizard-foot {
  position: fixed; left: var(--sb-w); right: 0; bottom: 0; z-index: 25;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 32px calc(14px + env(safe-area-inset-bottom));
  background: var(--glass); backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-top: 1px solid var(--border);
}
.wizard-step-count { font-size: 12.5px; color: var(--muted); }
.wizard-actions { margin-left: auto; display: flex; gap: 8px; }

/* Scelta modulo */
.module-grid { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.module-card { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 24px; overflow: hidden; transition: box-shadow .2s, border-color .2s, transform .2s var(--ease); }
.module-card:hover { box-shadow: var(--shadow-lg); border-color: color-mix(in oklab, var(--tone) 35%, transparent); transform: translateY(-2px); }
.module-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: var(--tone); }
.module-icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--tone-soft); color: var(--tone); }
.module-card .badge { align-self: flex-start; }
.module-card p { color: var(--muted); }
.module-price { display: flex; flex-direction: column; padding: 12px 0; border-top: 1px solid var(--border); margin-top: 4px; }
.module-price strong { font-size: 26px; font-weight: 700; letter-spacing: -0.03em; }
.module-price span { font-size: 12.5px; color: var(--muted); }
.module-rate { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 13px; }
.module-rate li { display: flex; justify-content: space-between; gap: 10px; color: var(--text-2); }
.module-rate li span:last-child { color: var(--muted); text-align: right; }
.module-cta { margin-top: auto; padding-top: 10px; display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--tone); }

/* Dettaglio scheda */
.detail-hero { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 22px 24px; flex-wrap: wrap; }
.detail-person { display: flex; align-items: center; gap: 18px; min-width: 0; }
.detail-photo { width: 76px; height: 76px; border-radius: 20px; object-fit: cover; flex: none; box-shadow: var(--shadow-md); }
.detail-initials { display: grid; place-items: center; font-size: 24px; font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--tone), color-mix(in oklab, var(--tone) 55%, #1f1f1f)); }
.detail-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); gap: 16px; margin-top: 16px; align-items: start; }
.detail-main, .detail-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.stat-value-sm { margin-top: 12px; }
.tone-muted { --tone: var(--muted); --tone-soft: var(--surface-2); }
.dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; margin: 0; padding: 4px 20px 12px; }
.dl > div { padding: 10px 0; border-bottom: 1px solid var(--border); }
.dl > div:nth-last-child(-n+2) { border-bottom: 0; }
.dl dt { font-size: 12px; color: var(--muted); }
.dl dd { margin: 2px 0 0; font-size: 13.5px; font-weight: 520; word-break: break-word; }
.dl-stack { grid-template-columns: 1fr; }
.dl-stack > div:nth-last-child(-n+2) { border-bottom: 1px solid var(--border); }
.dl-stack > div:last-child { border-bottom: 0; }
.doc-check .check-box { color: transparent; }
.doc-check:not(.is-done) .grow { color: var(--muted); }
.file-list { display: grid; gap: 8px; padding-top: 4px; }
.file-chip { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; transition: border-color .15s, background-color .15s; }
.file-chip:hover { border-color: var(--border-strong); background: var(--surface-2); }
.file-chip .icon { color: var(--brand); }
.file-chip strong { display: block; font-size: 13px; }
.file-chip small { display: block; font-size: 12px; color: var(--muted); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timeline { list-style: none; margin: 0; padding: 12px 20px 16px; position: relative; }
.timeline li { position: relative; padding: 0 0 14px 20px; font-size: 13px; }
.timeline li::before { content: ""; position: absolute; left: 0; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.timeline li::after { content: ""; position: absolute; left: 3.5px; top: 18px; bottom: 0; width: 1px; background: var(--border-strong); }
.timeline li:last-child::after { display: none; }
.timeline strong { display: block; font-weight: 600; }
.timeline span { color: var(--muted); font-size: 12px; }

/* Modale di conferma */
.modal-overlay { position: fixed; inset: 0; z-index: 130; display: grid; place-items: center; padding: 16px; background: rgba(20, 20, 20, .45); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.modal { width: min(440px, 100%); padding: 24px; background: var(--glass); backdrop-filter: blur(24px) saturate(170%); -webkit-backdrop-filter: blur(24px) saturate(170%); border: 1px solid var(--border-strong); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); }
.modal-icon { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; margin-bottom: 14px; background: var(--tone-soft, var(--brand-soft)); color: var(--tone, var(--brand)); }
.modal h2 { font-size: 18px; }
.modal p { color: var(--muted); margin-top: 6px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.btn-danger { --btn-bg: var(--danger); --btn-fg: #fff; --btn-bd: transparent; }
.btn-danger:hover { --btn-bg: color-mix(in oklab, var(--danger) 85%, #000); }

@media (max-width: 1180px) {
  .detail-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1023px) {
  .wizard-foot { left: 0; padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); }
  .stepper-label { display: none; }
}
@media (max-width: 760px) {
  .form-grid > [class*="col-"] { grid-column: span 12 !important; }
  .form-grid > .col-2, .form-grid > .col-3, .form-grid > .col-4 { grid-column: span 6 !important; }
  .step { padding: 20px 16px; }
  .summary, .upload-grid, .dl { grid-template-columns: 1fr; }
  .dl > div:nth-last-child(2) { border-bottom: 1px solid var(--border); }
  .quota-card { grid-template-columns: 1fr; }
  .quota-card > div + div { border-left: 0; border-top: 1px solid var(--border); }
  .wizard-step-count { display: none; }
  .wizard-foot .btn { padding: 0 12px; }
  .stepper-dot { width: 34px; height: 34px; }
  .stepper-track { top: 19px; }
}

/* =============================================================================
   Fase 4 — Archivio schede, drawer filtri, skeleton, grafico dashboard
   ============================================================================= */

.avatar-sm { width: 32px; height: 32px; font-size: 11.5px; box-shadow: none; }
.avatar-lg { width: 52px; height: 52px; font-size: 16px; border-radius: 16px; }
.avatar.tone-sala, .avatar.tone-corsi, .avatar.tone-discipline, .avatar.tone-personal { background: linear-gradient(135deg, var(--tone), color-mix(in oklab, var(--tone) 60%, #1f1f1f)); }
.avatar-img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; display: block; }
.avatar-img.avatar-lg { width: 52px; height: 52px; border-radius: 16px; }
.badge-inline { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; color: var(--tone, var(--muted)); }
.input-sm { height: 32px; font-size: 13px; border-radius: 8px; padding: 0 30px 0 10px; background-position: calc(100% - 15px) 14px, calc(100% - 10px) 14px; }

a.stat-link { display: block; color: inherit; }
a.stat-link:hover { border-color: color-mix(in oklab, var(--tone, var(--brand)) 35%, transparent); transform: translateY(-2px); }

/* Toolbar */
.archive { display: flex; flex-direction: column; gap: 14px; }
.archive-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px; flex-wrap: wrap; }
.archive-tools { display: flex; align-items: center; gap: 8px; flex: 1; justify-content: flex-end; min-width: 280px; }
.archive-search { flex: 1; max-width: 420px; }
.archive-search .input { height: 40px; }

.segmented-lg { margin: 0; padding: 4px; grid-auto-columns: auto; }
.segmented-lg button { height: 34px; padding: 0 14px; font-size: 13.5px; gap: 8px; }
.segmented-lg .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--tone); }
.segmented-lg .count { font-size: 12px; font-weight: 600; color: var(--muted); background: var(--surface-3); border-radius: 999px; padding: 1px 7px; min-width: 22px; text-align: center; }
.segmented-lg button[aria-pressed="true"] .count { background: var(--brand-soft); color: var(--brand-strong); }
.segmented-icons { margin: 0; padding: 3px; }
.segmented-icons button { width: 36px; height: 32px; }
.count-badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--brand); color: #fff; font-size: 11.5px; font-weight: 700; }

/* Barra selezione */
.selection-bar {
  position: sticky; top: calc(var(--topbar-h) + 10px); z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 10px 12px 10px 18px; border-radius: 14px;
  background: color-mix(in oklab, var(--brand) 92%, #1f1f1f); color: #fff;
  box-shadow: 0 12px 30px -10px var(--brand-ring);
}
.selection-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.selection-bar .btn { --btn-bg: rgba(255, 255, 255, .14); --btn-fg: #fff; --btn-bd: rgba(255, 255, 255, .22); box-shadow: none; }
.selection-bar .btn:hover { --btn-bg: rgba(255, 255, 255, .24); }

/* Risultati */
.archive-results { position: relative; overflow: hidden; }
.archive-results.is-loading [data-pannello] { opacity: .45; transition: opacity .2s; }
.archive-table th { white-space: nowrap; }
.archive-table td { padding-top: 10px; padding-bottom: 10px; }
.archive-table tbody tr { cursor: pointer; }
.archive-table tbody tr.is-selected, .scheda-card.is-selected { background: var(--brand-soft); }
.cell-check { width: 44px; padding-right: 0 !important; }
.cell-photo { width: 48px; padding-right: 0 !important; }
.cell-name { font-weight: 600; color: var(--text); display: block; }
.cell-name:hover { color: var(--brand-strong); }
.cell-stack { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.cell-stack small { font-size: 11.5px; color: var(--muted); }
.cell-actions { display: inline-flex; gap: 2px; white-space: nowrap; }
.archive-table .cell-actions { opacity: .55; transition: opacity .15s; }
.archive-table tr:hover .cell-actions, .archive-table tr:focus-within .cell-actions { opacity: 1; }
.th-sort { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; padding: 0; font: inherit; color: inherit; }
.th-sort .icon { opacity: 0; transition: opacity .15s, transform .2s var(--ease); }
.th-sort:hover .icon { opacity: .5; }
.th-sort.is-active { color: var(--text); }
.th-sort.is-active .icon { opacity: 1; color: var(--brand); }
.th-sort.is-asc .icon { transform: rotate(180deg); }

.mini-check { position: relative; display: inline-flex; cursor: pointer; }
.mini-check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.mini-check input:checked + .check-box { background: var(--brand); border-color: var(--brand); color: #fff; }
.mini-check input:indeterminate + .check-box { background: var(--brand); border-color: var(--brand); }
.mini-check input:indeterminate + .check-box::after { content: ""; width: 8px; height: 2px; border-radius: 2px; background: #fff; position: absolute; }
.mini-check input:indeterminate + .check-box .icon { display: none; }
.mini-check input:focus-visible + .check-box { outline: 2px solid var(--brand); outline-offset: 2px; }

/* Card */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; padding: 16px; }
.scheda-card { position: relative; display: flex; flex-direction: column; gap: 14px; padding: 16px; cursor: pointer; overflow: hidden; box-shadow: var(--shadow-xs); transition: box-shadow .2s, transform .2s var(--ease), border-color .2s; }
.scheda-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: var(--tone); }
.scheda-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.scheda-card-top { display: flex; align-items: center; justify-content: space-between; }
.scheda-card-person { display: flex; align-items: center; gap: 12px; }
.scheda-card-person > div { flex: 1; min-width: 0; }
.scheda-card-person small { display: block; font-size: 12px; }
.scheda-card-stati { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0; padding: 12px 0; border-top: 1px dashed var(--border); border-bottom: 1px dashed var(--border); }
.scheda-card-stati dt { font-size: 11.5px; color: var(--muted); margin-bottom: 4px; }
.scheda-card-stati dd { margin: 0; }
.scheda-card-foot { display: flex; align-items: center; justify-content: space-between; font-size: 12px; }

/* Skeleton */
.skeleton { position: absolute; inset: 52px 0 0; z-index: 2; padding: 6px 20px; background: color-mix(in oklab, var(--surface) 70%, transparent); }
.skeleton-row { display: grid; grid-template-columns: 24px 110px 1.4fr 1fr 1fr; gap: 20px; align-items: center; height: 56px; border-bottom: 1px solid var(--border); }
.skeleton-row span { height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
.skeleton-row span:first-child { width: 18px; height: 18px; border-radius: 5px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Piè di pagina e paginazione */
.archive-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.pager-info { display: flex; align-items: center; gap: 18px; font-size: 13px; color: var(--muted); }
.pager-per { display: inline-flex; align-items: center; gap: 8px; }
.pager-per .input { width: 74px; }
.pager { display: flex; align-items: center; gap: 4px; }
.pager .btn { min-width: 32px; padding: 0 8px; }
.pager .btn.is-current { --btn-bg: var(--brand); --btn-fg: #fff; --btn-bd: transparent; }
.pager-gap { color: var(--faint); padding: 0 2px; }

/* Drawer */
.drawer-overlay { position: fixed; inset: 0; z-index: 90; background: rgba(20, 20, 20, .4); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 95; width: min(420px, 100vw);
  background: var(--glass); backdrop-filter: blur(24px) saturate(170%); -webkit-backdrop-filter: blur(24px) saturate(170%);
  border-left: 1px solid var(--border-strong); box-shadow: var(--shadow-lg);
}
.drawer-form { display: flex; flex-direction: column; height: 100%; }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 22px 16px; border-bottom: 1px solid var(--border); }
.drawer-head p { font-size: 13px; margin-top: 2px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 22px; display: flex; flex-direction: column; gap: 20px; }
.drawer-foot { display: flex; justify-content: space-between; gap: 8px; padding: 14px 22px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); }
.filter-group { border: 0; margin: 0; padding: 0; display: grid; gap: 6px; }
.filter-group legend { margin-bottom: 8px; }
.check-compact { padding: 9px 12px; }
.range { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* Dashboard e grafico */
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, 1fr); gap: 16px; margin-top: 16px; align-items: start; }
.dashboard-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.list a.list-item { color: inherit; }
.list .list-item strong { font-size: 13.5px; font-weight: 600; }
.chart-card { min-width: 0; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; list-style: none; margin: 0; padding: 14px 20px 0; font-size: 13px; color: var(--text-2); }
.chart-legend li { display: inline-flex; align-items: center; gap: 8px; }
.chart-legend strong { color: var(--text); }
.swatch { width: 10px; height: 10px; border-radius: 3px; background: var(--tone); display: inline-block; flex: none; }
.chart-wrap { position: relative; padding: 8px 14px 6px 6px; }
.chart-wrap svg { width: 100%; height: auto; overflow: visible; }
.chart-grid line { stroke: var(--border); stroke-width: 1; }
.chart-grid line.baseline { stroke: var(--border-strong); }
.chart-grid text, .chart-x { fill: var(--muted); font-size: 11px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.seg { fill: var(--tone); }
.chart-hit { fill: transparent; cursor: pointer; outline: none; }
.chart-hit.is-hover, .chart-hit:focus-visible { fill: color-mix(in oklab, var(--text) 5%, transparent); }
.chart-tooltip {
  position: absolute; left: 0; top: 0; z-index: 5; min-width: 180px; pointer-events: none;
  display: flex; flex-direction: column; gap: 4px; padding: 10px 12px;
  background: var(--glass); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: var(--shadow-md); font-size: 12.5px;
}
.chart-tooltip strong { font-size: 13px; margin-bottom: 2px; }
.chart-tooltip span { display: flex; align-items: center; gap: 8px; color: var(--text-2); }
.chart-tooltip b { margin-left: auto; color: var(--text); font-weight: 650; }
.chart-tooltip .swatch { width: 8px; height: 8px; }
.chart-tooltip-total { border-top: 1px solid var(--border); padding-top: 4px; margin-top: 2px; font-weight: 600; }

@media (max-width: 1180px) {
  .dashboard-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .archive-tools { min-width: 0; width: 100%; }
  .segmented-lg { width: 100%; overflow-x: auto; }
  .segmented-lg button { padding: 0 10px; }
  .archive-table .hide-sm, .archive-table:not(.registry-table) td:nth-child(3), .archive-table:not(.registry-table) th:nth-child(3) { display: none; }
  .pager-info { gap: 10px; flex-wrap: wrap; }
}

.archive-table th, .archive-table td { padding-left: 12px; padding-right: 12px; }
.archive-table .mono, .archive-table .num { white-space: nowrap; }
.archive-table:not(.registry-table) td:nth-child(4) { min-width: 180px; }
@media (max-width: 1440px) {
  .archive-table:not(.registry-table) th:nth-child(9), .archive-table:not(.registry-table) td:nth-child(9) { display: none; }
}

@media (max-width: 760px) {
  .chart-grid text, .chart-x { font-size: 17px; }
  .chart-tooltip { min-width: 160px; font-size: 12px; }
}

/* =============================================================================
   Fase 5 — Anagrafiche generiche, editor schemi, import, calendario
   ============================================================================= */

.toolbar-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.filter-select { width: auto; min-width: 150px; max-width: 220px; }
.filter-range { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.filter-range .input { width: 112px; padding-right: 10px; }
.registry-table .cell-main { min-width: 200px; }
.registry-table tbody tr[data-modifica] { cursor: pointer; }
.cell-person { display: flex; align-items: center; gap: 10px; }
.cell-person small { display: block; font-size: 11.5px; }
.color-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; vertical-align: 0; box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--border-strong); }
.count-link { font-weight: 650; color: var(--brand-strong); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: color-mix(in oklab, var(--brand) 40%, transparent); }
tr.is-flash td { animation: flash-row 1.6s var(--ease); }
@keyframes flash-row { 0%, 30% { background: var(--brand-soft); } 100% { background: transparent; } }
.btn.is-active { --btn-bg: var(--brand-soft); --btn-fg: var(--brand-strong); --btn-bd: color-mix(in oklab, var(--brand) 35%, transparent); }

.drawer-wide { width: min(560px, 100vw); }
.drawer-section { border: 0; margin: 0; padding: 0; }
.drawer-section + .drawer-section { padding-top: 20px; border-top: 1px solid var(--border); }
.drawer-section legend { font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 12px; }
.drawer .form-grid { gap: 14px 12px; }
.color-field { display: flex; gap: 8px; }
.color-swatch { width: 44px; height: 44px; padding: 3px; border: 1px solid var(--border-strong); border-radius: 11px; background: var(--surface); cursor: pointer; }
.color-swatch::-webkit-color-swatch-wrapper { padding: 0; }
.color-swatch::-webkit-color-swatch { border: 0; border-radius: 8px; }
.input-wrap.has-suffix .input { padding-right: 34px; }
.input-suffix { position: absolute; right: 14px; color: var(--muted); font-size: 13px; pointer-events: none; }
.input[type="time"] { padding-right: 10px; }

/* Editor schemi */
.pitch-editor { display: flex; flex-direction: column; gap: 10px; }
.pitch { width: 100%; max-width: 320px; margin: 0 auto; display: block; touch-action: none; user-select: none; }
.pitch-grass { fill: #15803d; }
:root[data-theme="dark"] .pitch-grass { fill: #14532d; }
.pitch .pitch-lines { stroke: rgba(255, 255, 255, .7); stroke-width: .5; }
.player { cursor: grab; outline: none; }
.player circle { fill: #fff; stroke: var(--brand-strong); stroke-width: .9; transition: r .15s; }
.player.is-keeper circle { fill: #facc15; stroke: #854d0e; }
.player text { font: 700 3.6px var(--font); fill: #1f1f1f; pointer-events: none; }
.player.is-dragging { cursor: grabbing; }
.player.is-dragging circle, .player:focus-visible circle { r: 5.6; stroke-width: 1.2; }
.pitch-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

/* Import */
.import { display: flex; flex-direction: column; gap: 16px; }
.import-steps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.import-step { display: flex; gap: 16px; padding: 22px; }
.import-num { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--brand-soft); color: var(--brand-strong); }
.import-step-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.import-step-body .upload { width: 100%; }
.import-loading { display: flex; align-items: center; gap: 10px; padding: 26px; justify-content: center; border: 1.5px dashed var(--brand); border-radius: 14px; background: var(--brand-soft); color: var(--brand-strong); font-weight: 550; }
.spin { animation: spin .8s linear infinite; }
.import-totals { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-bottom: 1px solid var(--border); }
.import-totals > div { padding: 14px 20px; display: flex; flex-direction: column; gap: 2px; color: var(--tone, var(--text)); }
.import-totals > div + div { border-left: 1px solid var(--border); }
.import-totals span { font-size: 12.5px; color: var(--muted); }
.import-totals strong { font-size: 22px; font-weight: 700; }
.tone-info { --tone: var(--info); }
.import-table-wrap { max-height: 420px; overflow-y: auto; }
.import-table thead th { position: sticky; top: 0; z-index: 1; }
.import-table td:first-child { width: 70px; }
.import-table td:nth-child(2) { width: 120px; }
.import-table tr.has-error td { background: color-mix(in oklab, var(--danger) 5%, transparent); }
.import-errors { margin: 0; padding-left: 18px; color: var(--danger); font-size: 12.5px; display: grid; gap: 2px; }
.import-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); }
.switch-compact { padding: 8px 12px; align-items: center; }
.result-icon { width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; background: color-mix(in oklab, var(--success) 14%, transparent); color: var(--success); }
.import-result-errors { width: 100%; max-width: 640px; text-align: left; }
.import-result-errors summary { cursor: pointer; font-weight: 600; margin-bottom: 8px; }

/* Calendario */
.calendar { display: flex; flex-direction: column; gap: 14px; }
.calendar-nav { display: flex; align-items: center; gap: 8px; }
.calendar-title { font-size: 17px; margin-left: 8px; }
.calendar-legend { display: flex; gap: 18px; font-size: 12.5px; color: var(--muted); }
.calendar-legend span { display: inline-flex; align-items: center; gap: 6px; }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; align-items: start; }
.day { padding: 10px; min-height: 220px; display: flex; flex-direction: column; gap: 8px; }
.day.is-today { border-color: color-mix(in oklab, var(--brand) 45%, transparent); box-shadow: 0 0 0 3px var(--brand-soft); }
.day-head { display: flex; align-items: baseline; justify-content: space-between; padding: 2px 4px 6px; border-bottom: 1px solid var(--border); }
.day-name { font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.day-num { font-size: 20px; font-weight: 700; }
.day.is-today .day-num { color: var(--brand); }
.day-events { display: flex; flex-direction: column; gap: 6px; }
.day-empty { font-size: 12px; color: var(--faint); text-align: center; padding: 18px 0; }
.event { position: relative; padding: 8px 9px 8px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12px; display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.event::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--tone, var(--brand)); }
.event strong { font-size: 12.5px; font-weight: 620; line-height: 1.3; }
.event small { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 11.5px; }
.event-time { display: flex; align-items: center; gap: 5px; font-weight: 650; color: var(--text-2); font-size: 11.5px; }
.event-turno { background: transparent; border-style: dashed; }
.event-partita { background: color-mix(in oklab, var(--warning) 9%, var(--surface)); }
.event-allenamento { background: color-mix(in oklab, var(--tone, var(--brand)) 8%, var(--surface)); }

@media (max-width: 1280px) {
  .week { grid-template-columns: repeat(7, 200px); overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x mandatory; }
  .day { scroll-snap-align: start; }
}
@media (max-width: 760px) {
  .import-steps { grid-template-columns: 1fr; }
  .import-totals { grid-template-columns: repeat(2, 1fr); }
  .week { grid-template-columns: 1fr; overflow: visible; }
  .day { min-height: 0; }
}

@media print {
  .sidebar, .topbar, .page-actions, .calendar-toolbar .toolbar-filters, .calendar-nav .btn, .toasts, .sb-backdrop { display: none !important; }
  .app { display: block; }
  .content { padding: 0; max-width: none; }
  body { background: #fff; }
  .week { grid-template-columns: repeat(7, 1fr); gap: 4px; overflow: visible; }
  .card { box-shadow: none; }
  [data-page] { opacity: 1 !important; }
}

/* Fase 6 — righe annidate, totali, magazzino */
.repeater { border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: var(--surface); }
.repeater-head, .repeater-row { display: grid; grid-template-columns: 28px var(--righe-colonne, 1.3fr 1fr 1fr) 36px; gap: 8px; align-items: start; padding: 8px 10px; }
.repeater-head { background: var(--surface-2); border-bottom: 1px solid var(--border); font-size: 11.5px; font-weight: 600; color: var(--muted); }
.repeater-row + .repeater-row { border-top: 1px dashed var(--border); }
.repeater-num { align-self: center; font-weight: 650; color: var(--muted); text-align: center; }
.repeater-cell .input { height: 36px; }
.repeater-cell.has-error .input { border-color: var(--danger); }
.repeater-cell .field-error { font-size: 11.5px; }
.repeater-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px; border-top: 1px solid var(--border); background: var(--surface-2); }
.repeater-sum { font-size: 13px; font-weight: 600; }
.repeater-sum .ok { color: var(--success); }
.repeater-rows:empty::before { content: attr(data-vuoto); display: block; padding: 14px; font-size: 12.5px; color: var(--muted); }

.totals { display: flex; flex-wrap: wrap; gap: 10px; }
.total-chip { display: flex; flex-direction: column; gap: 2px; padding: 12px 18px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-xs); min-width: 160px; }
.total-chip span { font-size: 12.5px; color: var(--muted); }
.total-chip strong { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }

.qty { font-weight: 700; }
.qty-in { color: var(--success); }
.qty-out { color: var(--danger); }

@media (max-width: 760px) {
  .repeater-head { display: none; }
  .repeater-row { grid-template-columns: 24px 1fr 36px; }
  .repeater-row .repeater-cell { grid-column: 2; }
}

/* ==========================================================================
   Fase 7 — Attività e Amministrazione
   ========================================================================== */
.tone-entrate { --tone: var(--fin-entrate); --tone-soft: color-mix(in oklab, var(--fin-entrate) 14%, transparent); }
.tone-uscite { --tone: var(--fin-uscite); --tone-soft: color-mix(in oklab, var(--fin-uscite) 14%, transparent); }
.bar.tone-entrate > span, .bar.tone-uscite > span { background: var(--tone); }

/* Importi con segno: il colore accompagna segno e icona, mai da solo */
.mov { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; white-space: nowrap; }
.mov-icon { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; flex: none; }
.mov-in .mov-icon { background: color-mix(in oklab, var(--success) 14%, transparent); color: var(--success); }
.mov-out .mov-icon { background: color-mix(in oklab, var(--danger) 12%, transparent); color: var(--danger); }
.mov-transfer .mov-icon { background: var(--surface-3); color: var(--text-2); }
.mov-out .num { color: var(--text); }
td.mov-in { color: var(--success); }
td.mov-out { color: var(--text-2); }
.mov-dest { display: block; margin-top: 2px; }
.amount-strong { font-weight: 700; }
.is-negative { color: var(--danger); }
.total-chip.is-positive strong { color: var(--success); }
.total-chip.is-negative strong { color: var(--danger); }

/* Risultato partita */
.score { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.score strong { font-size: 15px; letter-spacing: 0.02em; }
.score .badge { min-width: 24px; justify-content: center; padding: 0 6px; }

/* Bilancio */
.bilancio-filtri { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; padding: 14px 18px; }
.bilancio-filtri .field { width: 170px; margin: 0; }
.bilancio-rapidi { display: flex; flex-wrap: wrap; gap: 6px; margin-right: auto; padding-bottom: 4px; }
.bilancio-rapidi .chip { text-decoration: none; transition: background .15s, color .15s; }
.bilancio-rapidi .chip:hover { background: var(--brand-soft); color: var(--brand-strong); }
.bilancio-voci { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 16px; }
.table-compact th, .table-compact td { padding-top: 10px; padding-bottom: 10px; }
.table-compact tbody th { font-weight: 500; }
.table-compact td small { display: block; font-size: 11.5px; }
.table tfoot th, .table tfoot td { border-top: 1px solid var(--border-strong); font-weight: 600; }
.voce-nome { display: flex; gap: 8px; align-items: baseline; }
.bar-thin { display: block; height: 4px; margin-top: 6px; max-width: 240px; }
.cell-link { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; font-weight: 550; }
.cell-link:hover { color: var(--brand-strong); text-decoration: underline; }
.empty-inline { padding: 18px 20px; margin: 0; }
.stat-value.num { font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
  .bilancio-filtri .field { width: calc(50% - 8px); }
  .bilancio-filtri .btn { width: 100%; justify-content: center; }
}
/* Prima colonna con un codice (es. numero fattura): niente larghezza minima */
.registry-table td.cell-main:has(> .mono) { min-width: 0; white-space: nowrap; }

/* ==========================================================================
   Fase 8 — Società, utenti e profilo
   ========================================================================== */

/* Allegati nel drawer */
.attachment { display: flex; flex-direction: column; gap: 8px; }
.attachment-drop {
  display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 64px; padding: 14px;
  border: 1.5px dashed var(--border-strong); border-radius: 14px; background: var(--surface-2);
  color: var(--text-2); font-size: 13px; cursor: pointer; transition: border-color .15s, background-color .15s;
}
.attachment-drop:hover, .attachment-drop.is-over, .attachment-drop:focus-within { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-strong); }
.attachment-drop.is-loading { pointer-events: none; opacity: .7; }
.attachment-file { display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 10px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-xs); }
.attachment-thumb { width: 44px; height: 44px; flex: none; border-radius: 10px; overflow: hidden; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-strong); }
.attachment-thumb img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.attachment-ext { font-size: 11px; font-weight: 700; letter-spacing: .04em; }
.attachment-name { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 560; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; }
.attachment-name:hover { color: var(--brand-strong); text-decoration: underline; }
.file-chip { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 9px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); font-size: 11.5px; font-weight: 650; text-decoration: none; }
.file-chip:hover { border-color: var(--brand); color: var(--brand-strong); }

/* Pagine impostazioni (Parametri, Profilo) */
.notice { display: flex; align-items: center; gap: 10px; padding: 12px 16px; margin-bottom: 16px; border-radius: 14px; background: var(--tone-soft, var(--brand-soft)); color: var(--text); border: 1px solid color-mix(in oklab, var(--tone, var(--brand)) 30%, transparent); font-size: 13.5px; }
.notice .icon { color: var(--tone, var(--brand)); }
.settings-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 360px); gap: 16px; align-items: start; }
.settings-main, .settings-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.settings-side { position: sticky; top: 84px; }
.settings-fieldset { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.settings-fieldset[disabled] { opacity: .85; }
.settings-card { padding: 20px 22px 22px; }
.settings-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 18px; }
.settings-head h2 { font-size: 16px; }
.settings-head p { color: var(--muted); font-size: 13px; margin-top: 2px; }
.settings-icon { width: 34px; height: 34px; flex: none; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-strong); }
.settings-actions { display: flex; justify-content: flex-end; margin-top: 18px; }
.settings-note { font-size: 12.5px; margin-top: 14px; }
.season-list { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.season-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); font-size: 13px; }
.season-list li .badge { margin-left: auto; }
.season-form { padding-top: 14px; border-top: 1px solid var(--border); }
.brand-preview { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.brand-preview strong { display: block; font-size: 14px; }
.brand-preview small { font-size: 12px; }
.brand-mark img { background: #fff; }

/* Robustezza password */
.strength { display: flex; align-items: center; gap: 12px; }
.strength-bar { flex: 1; height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.strength-bar span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--danger); transition: width .3s ease, background-color .3s; }
.strength-bar span[data-livello="2"] { background: var(--warning); }
.strength-bar span[data-livello="3"], .strength-bar span[data-livello="4"] { background: var(--success); }
.strength-text { font-size: 12.5px; min-width: 150px; text-align: right; }
.timeline-icons { padding: 0; }
.timeline-icons li { padding-left: 34px; }
.timeline-icons li::before { display: none; }
.timeline-icons li::after { left: 11px; top: 26px; }
.timeline-icons .timeline-icon { position: absolute; left: 0; top: 0; width: 23px; height: 23px; border-radius: 8px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-strong); }
.timeline-icons small { display: block; font-size: 12px; }
.timeline-icons div { min-width: 0; }

/* Archivio documenti */
.docs-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 16px; align-items: start; }
.docs-folders { padding: 8px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 84px; }
.docs-folder { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; color: var(--text-2); text-decoration: none; font-size: 13.5px; transition: background-color .15s, color .15s; }
.docs-folder span:nth-of-type(1) { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.docs-folder:hover { background: var(--surface-2); color: var(--text); }
.docs-folder.is-active { background: var(--brand-soft); color: var(--brand-strong); font-weight: 600; }
.docs-count { font-size: 12px; color: var(--muted); }
.docs-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.docs-toolbar .archive-search { flex: 1; }
.docs-drop { padding: 18px 20px 20px; }
.docs-drop-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.docs-drop-head h2 { font-size: 16px; }
.docs-upload { min-height: 140px; }
.docs-upload.is-over { border-color: var(--brand); background: var(--brand-soft); }
.docs-queue { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.docs-queue-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 10px; background: var(--surface-2); font-size: 13px; }
.docs-queue-item span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.docs-queue-item.is-ok .icon { color: var(--success); }
.docs-queue-item.is-error { background: color-mix(in oklab, var(--danger) 10%, transparent); }
.docs-queue-item.is-error .icon, .docs-queue-item.is-error small { color: var(--danger); }
.doc-name { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; min-width: 0; }
.doc-name strong { font-weight: 600; }
.doc-name:hover strong { color: var(--brand-strong); text-decoration: underline; }
.doc-icon { width: 36px; height: 36px; flex: none; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.doc-icon.ext-pdf { color: var(--danger); }
.doc-icon.ext-xlsx, .doc-icon.ext-ods { color: var(--success); }
.doc-icon.ext-docx, .doc-icon.ext-odt { color: var(--info); }
.docs-table td { vertical-align: middle; }

/* Registro attività */
.registro-filtri { justify-content: flex-start; }
.registro-filtri .archive-search { flex: 1 1 220px; }
.registro-filtri .select { width: auto; min-width: 170px; }
.input-date { width: 140px; }
.registro-campi { display: block; margin-top: 2px; font-size: 12px; }
.pagination { display: flex; align-items: center; gap: 10px; }

@media (max-width: 1100px) {
  .settings-layout, .docs-layout { grid-template-columns: minmax(0, 1fr); }
  .settings-side, .docs-folders { position: static; }
  .docs-folders { flex-direction: row; overflow-x: auto; }
  .docs-folder { flex: none; }
}
.docs-folders { min-width: 0; }
.docs-toolbar { min-width: 0; }
/* I <caption class="sr-only"> (assoluti) restano dentro il contenitore che scorre */
.table-wrap { position: relative; }


/* Logo caricato (spesso a sfondo trasparente): niente riquadro colorato dietro */
.brand-mark:has(img) { background: transparent; box-shadow: none; border-radius: 0; }
.brand-mark:has(img) img { background: transparent; border-radius: 0; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .18)); }
.auth-logo:has(img) { width: 88px; height: 88px; }
.auth-brand .brand-mark:has(img) { width: 52px; height: 52px; background: transparent; border: 0; backdrop-filter: none; }
aside .brand-mark:has(img), .sidebar .brand-mark:has(img) { width: 40px; height: 40px; }

/* ==========================================================================
   Scadenzario, avvisi, spazi pubblicitari, piano rate annuale
   ========================================================================== */

/* Campanella nella topbar */
.bell-btn { position: relative; }
.bell-count {
  position: absolute; top: 2px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; display: grid; place-items: center;
  background: var(--warning); color: #fff; font-size: 10.5px; font-weight: 700; line-height: 1;
  box-shadow: 0 0 0 2px var(--surface);
}
.bell-count.is-danger { background: var(--danger); }
.menu-avvisi { width: min(360px, calc(100vw - 24px)); }
.menu-empty { padding: 10px 12px; font-size: 13px; margin: 0; }
.avviso { align-items: flex-start; }
.avviso-icon { width: 28px; height: 28px; flex: none; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); }
.avviso.is-scaduta .avviso-icon { background: color-mix(in oklab, var(--danger) 14%, transparent); color: var(--danger); }
.avviso.is-in_arrivo .avviso-icon { background: color-mix(in oklab, var(--warning) 16%, transparent); color: var(--warning); }
.avviso-testo { display: flex; flex-direction: column; min-width: 0; }
.avviso-testo strong { font-weight: 560; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avviso-testo small { font-size: 12px; color: var(--muted); }
.avviso.is-scaduta .avviso-testo small { color: var(--danger); }
.menu-item-all { border-top: 1px solid var(--border); border-radius: 0 0 var(--radius-sm) var(--radius-sm); margin-top: 4px; font-weight: 600; color: var(--brand-strong); }

/* Scadenzario */
.stat.is-selected { outline: 2px solid var(--brand); outline-offset: -2px; }
.scad-list-card { padding: 0 0 8px; min-width: 0; }
.scad-list-card .card-head { padding: 18px 20px 12px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.segmented-item {
  display: flex; align-items: center; justify-content: center; height: 30px; padding: 0 14px; border-radius: 7px;
  color: var(--muted); font-size: 12.5px; font-weight: 550; text-decoration: none; transition: background-color .15s, color .15s;
}
.segmented-item.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.scad-list-card .segmented { margin: 0; }
.scad-list { list-style: none; margin: 0; padding: 0 8px; }
.scad-month { padding: 14px 12px 6px; font-size: 12px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.scad-item a {
  display: flex; align-items: center; gap: 14px; padding: 10px 12px; border-radius: 12px;
  color: inherit; text-decoration: none; transition: background-color .15s;
}
.scad-item a:hover, .scad-item a:focus-visible { background: var(--surface-2); }
.scad-date { width: 44px; flex: none; display: flex; flex-direction: column; align-items: center; padding: 4px 0; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.scad-date strong { font-size: 17px; line-height: 1.1; }
.scad-date small { font-size: 10.5px; text-transform: uppercase; color: var(--muted); letter-spacing: .04em; }
.scad-item.is-scaduta .scad-date { border-color: color-mix(in oklab, var(--danger) 45%, transparent); background: color-mix(in oklab, var(--danger) 8%, transparent); }
.scad-item.is-in_arrivo .scad-date { border-color: color-mix(in oklab, var(--warning) 50%, transparent); background: color-mix(in oklab, var(--warning) 9%, transparent); }
.scad-icon { width: 30px; height: 30px; flex: none; border-radius: 9px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-strong); }
.scad-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.scad-body strong { font-weight: 580; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scad-body small { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scad-item .badge { flex: none; white-space: nowrap; }
.scad-go { color: var(--faint); flex: none; }
@media (max-width: 640px) {
  .scad-item a { flex-wrap: wrap; gap: 10px; }
  .scad-icon, .scad-go { display: none; }
  .scad-body { flex-basis: calc(100% - 60px); }
  .scad-item .badge { margin-left: 54px; }
}

/* Spazi pubblicitari: scelte con nota */
.choices { display: flex; flex-direction: column; gap: 12px; }
.choice-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.choice-chip { position: relative; cursor: pointer; }
.choice-chip input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.choice-chip span {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); font-size: 13px; font-weight: 550;
  transition: background-color .15s, border-color .15s, color .15s;
}
.choice-chip span .icon { display: none; }
.choice-chip input:checked + span { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-strong); }
.choice-chip input:checked + span .icon { display: inline-block; }
.choice-chip input:focus-visible + span { box-shadow: 0 0 0 3px var(--brand-ring); }
.choice-notes { display: flex; flex-direction: column; gap: 8px; }
.choice-notes:not(:has(.choice-note:not([hidden]))) { display: none; }
.choice-note { display: grid; grid-template-columns: minmax(120px, 34%) minmax(0, 1fr); align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.choice-note-label { font-size: 13px; font-weight: 600; color: var(--text); }
@media (max-width: 640px) { .choice-note { grid-template-columns: 1fr; gap: 6px; } }
.chip-list { display: flex; flex-wrap: wrap; gap: 4px; max-width: 260px; }

/* Piano rate annuale */
.plan-gen { margin: 10px 0; padding: 14px; border-radius: 14px; border: 1px solid color-mix(in oklab, var(--brand) 35%, transparent); background: var(--brand-soft); display: flex; flex-direction: column; gap: 12px; }
.plan-gen-head { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.plan-gen-head strong { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); }
.plan-gen-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.plan-gen-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.plan-gen-preview { font-size: 13px; margin: 0; }
.plan-gen-actions { display: flex; justify-content: flex-end; gap: 8px; }
@media (max-width: 640px) { .plan-gen-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Topbar più affollata con la campanella: ricerca compatta sugli schermi medi */
.search-trigger span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1100px) {
  .search-trigger { width: 38px; padding: 0; justify-content: center; }
  .search-trigger span, .search-trigger .kbd { display: none; }
}

/* Telefono: i menu della topbar si aprono centrati a tutta larghezza (con margini) */
@media (max-width: 640px) {
  .topbar .menu, .topbar .menu-avvisi {
    position: fixed; top: calc(var(--topbar-h) + 4px); left: 12px; right: 12px;
    width: auto; min-width: 0; max-width: 420px; margin-inline: auto;
    max-height: calc(100dvh - var(--topbar-h) - 24px); overflow-y: auto;
  }
}

/* Breadcrumb: si accorcia (con …) invece di finire sotto la ricerca */
.breadcrumb { flex: 0 1 auto; overflow: hidden; }
.breadcrumb ol { overflow: hidden; }
.breadcrumb li { flex: none; }
.breadcrumb li:last-child { flex: 0 1 auto; min-width: 0; overflow: hidden; }
.breadcrumb li:last-child > * { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-trigger, .topbar .dropdown { flex: none; }
@media (max-width: 1280px) {
  /* Schermi medi: solo le ultime due briciole */
  .breadcrumb li:not(:nth-last-child(-n+2)) { display: none; }
}

/* Campanella: elenco scorrevole, "Apri lo scadenzario" sempre visibile in fondo (PC e telefono) */
.topbar .menu-avvisi {
  display: flex; flex-direction: column;
  max-height: calc(100dvh - var(--topbar-h) - 24px); overflow: hidden;
}
.menu-avvisi > .menu-label, .menu-avvisi > .menu-item-all { flex: none; }
.menu-avvisi [data-campanella-voci] { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }

/* ==========================================================================
   Archivio documenti a cartelle
   ========================================================================== */
.docs-folders { max-height: calc(100dvh - var(--topbar-h) - 40px); overflow-y: auto; }
.tree, .tree-children { list-style: none; margin: 0; padding: 0; }
.tree-children { display: none; }
.tree-item.is-open > .tree-children { display: block; }
.tree-row { display: flex; align-items: center; gap: 2px; padding-left: calc(var(--livello, 0) * 14px); }
.tree-row .docs-folder { flex: 1; min-width: 0; }
.tree-toggle, .tree-toggle-spacer { width: 22px; height: 22px; flex: none; }
.tree-toggle { display: grid; place-items: center; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; transition: transform .15s, background-color .15s; }
.tree-toggle:hover { background: var(--surface-2); color: var(--text); }
.tree-item.is-open > .tree-row .tree-toggle { transform: rotate(90deg); }
.docs-folder-root { margin-bottom: 4px; }
.docs-folder.is-drop, tr.is-drop td { background: var(--brand-soft) !important; outline: 2px dashed var(--brand); outline-offset: -2px; }

.docs-toolbar { display: flex; align-items: center; gap: 12px; padding: 10px 12px; flex-wrap: wrap; }
.docs-toolbar .archive-search { flex: 1 1 240px; }
.docs-path { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; font-size: 14px; color: var(--muted); }
.docs-path a { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); text-decoration: none; border-radius: 6px; padding: 2px 4px; }
.docs-path a:hover { background: var(--surface-2); color: var(--text); }
.docs-path strong { color: var(--text); font-weight: 650; padding: 2px 4px; }

.docs-row-folder .doc-name strong { font-weight: 650; }
.doc-icon-folder { color: var(--warning); background: color-mix(in oklab, var(--warning) 12%, transparent); border-color: color-mix(in oklab, var(--warning) 30%, transparent); }

.docs-progress { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.docs-progress-bar { flex: 1; height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.docs-progress-bar span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--brand); transition: width .25s ease; }
.docs-progress .num { font-size: 12.5px; white-space: nowrap; }
.docs-queue { max-height: 220px; overflow-y: auto; }
.docs-queue-item .btn { margin-left: auto; }

@media (max-width: 640px) {
  .docs-toolbar .btn { width: 100%; justify-content: center; }
  .page-actions .btn { flex: 1 1 auto; justify-content: center; }
}
@media (max-width: 1100px) {
  /* Albero in colonna anche su tablet e telefono, con altezza contenuta */
  .docs-folders { flex-direction: column; overflow-x: hidden; max-height: 280px; }
}

/* Archivio: file usati altrove (logo della società, loghi sponsor, verbali) */
.doc-uso { display: inline-flex; align-items: center; gap: 4px; margin-top: 3px; font-size: 12px !important; font-weight: 600; color: var(--warning) !important; }

/* Archivio: colonna di sinistra (cartelle + spazio sul server) */
.docs-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; position: sticky; top: 84px; }
.docs-side .docs-folders { position: static; max-height: calc(100dvh - var(--topbar-h) - 220px); }
.docs-spazio { padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.docs-spazio-head { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 13.5px; }
.docs-spazio-bar { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.docs-spazio-bar span { display: block; height: 100%; border-radius: inherit; background: var(--brand); }
.docs-spazio.is-quasi .docs-spazio-bar span { background: var(--warning); }
.docs-spazio.is-pieno .docs-spazio-bar span { background: var(--danger); }
.docs-spazio-libero { margin: 0; font-size: 13.5px; color: var(--text-2); }
.docs-spazio-libero strong { color: var(--text); }
.docs-spazio-avviso { margin: 0; display: flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--warning); }
.docs-spazio.is-pieno .docs-spazio-avviso { color: var(--danger); }
.docs-spazio-nota { margin: 0; font-size: 12px; color: var(--muted); }
@media (max-width: 1100px) {
  .docs-side { position: static; }
  .docs-side .docs-folders { max-height: 280px; }
}

/* Tema personalizzato */
.tema-modal { width: min(460px, 100%); }
.tema-sezione { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.tema-colori { display: flex; flex-wrap: wrap; gap: 10px; }
.tema-colore { position: relative; width: 38px; height: 38px; border-radius: 50%; border: 2px solid var(--surface); background: var(--c, var(--surface-2)); box-shadow: 0 0 0 1px var(--border-strong); display: grid; place-items: center; color: #fff; cursor: pointer; transition: transform .15s, box-shadow .15s; }
.tema-colore:hover { transform: scale(1.08); }
.tema-colore .icon { opacity: 0; filter: drop-shadow(0 1px 1px rgba(0,0,0,.4)); }
.tema-colore[aria-checked="true"], .tema-colore.is-selected { box-shadow: 0 0 0 2px var(--text); }
.tema-colore[aria-checked="true"] .icon { opacity: 1; }
.tema-colore:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--brand-ring), 0 0 0 1px var(--border-strong); }
.tema-colore-libero { background: conic-gradient(from 0deg, #ef4444, #f59e0b, #22c55e, #0ea5e9, #8b5cf6, #ec4899, #ef4444); }
.tema-colore-libero.is-selected { background: var(--c); }
.tema-colore-libero input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.tema-colore-libero .icon { opacity: 1; }
.tema-modal .segmented-lg { margin: 0; justify-self: start; display: inline-grid; }
.tema-anteprima { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 18px; padding: 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); pointer-events: none; }
.tema-anteprima-link { color: var(--brand-strong); font-weight: 600; text-decoration: underline; font-size: 13.5px; }
.tema-colori { align-items: center; }
.tema-colore-logo { width: 44px; height: 44px; }
.tema-logo-nota { display: flex; flex-direction: column; gap: 1px; margin-left: 6px; font-size: 13px; line-height: 1.3; }
.tema-logo-nota small { color: var(--muted); font-size: 11.5px; }

/* Promemoria certificati (WhatsApp) */
.promemoria-list { list-style: none; margin: 0; padding: 0 8px 4px; }
.promemoria-item { display: flex; align-items: flex-start; gap: 14px; padding: 12px; border-radius: 12px; transition: background-color .15s, opacity .2s; }
.promemoria-item + .promemoria-item { border-top: 1px solid var(--border); border-radius: 0; }
.promemoria-item.is-done { opacity: .6; }
.promemoria-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.promemoria-top { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; }
.promemoria-top strong { font-weight: 600; }
.promemoria-atleti { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; }
.promemoria-atleti a { display: inline-flex; align-items: center; gap: 5px; color: var(--text-2); text-decoration: none; }
.promemoria-atleti a:hover { color: var(--brand-strong); text-decoration: underline; }
.promemoria-testo summary { cursor: pointer; font-size: 12.5px; color: var(--muted); width: fit-content; }
.promemoria-testo p { margin-top: 6px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; color: var(--text-2); max-width: 62ch; }
.promemoria-azioni { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.promemoria-azioni .btn.is-disabled { pointer-events: none; opacity: .5; }
.promemoria-impostazioni { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 340px); gap: 16px; align-items: start; padding: 4px 20px 20px; }
.promemoria-impostazioni .settings-card { box-shadow: none; }
.promemoria-test { position: sticky; top: 84px; }
.promemoria-url { padding: 14px 0 0; grid-template-columns: minmax(0, 1fr); }
.promemoria-url dd { word-break: break-all; font-size: 12.5px; }
@media (max-width: 900px) {
  .promemoria-impostazioni { grid-template-columns: minmax(0, 1fr); padding: 4px 12px 16px; }
  .promemoria-test { position: static; }
}
@media (max-width: 640px) {
  .promemoria-item { flex-wrap: wrap; }
  .promemoria-body { flex-basis: calc(100% - 60px); }
  .promemoria-azioni { width: 100%; align-items: stretch; }
}
.promemoria-schede { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.promemoria-schede::-webkit-scrollbar { display: none; }
.promemoria-schede .segmented-item { flex: none; white-space: nowrap; }
@media (max-width: 640px) {
  .scad-list-card .card-head .promemoria-schede { width: 100%; }
  .promemoria-schede .segmented-item { flex: 1 0 auto; padding: 0 10px; }
}
.promemoria-impostazioni.is-singola { grid-template-columns: minmax(0, 760px); }

/* Barra di scorrimento della pagina nascosta (PC e telefono): la pagina scorre normalmente
   con rotellina, touch e tastiera. Le aree interne (menu, elenchi) mantengono la loro barra sottile. */
html, body { scrollbar-width: none; -ms-overflow-style: none; }
html::-webkit-scrollbar, body::-webkit-scrollbar { display: none; width: 0; height: 0; }
.settings-layout.is-singola { grid-template-columns: minmax(0, 860px); }

/* Istruzioni d'uso: un documento unico, in stile note di rilascio */
.sb-foot { display: flex; flex-direction: column; gap: 2px; }
.guida { display: grid; grid-template-columns: 220px minmax(0, 760px); gap: 40px; align-items: start; }
.guida-indice { position: sticky; top: calc(var(--topbar-h, 64px) + 20px); }
.guida-indice-titolo { display: block; font-size: 11.5px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.guida-indice ol { list-style: none; margin: 0; padding: 0 0 0 12px; border-left: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; }
.guida-indice a { display: block; padding: 4px 0; font-size: 13.5px; color: var(--text-2); text-decoration: none; }
.guida-indice a:hover { color: var(--brand-strong); }
.guida-testo { min-width: 0; }
.guida-sezione { padding: 28px 0; border-top: 1px solid var(--border); scroll-margin-top: calc(var(--topbar-h, 64px) + 16px); }
.guida-sezione:first-child { padding-top: 4px; border-top: 0; }
.guida-sezione h2 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 19px; letter-spacing: -0.01em; }
.guida-sezione h2 .icon { color: var(--brand); }
.guida-num { font-size: 12px; font-weight: 650; color: var(--muted); min-width: 22px; }
.guida-intro { margin: 6px 0 12px 32px; color: var(--muted); font-size: 14.5px; }
.guida-punti { margin: 0 0 0 32px; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; color: var(--text-2); font-size: 14.5px; line-height: 1.6; }
.guida-punti li::marker { color: var(--brand); }
.guida-punti strong { color: var(--text); font-weight: 600; }
.guida-punti kbd { font: 600 12px var(--font-mono, monospace); padding: 1px 6px; border-radius: 6px; border: 1px solid var(--border-strong); background: var(--surface-2); }
.guida-link { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 14px 0 0 32px; }
.guida-link a { display: inline-flex; align-items: center; gap: 4px; font-size: 13.5px; font-weight: 600; color: var(--brand-strong); text-decoration: none; }
.guida-link a:hover { text-decoration: underline; }
@media (max-width: 1100px) {
  .guida { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .guida-indice { position: static; }
  .guida-indice ol { flex-direction: row; flex-wrap: wrap; gap: 4px 14px; border-left: 0; padding: 0 0 14px; border-bottom: 1px solid var(--border); }
}
@media (max-width: 640px) {
  .guida-intro, .guida-punti, .guida-link { margin-left: 0; }
  .guida-sezione h2 { font-size: 17px; }
}

/* Editor della foto del giocatore */
.foto-editor { width: min(420px, 100%); min-width: 0; max-height: calc(100dvh - 32px); overflow-y: auto; padding: 20px; }
.fe-stage {
  position: relative; width: min(320px, 100%, calc((100dvh - 290px) * 7 / 9)); min-width: 180px; aspect-ratio: 7 / 9; margin: 14px auto 0; border-radius: 14px; overflow: hidden;
  background: var(--surface-2); box-shadow: 0 0 0 1px var(--border-strong); cursor: grab; touch-action: none; user-select: none; outline: none;
}
.fe-stage:focus-visible { box-shadow: 0 0 0 3px var(--brand-ring); }
.fe-stage.is-dragging { cursor: grabbing; }
.fe-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.fe-guida { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.fe-terzi { stroke: rgba(255, 255, 255, .55); stroke-width: .3; fill: none; vector-effect: non-scaling-stroke; }
.fe-comandi { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 14px; }
.fe-comandi input[type=range] { flex: 1; min-width: 0; max-width: 180px; accent-color: var(--brand); }
.fe-sep { width: 1px; height: 22px; background: var(--border); margin: 0 4px; flex: none; }
.foto-editor .modal-actions { flex-wrap: wrap; margin-top: 16px; }
.foto-editor p { font-size: 13.5px; }

/* Presenze staff: foglio mensile */
.presenze-card { padding: 0; min-width: 0; }
.presenze-barra { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.presenze-mese { display: flex; align-items: center; gap: 6px; }
.presenze-mese h2 { font-size: 17px; min-width: 150px; text-align: center; }
.presenze-wrap { overflow-x: auto; }
.presenze { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; }
.presenze th, .presenze td { border-bottom: 1px solid var(--border); padding: 0; text-align: center; }
.presenze thead th { padding: 8px 0 6px; font-weight: 600; color: var(--muted); background: var(--surface); }
.presenze-giorno span { display: block; font-size: 10.5px; text-transform: uppercase; }
.presenze-giorno strong { display: block; font-size: 13px; color: var(--text); }
.presenze .is-festivo { background: color-mix(in oklab, var(--surface-2) 70%, var(--brand-soft)); }
.presenze thead .is-oggi strong { color: var(--brand-strong); }
.presenze td.is-oggi, .presenze th.is-oggi { box-shadow: inset 1px 0 0 var(--brand), inset -1px 0 0 var(--brand); }
.presenze-nome { position: sticky; left: 0; z-index: 1; min-width: 170px; max-width: 220px; padding: 8px 14px !important; text-align: left !important; background: var(--surface); border-right: 1px solid var(--border); }
.presenze-nome strong { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.presenze-nome small { display: block; color: var(--muted); font-size: 11.5px; }
.presenze-tot { min-width: 34px; padding: 0 6px !important; font-weight: 600; background: var(--surface-2); }
.presenza {
  width: 30px; height: 30px; margin: 4px 2px; border-radius: 8px; border: 1px solid transparent; background: transparent;
  font: 700 12px var(--font-sans, inherit); color: var(--text); cursor: pointer; transition: background-color .12s, border-color .12s, transform .12s;
}
.presenza:hover { border-color: var(--border-strong); background: var(--surface-2); }
.presenza:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--brand-ring); }
.presenza:active { transform: scale(.92); }
.presenza.is-presente { background: color-mix(in oklab, var(--success) 18%, transparent); border-color: color-mix(in oklab, var(--success) 45%, transparent); color: color-mix(in oklab, var(--success) 80%, var(--text)); }
.presenza.is-assente { background: color-mix(in oklab, var(--danger) 14%, transparent); border-color: color-mix(in oklab, var(--danger) 40%, transparent); color: color-mix(in oklab, var(--danger) 85%, var(--text)); }
.presenze-legenda { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 18px 16px; font-size: 12.5px; }
.presenze-legenda .presenza { width: 22px; height: 22px; margin: 0 0 0 8px; cursor: default; font-size: 11px; }
.presenze-legenda .presenza:first-child { margin-left: 0; }
.presenze-legenda-festivo { width: 18px; height: 14px; margin-left: 8px; border-radius: 4px; background: color-mix(in oklab, var(--surface-2) 70%, var(--brand-soft)); border: 1px solid var(--border); }

/* =============================================================================
   Centro fitness: abbonamenti, check-in, planning, dashboard
   ============================================================================= */

.icon-md { width: 20px; height: 20px; }
.icon-xl { width: 34px; height: 34px; stroke-width: 1.5; }
.grid-stats-4 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.dashboard-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.link-more { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 560; color: var(--brand-strong); }
.link-more:hover { text-decoration: underline; }
.link-plain { all: unset; cursor: pointer; display: block; }
.link-plain:hover strong { color: var(--brand-strong); }
.link-plain:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
.chip.is-active { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
button.chip { cursor: pointer; transition: background .2s var(--ease), color .2s, border-color .2s, transform .15s var(--ease); }
button.chip:hover:not(.is-active) { background: var(--brand-soft); color: var(--brand-strong); }
button.chip:active { transform: scale(.96); }
.choice-item input:disabled + span { opacity: .45; cursor: not-allowed; }

/* Barra di avanzamento (validità o ingressi) */
.progress { height: 6px; margin-top: 12px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; width: var(--p, 0%); border-radius: inherit; background: var(--tone, var(--brand)); transition: width .8s var(--ease); }
.progress-sm { height: 4px; margin: 6px 0 2px; }

/* Card statistica in evidenza */
.stat-hero { background: radial-gradient(120% 140% at 100% 0%, color-mix(in oklab, var(--brand) 55%, transparent), transparent 60%), linear-gradient(135deg, #222222, #000000); border-color: transparent; color: #fff; }
.stat-hero .stat-label, .stat-hero .stat-meta { color: rgba(255, 255, 255, .82); }
.stat-hero .stat-value { color: #fff; }
.stat-hero .stat-icon { background: rgba(255, 255, 255, .16); color: #fff; }
.stat-hero::after { content: ""; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 255, 255, .18), transparent 70%); pointer-events: none; }
.stat-compact .stat-value { font-size: 26px; }

.course-pill { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; }
.course-pill small { flex-basis: 100%; }

/* ------------------------------------------------- Scelta dell'abbonamento */
.plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; margin-top: 6px; }
.plan {
  position: relative; display: flex; flex-direction: column; gap: 4px; padding: 16px 16px 14px;
  border: 1.5px solid var(--border-strong); border-radius: var(--radius); background: var(--surface);
  cursor: pointer; transition: border-color .2s var(--ease), box-shadow .2s var(--ease), transform .2s var(--ease), background .2s;
}
.plan:hover { border-color: color-mix(in oklab, var(--tone, var(--brand)) 45%, transparent); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.plan.is-selected { border-color: var(--tone, var(--brand)); background: color-mix(in oklab, var(--tone, var(--brand)) 6%, var(--surface)); box-shadow: 0 0 0 4px color-mix(in oklab, var(--tone, var(--brand)) 14%, transparent); }
.plan:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }
.plan-check {
  position: absolute; top: 12px; right: 12px; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; border: 1.5px solid var(--border-strong); color: transparent;
  transition: background .2s, border-color .2s, color .2s, transform .25s var(--ease);
}
.plan.is-selected .plan-check { background: var(--tone, var(--brand)); border-color: var(--tone, var(--brand)); color: #fff; transform: scale(1.06); }
.plan-name { font-weight: 620; font-size: 14px; padding-right: 26px; line-height: 1.35; }
.plan-price { font-size: 24px; font-weight: 700; letter-spacing: -.02em; color: var(--tone, var(--brand-strong)); }
.plan-meta, .plan-desc { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.plan-meta { color: var(--text-2); font-weight: 520; }
.plan-empty { padding: 18px; border: 1.5px dashed var(--border-strong); border-radius: var(--radius); text-align: center; }
.has-error .plan-grid .plan:not(.is-selected) { border-color: color-mix(in oklab, var(--danger) 45%, transparent); }

/* ---------------------------------------------------------------- Check-in */
.checkin { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr); gap: 16px; align-items: start; }
.checkin-main, .checkin-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.checkin-search { position: relative; padding: 20px; z-index: 5; }
.checkin-search-label { display: block; font-size: 15px; font-weight: 620; margin-bottom: 12px; }
.checkin-search-box {
  display: flex; align-items: center; gap: 12px; padding: 0 16px; height: 60px;
  border: 1.5px solid var(--border-strong); border-radius: var(--radius-lg); background: var(--surface-2);
  color: var(--muted); transition: border-color .2s, box-shadow .2s, background .2s;
}
.checkin-search-box:focus-within { border-color: var(--brand); background: var(--surface); box-shadow: 0 0 0 5px var(--brand-ring); color: var(--brand); }
.checkin-input { flex: 1; min-width: 0; border: 0; background: transparent; font-size: 18px; font-weight: 500; color: var(--text); }
.checkin-input::placeholder { color: var(--faint); font-weight: 400; }
.checkin-input::-webkit-search-cancel-button { cursor: pointer; }
.checkin-hint { margin-top: 10px; font-size: 12.5px; }
.checkin-results {
  position: absolute; left: 20px; right: 20px; top: calc(100% - 34px); list-style: none; margin: 0; padding: 6px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  max-height: 380px; overflow-y: auto;
}
.checkin-result { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm); cursor: pointer; transition: background .12s; }
.checkin-result small { display: block; color: var(--muted); font-size: 12px; }
.checkin-result.is-active, .checkin-result:hover { background: var(--brand-soft); }
.checkin-result.is-empty { cursor: default; color: var(--muted); gap: 8px; }
.checkin-result.is-empty:hover { background: transparent; }

.checkin-empty { padding: 44px 24px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.checkin-empty p { max-width: 460px; }
.checkin-empty-art { width: 76px; height: 76px; border-radius: 24px; display: grid; place-items: center; margin-bottom: 6px; color: var(--brand); background: var(--brand-soft); animation: respiro 3.2s ease-in-out infinite; }
@keyframes respiro { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }

.checkin-card { --tone: var(--success); overflow: hidden; border-top: 4px solid var(--tone); }
.checkin-card.is-warning { --tone: var(--warning); }
.checkin-card.is-danger { --tone: var(--danger); }
.checkin-verdict { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 14px 20px; background: color-mix(in oklab, var(--tone) 10%, transparent); color: color-mix(in oklab, var(--tone) 85%, var(--text)); font-size: 15px; }
.checkin-verdict-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--tone); color: #fff; }
.checkin-verdict .badge { margin-left: auto; }
.checkin-person { display: flex; align-items: center; gap: 16px; padding: 20px 20px 4px; }
.checkin-person h2 { font-size: 22px; }
.avatar-xl { width: 72px; height: 72px; border-radius: 22px; font-size: 24px; }
.avatar-photo-xl { width: 72px; height: 72px; border-radius: 22px; object-fit: cover; }
.checkin-alerts { list-style: none; margin: 14px 20px 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.checkin-alerts li { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 13.5px; }
.checkin-alerts li.tone-danger { background: color-mix(in oklab, var(--danger) 10%, transparent); color: color-mix(in oklab, var(--danger) 85%, var(--text)); }
.checkin-alerts li.tone-warning { background: color-mix(in oklab, var(--warning) 12%, transparent); color: color-mix(in oklab, var(--warning) 75%, var(--text)); }
.checkin-subs { display: grid; gap: 10px; padding: 16px 20px 4px; }
.checkin-sub { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-left: 4px solid var(--tone, var(--brand)); border-radius: var(--radius-sm); transition: background .15s, transform .2s var(--ease); }
.checkin-sub:hover { background: var(--surface-2); transform: translateX(2px); }
.checkin-sub small { display: block; color: var(--muted); font-size: 12px; }
.checkin-actions { display: flex; flex-wrap: wrap; gap: 10px; padding: 18px 20px 12px; }
.checkin-actions .btn-lg { flex: 1 1 220px; justify-content: center; }
.checkin-last { display: flex; align-items: center; gap: 6px; padding: 0 20px 18px; font-size: 12.5px; }

.checkin-log { max-height: 460px; overflow-y: auto; }
.log-item { transition: background .4s; }
.log-item .grow small { display: block; }
.log-item.is-new { background: color-mix(in oklab, var(--success) 10%, transparent); }
.log-time { font-weight: 600; color: var(--text-2); }

/* Lezioni di oggi */
.today-lessons { list-style: none; margin: 0; padding: 4px 12px 12px; display: flex; flex-direction: column; gap: 6px; }
.today-lesson { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: var(--radius-sm); border-left: 3px solid var(--c); background: color-mix(in oklab, var(--c) 6%, transparent); transition: opacity .3s; }
.today-lesson small { display: block; font-size: 12px; color: var(--muted); }
.today-lesson.is-conclusa { opacity: .55; }
.today-lesson.is-in_corso { background: color-mix(in oklab, var(--c) 14%, transparent); }
.today-time { display: flex; flex-direction: column; min-width: 46px; font-weight: 650; font-size: 13px; }
.today-time small { font-weight: 450; }
.badge-pulse { gap: 6px; }
.pulse-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulsa 1.6s ease-out infinite; }
@keyframes pulsa { 0% { box-shadow: 0 0 0 0 color-mix(in oklab, currentColor 55%, transparent); } 100% { box-shadow: 0 0 0 7px transparent; } }

/* Mini grafico ingressi */
.mini-bars { display: grid; grid-template-columns: repeat(14, 1fr); gap: 6px; height: 170px; align-items: end; }
.mini-bar { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; }
.mini-bar-fill { width: 100%; max-width: 30px; height: calc(var(--h) * 110px); min-height: 3px; border-radius: 6px 6px 3px 3px; background: color-mix(in oklab, var(--brand) 55%, var(--surface-3)); transform-origin: bottom; animation: cresci .7s var(--ease) both; }
.mini-bar:nth-child(n) .mini-bar-fill { animation-delay: calc(var(--i, 0) * 30ms); }
.mini-bar.is-today .mini-bar-fill { background: var(--brand); }
.mini-bar.is-sunday .mini-bar-fill { background: var(--surface-3); }
.mini-bar-value { font-size: 11.5px; font-weight: 600; color: var(--text-2); min-height: 14px; }
.mini-bar-label { display: flex; flex-direction: column; align-items: center; font-size: 11px; font-weight: 600; color: var(--muted); line-height: 1.2; }
.mini-bar-label small { font-weight: 450; }
.mini-bar.is-today .mini-bar-label { color: var(--brand-strong); }
@keyframes cresci { from { transform: scaleY(0); } to { transform: scaleY(1); } }

/* ----------------------------------------------------------------- Planning */
.planning { display: flex; flex-direction: column; gap: 16px; }
.planning-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 12px 16px; }
.planning-filters { display: flex; gap: 10px; flex-wrap: wrap; }
.planning-filter { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.planning-filter .input { min-width: 190px; }
.planning-chips { gap: 6px; }
.planning-card { padding: 0; overflow: hidden; }
.planning-days-tabs { display: none; }
.planning-scroll { max-height: calc(100vh - 290px); min-height: 420px; overflow: auto; overscroll-behavior: contain; }
.planning-grid {
  --slot: 64px;
  display: grid; grid-template-columns: 58px repeat(7, minmax(140px, 1fr));
  grid-template-rows: auto calc(var(--ore) * var(--slot));
  min-width: 1040px; position: relative;
}
.planning-corner, .planning-head { position: sticky; top: 0; z-index: 3; background: var(--surface); border-bottom: 1px solid var(--border); }
.planning-head { padding: 10px 12px; display: flex; flex-direction: column; gap: 1px; border-left: 1px solid var(--border); }
.planning-head strong { font-size: 13px; }
.planning-head small { font-size: 11.5px; color: var(--muted); }
.planning-head.is-today strong { color: var(--brand-strong); }
.planning-head.is-today::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--brand); }
.planning-hours { position: relative; grid-row: 2; }
.planning-hours span { position: absolute; top: calc(var(--y) * 100%); right: 8px; transform: translateY(-50%); font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.planning-hours span:first-child { transform: none; }
.planning-col { position: relative; grid-row: 2; border-left: 1px solid var(--border); }
.planning-col.is-today { background: color-mix(in oklab, var(--brand) 3.5%, transparent); }
.planning-line { position: absolute; left: 0; right: 0; top: calc(var(--y) * 100%); border-top: 1px dashed var(--border); }
.planning-now { position: absolute; left: -4px; right: 0; top: calc(var(--y) * 100%); z-index: 2; border-top: 2px solid var(--danger); pointer-events: none; }
.planning-now span { position: absolute; left: -1px; top: -6px; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); }
.lesson {
  --gap: 3px;
  position: absolute; z-index: 1; overflow: hidden;
  top: calc(var(--top) * 100% + 2px); height: calc(var(--h) * 100% - 4px);
  left: calc(var(--lane) / var(--lanes) * 100% + var(--gap)); width: calc(100% / var(--lanes) - var(--gap) * 2);
  display: flex; flex-direction: column; gap: 1px; padding: 6px 8px;
  border-radius: 9px; border-left: 3px solid var(--c);
  background: color-mix(in oklab, var(--c) 13%, var(--surface)); color: var(--text);
  font-size: 11.5px; line-height: 1.3;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), opacity .25s, filter .25s;
}
.lesson:hover { z-index: 4; transform: translateY(-1px) scale(1.02); box-shadow: var(--shadow-md); }
.lesson-time { font-weight: 650; color: color-mix(in oklab, var(--c) 70%, var(--text)); }
.lesson-name { font-size: 12.5px; font-weight: 640; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lesson-meta { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lesson-seats { display: inline-flex; align-items: center; gap: 3px; margin-top: auto; color: var(--text-2); font-weight: 560; }
.lesson.is-short { padding: 4px 7px; }
.lesson.is-short .lesson-meta, .lesson.is-short .lesson-seats { display: none; }
.lesson.is-hidden { pointer-events: none; filter: grayscale(1); }
.lesson.is-past { opacity: .55; }
.lesson.is-live { box-shadow: 0 0 0 2px var(--c), var(--shadow-sm); }
.planning-legend { display: flex; flex-wrap: wrap; gap: 8px 22px; font-size: 12.5px; padding: 0 4px; }
.planning-legend span { display: inline-flex; align-items: center; gap: 6px; }
.planning-now-sample { width: 18px; height: 0; border-top: 2px solid var(--danger); }

@media (max-width: 1100px) {
  .checkin { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .checkin-search-box { height: 54px; }
  .checkin-input { font-size: 16px; }
  .checkin-person { align-items: flex-start; }
  .avatar-xl, .avatar-photo-xl { width: 56px; height: 56px; border-radius: 18px; font-size: 19px; }
  .mini-bars { gap: 3px; }
  .plan-grid { grid-template-columns: 1fr 1fr; }
  .planning-days-tabs { display: flex; gap: 4px; padding: 8px; overflow-x: auto; border-bottom: 1px solid var(--border); }
  .planning-day-tab { flex: 1; min-width: 48px; height: 36px; border: 0; border-radius: var(--radius-sm); background: transparent; font-weight: 600; color: var(--muted); }
  .planning-day-tab.is-active { background: var(--brand); color: var(--on-brand); }
  .planning-grid { grid-template-columns: 50px minmax(0, 1fr); min-width: 0; }
  .planning-head, .planning-col { display: none; }
  .planning[data-giorno-attivo="1"] [data-giorno="1"], .planning[data-giorno-attivo="2"] [data-giorno="2"], .planning[data-giorno-attivo="3"] [data-giorno="3"],
  .planning[data-giorno-attivo="4"] [data-giorno="4"], .planning[data-giorno-attivo="5"] [data-giorno="5"], .planning[data-giorno-attivo="6"] [data-giorno="6"],
  .planning[data-giorno-attivo="7"] [data-giorno="7"],
  .planning[data-giorno-attivo="1"] [data-giorno-head="1"], .planning[data-giorno-attivo="2"] [data-giorno-head="2"], .planning[data-giorno-attivo="3"] [data-giorno-head="3"],
  .planning[data-giorno-attivo="4"] [data-giorno-head="4"], .planning[data-giorno-attivo="5"] [data-giorno-head="5"], .planning[data-giorno-attivo="6"] [data-giorno-head="6"],
  .planning[data-giorno-attivo="7"] [data-giorno-head="7"] { display: flex; }
  .planning[data-giorno-attivo] .planning-col { display: none; }
  .planning[data-giorno-attivo="1"] .planning-col[data-giorno="1"], .planning[data-giorno-attivo="2"] .planning-col[data-giorno="2"], .planning[data-giorno-attivo="3"] .planning-col[data-giorno="3"],
  .planning[data-giorno-attivo="4"] .planning-col[data-giorno="4"], .planning[data-giorno-attivo="5"] .planning-col[data-giorno="5"], .planning[data-giorno-attivo="6"] .planning-col[data-giorno="6"],
  .planning[data-giorno-attivo="7"] .planning-col[data-giorno="7"] { display: block; }
  .planning-filter .input { min-width: 0; }
  .planning-scroll { max-height: none; }
}

@media (prefers-reduced-motion: reduce) {
  .checkin-empty-art, .pulse-dot, .mini-bar-fill { animation: none; }
}
.today-done { padding: 0 12px 12px; }
.today-done summary { display: flex; align-items: center; gap: 6px; padding: 6px 10px; font-size: 12.5px; color: var(--muted); cursor: pointer; list-style: none; border-radius: var(--radius-sm); }
.today-done summary::-webkit-details-marker { display: none; }
.today-done summary:hover { background: var(--surface-2); }
.today-done summary .icon { transition: transform .2s var(--ease); }
.today-done[open] summary .icon { transform: rotate(90deg); }
.today-done .today-lessons { padding: 6px 0 0; }
.planning-grid { --slot: 74px; grid-template-columns: 58px repeat(7, minmax(168px, 1fr)); min-width: 1240px; }
.lesson.is-narrow { padding: 5px 5px 5px 6px; font-size: 10.5px; }
.lesson.is-narrow .lesson-name { white-space: normal; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; font-size: 11px; line-height: 1.25; }
.lesson.is-narrow .lesson-meta, .lesson.is-narrow .lesson-seats { display: none; }
.lesson.is-narrow:hover { z-index: 5; width: max(calc(100% / var(--lanes) - var(--gap) * 2), 150px); }
.checkin-result .grow, .checkin-sub .grow, .checkin-person .grow, .today-lesson .grow, .log-item .grow { flex: 1; min-width: 0; }
.plan-empty { grid-column: 1 / -1; }
.grid-stats-5 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
@media (max-width: 760px) {
  .planning-grid { grid-template-columns: 50px minmax(0, 1fr); min-width: 0; }
  .planning-day-tab { min-width: 0; padding: 0 4px; }
  .lesson.is-narrow:hover { width: calc(100% / var(--lanes) - var(--gap) * 2); }
}



/* =============================================================================
   Identità JEM Fitness: nero del sito (#000000 / #222222) e fucsia del logo (#e52784)
   ============================================================================= */

/* Sidebar nera, come il sito */
.sidebar, .sb-flyout {
  --surface: #000000;
  --surface-2: #1c1c1c;
  --surface-3: #2a2a2a;
  --text: #ffffff;
  --text-2: #d4d4d4;
  --muted: #9a9a9a;
  --faint: #6b6b6b;
  --border: rgba(255, 255, 255, .08);
  --border-strong: rgba(255, 255, 255, .14);
  --brand-soft: color-mix(in oklab, var(--brand) 22%, transparent);
  --brand-strong: color-mix(in oklab, var(--brand) 70%, #fff);
  color: var(--text);
}
.sidebar { background: #000000; border-right-color: #000000; }
.sidebar .sb-head { border-bottom-color: rgba(255, 255, 255, .08); }
.sidebar .sb-link.is-active { color: #fff; }
.sidebar .sb-link.is-active::before { background: var(--brand); }
.sidebar .brand-mark:has(img) img { filter: none; }

:root[data-theme="dark"] .avatar.tone-sala { background: linear-gradient(135deg, #3a3a3a, #1a1a1a); }
:root[data-theme="dark"] { --bg: #0a0a0a; }

/* ------------------------------------------------ Login: pannello visivo */
.auth-visual {
  background:
    radial-gradient(90% 70% at 0% 0%, rgba(229, 39, 132, .38) 0%, rgba(229, 39, 132, 0) 60%),
    linear-gradient(165deg, #222222 0%, #111111 45%, #000000 100%);
}
.auth-visual::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .045) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(120% 90% at 10% 10%, #000 20%, transparent 75%);
}
.auth-glow { position: absolute; inset: 0; z-index: -2; overflow: hidden; pointer-events: none; }
.auth-glow span { position: absolute; border-radius: 50%; filter: blur(90px); animation: deriva 20s ease-in-out infinite alternate; }
.auth-glow span:nth-child(1) { width: 440px; height: 440px; left: -160px; top: -140px; background: #e52784; opacity: .42; }
.auth-glow span:nth-child(2) { width: 360px; height: 360px; right: -140px; bottom: -140px; background: #e52784; opacity: .18; animation-duration: 26s; }
@keyframes deriva { from { transform: translate(0, 0) scale(1); } to { transform: translate(36px, 28px) scale(1.1); } }

.auth-brand > span:last-child { font-size: 15px; letter-spacing: -.01em; }
.auth-brand .brand-mark:has(img) { width: 76px; height: 46px; }
.auth-brand .brand-mark:has(img) img { width: 100%; height: 100%; object-fit: contain; filter: none; }
.auth-claim { max-width: 560px; }
.auth-eyebrow {
  display: inline-flex; align-items: center; gap: 8px; margin-bottom: 18px; padding: 6px 12px; border-radius: 999px;
  font-size: 11.5px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: #fff;
  background: rgba(229, 39, 132, .16); border: 1px solid rgba(229, 39, 132, .45);
}
.auth-eyebrow::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #e52784; box-shadow: 0 0 0 4px rgba(229, 39, 132, .25); }
.auth-claim h2 { font-size: clamp(32px, 3.4vw, 48px); line-height: 1.06; }
.auth-claim h2 .accento { color: #e52784; }
.auth-claim h2::after { content: ""; display: block; width: 64px; height: 4px; margin-top: 22px; border-radius: 4px; background: #e52784; }
.auth-claim p { color: #cccccc; margin-top: 18px; }
.auth-foot { color: #9a9a9a; }

/* Logo nel riquadro di accesso: il logo è orizzontale */
.auth-logo:has(img) { width: 150px; height: 86px; border-radius: 0; }
.auth-logo:has(img) img { width: 100%; height: 100%; object-fit: contain; filter: none; }

@media (max-width: 1023px) {
  .auth-visual { min-height: 0; padding: 22px 20px 20px; gap: 18px; }
  .auth-eyebrow, .auth-foot, .auth-claim h2::after { display: none; }
  .auth-claim h2 { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) { .auth-glow span { animation: none; } }
aside .brand-mark:has(img), .sidebar .brand-mark:has(img) { width: 58px; height: 34px; }

/* =============================================================================
   Prenotazioni delle lezioni
   ============================================================================= */
.booking-week { display: flex; align-items: center; gap: 8px; padding: 10px; margin-bottom: 16px; }
.booking-days { flex: 1; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.booking-day {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; border-radius: var(--radius);
  color: var(--text-2); text-decoration: none; border: 1px solid transparent; transition: background-color .15s, border-color .15s, color .15s;
}
.booking-day:hover { background: var(--surface-2); }
.booking-day-name { font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.booking-day-num { font-size: 20px; line-height: 1.1; }
.booking-day-count { font-size: 11px; color: var(--faint); }
.booking-day.is-past { opacity: .6; }
.booking-day.is-today .booking-day-num { color: var(--brand); }
.booking-day.is-active { background: var(--brand); border-color: var(--brand); color: #fff; opacity: 1; }
.booking-day.is-active .booking-day-name, .booking-day.is-active .booking-day-count, .booking-day.is-active .booking-day-num { color: #fff; }
.booking-today { margin-left: 4px; }

.booking-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 420px); gap: 16px; align-items: start; }
.booking-lessons { display: grid; gap: 10px; }
.booking-lesson {
  position: relative; display: grid; grid-template-columns: 74px minmax(0, 1fr) auto; align-items: center; gap: 14px;
  width: 100%; padding: 14px 16px 14px 18px; text-align: left; cursor: pointer; font: inherit; color: inherit;
  border-left: 4px solid var(--c, var(--brand));
  transition: box-shadow .2s, border-color .2s;
}
.booking-lesson:hover { box-shadow: var(--shadow-md); }
.booking-lesson.is-selected { box-shadow: 0 0 0 2px var(--c, var(--brand)), var(--shadow-md); }
.booking-lesson-time { display: flex; flex-direction: column; font-size: 18px; font-weight: 700; line-height: 1.1; }
.booking-lesson-time small { font-size: 12px; font-weight: 500; color: var(--muted); }
.booking-lesson-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.booking-lesson-body strong { font-size: 15px; }
.booking-lesson-body .muted { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.booking-meter { display: block; height: 6px; margin-top: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.booking-meter > span { display: block; height: 100%; width: calc(var(--q, 0) * 100%); border-radius: inherit; background: var(--c, var(--brand)); transition: width .5s var(--ease); }
.booking-lesson.is-full .booking-meter > span { background: var(--danger); }
.booking-lesson-seats { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.booking-lesson-seats strong { font-size: 22px; line-height: 1; }
.booking-lesson-seats strong small { font-size: 13px; color: var(--muted); font-weight: 500; }
.booking-wait { font-size: 11.5px; }

.booking-panel { position: sticky; top: calc(var(--topbar-h) + 24px); padding: 18px; max-height: calc(100vh - var(--topbar-h) - 48px); overflow-y: auto; }
.booking-panel-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 40px 12px; }
.booking-panel-art { width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.booking-panel-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding-bottom: 14px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.booking-panel-dot { width: 12px; height: 12px; border-radius: 4px; transform: rotate(45deg); }
.booking-panel-head h2 { font-size: 17px; }
.booking-panel-head p { font-size: 12.5px; }
.booking-panel-count { font-size: 26px; line-height: 1; }
.booking-panel-count small { font-size: 14px; color: var(--muted); font-weight: 500; }
.booking-add { position: relative; margin-bottom: 16px; }
.booking-add .label { display: block; margin-bottom: 6px; }
.booking-results {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 20; list-style: none; margin: 0; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); max-height: 300px; overflow-y: auto;
}
.booking-result { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: var(--radius-sm); background: none; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.booking-result:hover, .booking-result:focus-visible { background: var(--surface-2); }
.booking-result > span:nth-child(2) { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.booking-result small { font-size: 12px; }
.booking-past { display: flex; gap: 6px; align-items: center; font-size: 12.5px; margin-bottom: 14px; }
.booking-list-title { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 6px 0 8px; }
.booking-list { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 6px; }
.booking-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: var(--radius); background: var(--surface-2); }
.booking-item-name { display: flex; flex-direction: column; min-width: 0; }
.booking-item-name strong { font-size: 13.5px; display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.booking-item-name small { font-size: 11.5px; }
.booking-item-actions { display: flex; gap: 2px; }
.booking-item-actions .btn.is-on { color: var(--brand); background: var(--brand-soft); }
.booking-item.is-annullato { opacity: .6; }
.booking-item.is-annullato strong { text-decoration: line-through; }
.booking-pos { display: inline-grid; place-items: center; min-width: 20px; height: 20px; border-radius: 6px; background: var(--warning); color: #fff; font-size: 11px; }
.booking-none { padding: 10px; font-size: 13px; list-style: none; }
.booking-cancelled summary { cursor: pointer; font-size: 12.5px; color: var(--muted); padding: 4px 0 8px; }

@media (max-width: 1023px) {
  .booking-layout { grid-template-columns: 1fr; }
  .booking-panel { position: static; max-height: none; }
}
@media (max-width: 640px) {
  .booking-week { flex-wrap: wrap; }
  .booking-days { order: 3; flex-basis: 100%; gap: 3px; }
  .booking-day-count { display: none; }
  .booking-lesson { grid-template-columns: 56px minmax(0, 1fr); }
  .booking-lesson-seats { grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: space-between; }
  .booking-item { grid-template-columns: auto minmax(0, 1fr) auto; }
  .booking-item .badge { display: none; }
}

/* =============================================================================
   Rinnovi e solleciti
   ============================================================================= */
.renew-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.renew-tabs { display: flex; gap: 6px; flex-wrap: wrap; padding: 6px; margin-bottom: 14px; }
.renew-tab { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border: 0; border-radius: var(--radius-sm); background: none; font: inherit; font-weight: 600; color: var(--text-2); cursor: pointer; }
.renew-tab:hover { background: var(--surface-2); }
.renew-tab.is-active { background: var(--brand); color: #fff; }
.renew-tab .renew-count { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center; font-size: 12px; background: var(--surface-3); color: var(--text); }
.renew-tab.is-active .renew-count { background: rgba(255, 255, 255, .25); color: #fff; }
.renew-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.renew-item {
  display: grid; grid-template-columns: auto minmax(0, 1.4fr) minmax(0, 1fr) auto; gap: 14px; align-items: center;
  padding: 12px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs);
}
.renew-item.is-sollecitato { border-color: color-mix(in oklab, var(--success) 35%, transparent); }
.renew-who { display: flex; flex-direction: column; min-width: 0; }
.renew-who strong { font-size: 14px; }
.renew-who small, .renew-what small { font-size: 12px; color: var(--muted); }
.renew-what { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.renew-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.renew-note { font-size: 11.5px; color: var(--success); }
.renew-empty { padding: 40px 16px; text-align: center; }
@media (max-width: 860px) {
  .renew-item { grid-template-columns: auto minmax(0, 1fr); }
  .renew-what, .renew-actions { grid-column: 1 / -1; }
  .renew-actions { justify-content: flex-start; }
}

/* Righe ripetibili: celle compatte (es. orari settimanali di un corso) */
.repeater-cell { min-width: 0; }
.repeater-cell .input { padding-left: 9px; padding-right: 6px; min-width: 0; font-size: 13px; }
.repeater-cell select.input { padding-right: 22px; background-position: right 6px center; }
.repeater-cell input[type="time"].input { padding-right: 4px; }
.repeater-head, .repeater-row { gap: 6px; }
@media (min-width: 861px) { .renew-item { grid-template-columns: auto minmax(0, 1.3fr) minmax(0, 1fr) 330px; } }

/* =============================================================================
   Planning corsi (vista giorno + settimana)
   ============================================================================= */
.plan2-bar { display: flex; flex-direction: column; gap: 12px; padding: 12px; }
.plan2-week { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.plan2-days { flex: 1; min-width: 320px; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.plan2-day {
  display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 8px 4px;
  border: 1px solid transparent; border-radius: var(--radius); background: var(--surface-2);
  font: inherit; color: var(--text-2); cursor: pointer; transition: background-color .15s, color .15s, border-color .15s;
}
.plan2-day:hover { border-color: var(--border-strong); }
.plan2-day strong { font-size: 20px; line-height: 1.1; }
.plan2-day-name { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.plan2-day-count { font-size: 11px; color: var(--faint); }
.plan2-day-count::after { content: " lez."; }
.plan2-day.is-past { opacity: .65; }
.plan2-day.is-today strong { color: var(--brand); }
.plan2-day.is-active { background: var(--brand); border-color: var(--brand); color: #fff; opacity: 1; box-shadow: 0 8px 20px -10px var(--brand); }
.plan2-day.is-active strong, .plan2-day.is-active .plan2-day-name, .plan2-day.is-active .plan2-day-count { color: #fff; }
.plan2-views { margin-left: auto; }
.plan2-views button { display: inline-flex; align-items: center; gap: 6px; }
.plan2-filters { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-top: 12px; border-top: 1px solid var(--border); }
.plan2-filters .planning-chips { margin-left: auto; }

.plan2-title { display: flex; align-items: center; gap: 10px; font-size: 18px; margin: 4px 4px 12px; text-transform: capitalize; }
.plan2-none { display: flex; align-items: center; gap: 8px; padding: 24px; color: var(--muted); }
.plan2-slot { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 12px; margin-bottom: 12px; }
.plan2-hour { font-size: 15px; font-weight: 700; padding-top: 14px; color: var(--text-2); text-align: right; }
.plan2-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.plan2-card {
  position: relative; display: flex; flex-direction: column; gap: 4px; padding: 14px 16px 12px 18px;
  color: inherit; text-decoration: none; border-left: 4px solid var(--c, var(--brand));
  transition: box-shadow .2s, opacity .25s, filter .25s;
}
.plan2-card:hover { box-shadow: var(--shadow-md); }
.plan2-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.plan2-card-time { font-size: 12.5px; font-weight: 650; color: color-mix(in oklab, var(--c) 70%, var(--text)); }
.plan2-live { font-size: 11px; font-weight: 700; color: #fff; background: var(--danger); border-radius: 999px; padding: 2px 8px; }
.plan2-card-name { font-size: 15.5px; line-height: 1.25; }
.plan2-card-meta { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plan2-card-foot { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.plan2-card-foot .booking-meter { flex: 1; margin-top: 0; }
.plan2-card-seats { font-size: 13px; font-weight: 700; }
.plan2-card.is-full .booking-meter > span { background: var(--danger); }
.plan2-card.is-past { opacity: .55; }
.plan2-card.is-live { box-shadow: 0 0 0 2px var(--c), var(--shadow-md); }
.plan2-card.is-hidden { display: none; }

/* Griglia settimanale: intestazioni cliccabili e lezioni nascoste dai filtri attenuate */
.planning-head { font: inherit; color: inherit; text-align: left; cursor: pointer; border: 0; border-left: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.planning-head:hover strong { color: var(--brand); }
.planning-scroll { max-height: calc(100vh - 330px); }
.plan2 .lesson.is-hidden { opacity: .12; }

@media (max-width: 760px) {
  .plan2-views { display: none; }
  .plan2-days { min-width: 0; flex-basis: 100%; order: 3; gap: 3px; }
  .plan2-day { padding: 6px 2px; }
  .plan2-day strong { font-size: 16px; }
  .plan2-day-count { display: none; }
  .plan2-filters .planning-chips { margin-left: 0; }
  .plan2-slot { grid-template-columns: 1fr; gap: 6px; }
  .plan2-hour { text-align: left; padding-top: 0; }
  .plan2-cards { grid-template-columns: 1fr; }
}

/* Planning: calendario a sinistra, pannello giorni/vista/filtri a destra (comprimibile) */
.plan2 { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 16px; align-items: start; transition: grid-template-columns .35s cubic-bezier(.22, 1, .36, 1); }
.plan2[data-pannello="chiuso"] { grid-template-columns: minmax(0, 1fr) 72px; }
.plan2-main { grid-column: 1; grid-row: 1; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.plan2-side {
  grid-column: 2; grid-row: 1; position: sticky; top: calc(var(--topbar-h) + 28px);
  display: flex; flex-direction: column; gap: 12px; padding: 12px;
  max-height: calc(100vh - var(--topbar-h) - 56px); overflow-y: auto; overflow-x: hidden; scrollbar-width: thin;
}
.plan2-side-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.plan2-side-title { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; white-space: nowrap; }
.plan2-toggle .icon { transition: transform .3s; }
.plan2-week { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.plan2-week-label { font-weight: 650; font-size: 13.5px; white-space: nowrap; }
.plan2-today { justify-content: center; }
.plan2-days { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.plan2-day {
  display: grid; grid-template-columns: 38px 30px minmax(0, 1fr); align-items: center; gap: 8px; text-align: left;
  padding: 8px 10px; border-radius: var(--radius); background: transparent;
}
.plan2-day:hover { background: var(--surface-2); border-color: transparent; }
.plan2-day strong { font-size: 17px; }
.plan2-day-count { font-size: 12px; color: var(--muted); text-align: right; }
.plan2-day-count::after { content: none; }
.plan2-extra { display: flex; flex-direction: column; gap: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.plan2-views { margin: 0; display: grid; grid-template-columns: 1fr 1fr; }
.plan2-views button { justify-content: center; }
.plan2-filters { flex-direction: column; align-items: stretch; padding-top: 0; border-top: 0; gap: 8px; }
.plan2-filters .planning-filter { width: 100%; }
.plan2-filters .planning-filter .input { min-width: 0; width: 100%; }
.plan2-filters .planning-chips { margin: 4px 0 0; flex-wrap: wrap; }
.plan2-side :focus-visible { outline-offset: 1px; }

/* Compresso: solo i giorni (sigla + numero) e il pulsante per riaprire */
.plan2[data-pannello="chiuso"] .plan2-side { padding: 10px 8px; align-items: center; }
.plan2[data-pannello="chiuso"] .plan2-side-title,
.plan2[data-pannello="chiuso"] .plan2-week-label,
.plan2[data-pannello="chiuso"] .plan2-day-count,
.plan2[data-pannello="chiuso"] .plan2-extra,
.plan2[data-pannello="chiuso"] .plan2-today span { display: none; }
.plan2[data-pannello="chiuso"] .plan2-side-head { justify-content: center; }
.plan2[data-pannello="chiuso"] .plan2-toggle .icon { transform: rotate(180deg); }
.plan2[data-pannello="chiuso"] .plan2-week { flex-direction: column; }
.plan2[data-pannello="chiuso"] .plan2-today { width: 40px; padding: 0; }
.plan2[data-pannello="chiuso"] .plan2-day { grid-template-columns: 1fr; justify-items: center; gap: 0; padding: 6px 2px; width: 52px; }
.plan2[data-pannello="chiuso"] .plan2-day-name { font-size: 10px; }
.plan2[data-pannello="chiuso"] .plan2-day strong { font-size: 16px; }

@media (max-width: 1023px) {
  .plan2, .plan2[data-pannello="chiuso"] { grid-template-columns: minmax(0, 1fr); }
  .plan2-side { grid-row: 1; grid-column: 1; position: static; max-height: none; }
  .plan2-main { grid-row: 2; }
  .plan2-toggle { display: none; }
  .plan2[data-pannello="chiuso"] .plan2-extra, .plan2[data-pannello="chiuso"] .plan2-side-title,
  .plan2[data-pannello="chiuso"] .plan2-week-label, .plan2[data-pannello="chiuso"] .plan2-today span { display: revert; }
  .plan2-days, .plan2[data-pannello="chiuso"] .plan2-days { flex-direction: row; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .plan2-day, .plan2[data-pannello="chiuso"] .plan2-day { grid-template-columns: 1fr; justify-items: center; gap: 0; padding: 6px 2px; width: auto; background: var(--surface-2); }
  .plan2-day-count { display: none; }
  .plan2[data-pannello="chiuso"] .plan2-side { align-items: stretch; }
}

/* Planning: giorni della settimana nell'intestazione della pagina */
.plan2-header { flex-wrap: wrap; }
.plan2-headweek { flex: 1 1 520px; display: flex; align-items: center; justify-content: center; gap: 6px; min-width: 0; }
.plan2-headweek .plan2-days { flex: 0 1 auto; display: grid; grid-template-columns: repeat(7, minmax(52px, 64px)); gap: 6px; min-width: 0; }
.plan2-headweek .plan2-day {
  display: flex; flex-direction: column; align-items: center; gap: 0; width: auto; padding: 7px 4px 6px;
  border-radius: 14px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); text-align: center;
}
.plan2-headweek .plan2-day:hover { border-color: var(--border-strong); background: var(--surface-3); }
.plan2-headweek .plan2-day strong { font-size: 18px; line-height: 1.1; }
.plan2-headweek .plan2-day-name { font-size: 10px; }
.plan2-headweek .plan2-day-count { font-size: 10.5px; color: var(--faint); text-align: center; }
.plan2-headweek .plan2-day-count::after { content: " lez."; }
.plan2-headweek .plan2-day.is-active { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 10px 24px -10px var(--brand); }
.plan2-headweek .plan2-day.is-active strong, .plan2-headweek .plan2-day.is-active .plan2-day-name, .plan2-headweek .plan2-day.is-active .plan2-day-count { color: #fff; }
.plan2-arrow {
  display: inline-grid; place-items: center; min-width: 34px; height: 34px; padding: 0 10px; border-radius: 10px;
  color: var(--text-2); text-decoration: none; font-weight: 600; font-size: 13px; border: 1px solid var(--border);
}
.plan2-arrow:hover { background: var(--surface-2); }

/* Sull'intestazione nera della grafica JEM */
.ui-jem .plan2-headweek .plan2-day { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .1); color: rgba(255, 255, 255, .85); }
.ui-jem .plan2-headweek .plan2-day:hover { background: rgba(255, 255, 255, .12); }
.ui-jem .plan2-headweek .plan2-day-name { color: rgba(255, 255, 255, .55); }
.ui-jem .plan2-headweek .plan2-day-count { color: rgba(255, 255, 255, .45); }
.ui-jem .plan2-headweek .plan2-day.is-today:not(.is-active) strong { color: var(--brand); }
.ui-jem .plan2-headweek .plan2-day.is-past:not(.is-active) { opacity: .6; }
.ui-jem .plan2-header .plan2-arrow { color: #fff; border-color: rgba(255, 255, 255, .14); background: rgba(255, 255, 255, .06); }
.ui-jem .plan2-header .plan2-arrow:hover { background: rgba(255, 255, 255, .14); }

/* Pannello laterale: ora solo vista e filtri; compresso resta il pulsante */
.plan2[data-pannello="chiuso"] { grid-template-columns: minmax(0, 1fr) 52px; }
.plan2[data-pannello="chiuso"] .plan2-side { padding: 8px; }

@media (max-width: 1100px) {
  .plan2-headweek { order: 3; flex-basis: 100%; justify-content: flex-start; }
}
@media (max-width: 640px) {
  .plan2-headweek .plan2-days { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; flex: 1; }
  .plan2-headweek .plan2-day-count { display: none; }
  .plan2-headweek .plan2-day { padding: 6px 2px; }
}
.ui-jem .plan2-headweek .plan2-day.is-active { background: var(--brand); border-color: var(--brand); color: #fff; opacity: 1; box-shadow: 0 10px 26px -8px var(--brand); }
.ui-jem .plan2-headweek .plan2-day.is-active strong, .ui-jem .plan2-headweek .plan2-day.is-active .plan2-day-name, .ui-jem .plan2-headweek .plan2-day.is-active .plan2-day-count { color: #fff; }

/* Planning: titolo | giorni | Corsi e orari + Prenotazioni sulla stessa riga */
@media (min-width: 1181px) {
  .plan2-header { flex-wrap: nowrap; }
  .plan2-header .page-title { flex: 0 1 auto; min-width: 0; }
  .plan2-header .page-title h1 { white-space: nowrap; }
  .plan2-headweek { flex: 1 1 auto; justify-content: flex-end; }
  .plan2-headweek .plan2-days { grid-template-columns: repeat(7, minmax(44px, 60px)); }
  .plan2-header .page-actions { flex: none; flex-wrap: nowrap; margin-left: 8px; }
}
@media (min-width: 1101px) and (max-width: 1500px) {
  .plan2-header .page-sub { display: none; }
  .plan2-header .page-actions .btn { padding-left: 12px; padding-right: 12px; }
}

/* Planning: il titolo non viene mai coperto dai giorni */
@media (min-width: 1181px) {
  .plan2-header { gap: 20px; }
  .plan2-header .page-title { flex: none; }
  .plan2-headweek { min-width: 0; gap: 4px; }
  .plan2-headweek .plan2-days { grid-template-columns: repeat(7, minmax(38px, 60px)); gap: 4px; }
}
@media (min-width: 1101px) and (max-width: 1500px) {
  .ui-jem .plan2-header h1 { font-size: 26px; }
  .plan2-header .page-icon { width: 46px; height: 46px; border-radius: 15px; }
}
@media (min-width: 1101px) and (max-width: 1360px) {
  .plan2-headweek .plan2-day-count { display: none; }
  .plan2-header .page-actions .btn .icon { display: none; }
}

/* Planning settimana: calendario grande, a tutta altezza, trascinabile col mouse */
@media (min-width: 761px) {
  .plan2 .planning-scroll { height: var(--alt-calendario, calc(100vh - 230px)); max-height: none; min-height: 360px; cursor: grab; user-select: none; -webkit-user-select: none; scrollbar-width: thin; }
  .plan2 .planning-scroll.is-dragging { cursor: grabbing; }
  .plan2 .planning-scroll.is-dragging .lesson { pointer-events: none; }
  .plan2 .planning-grid { --slot: 104px; grid-template-columns: 64px repeat(7, minmax(230px, 1fr)); min-width: 1680px; }
  .plan2 .lesson { font-size: 12.5px; padding: 7px 9px; }
  .plan2 .lesson-name { font-size: 13.5px; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .plan2 .planning-corner { position: sticky; left: 0; z-index: 5; }
  .plan2 .planning-hours { position: sticky; left: 0; z-index: 4; background: var(--surface); border-right: 1px solid var(--border); }
  .plan2 .lesson img, .plan2 .lesson { -webkit-user-drag: none; }
}
.plan2-drag-hint { display: inline-flex; align-items: center; gap: 6px; }

/* Planning: giorni e pulsanti nel pannello destro; intestazione che svanisce */
.plan2[data-pannello="chiuso"] { grid-template-columns: minmax(0, 1fr) 72px; }
.plan2[data-pannello="chiuso"] .plan2-side { padding: 10px 8px; }
.plan2-actions { display: grid; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border); }
.plan2-actions .btn { justify-content: center; width: 100%; }
.plan2-side .plan2-day.is-today:not(.is-active) strong { color: var(--brand); }

/* Planning: intestazione sovrapposta al calendario (non occupa spazio), poi svanisce */
.plan2-overlay { position: relative; height: 0; z-index: 40; }
.plan2-overlay .plan2-header { margin: 0 !important; max-height: none !important; transition: opacity .7s ease, transform .7s ease; box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .55); }
.plan2-overlay .plan2-header.is-svanito { opacity: 0; transform: translateY(-10px) scale(.985); pointer-events: none; }

/* Pulsante per comprimere/espandere il pannello: ben riconoscibile dalle frecce della settimana */
.plan2-toggle { width: 36px; height: 36px; border-radius: 11px; background: var(--brand-soft) !important; color: var(--brand) !important; border: 1px solid color-mix(in oklab, var(--brand) 30%, transparent) !important; }
.plan2-toggle:hover { background: var(--brand) !important; color: #fff !important; }
.plan2-toggle .icon { transform: scaleX(-1); transition: none; }
.plan2-toggle .icona-apri { display: none; }
.plan2[data-pannello="chiuso"] .plan2-toggle .icona-chiudi { display: none; }
.plan2[data-pannello="chiuso"] .plan2-toggle .icona-apri { display: block; }
.plan2[data-pannello="chiuso"] .plan2-toggle .icon { transform: scaleX(-1); }
.plan2[data-pannello="chiuso"] .plan2-side-head { width: 100%; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.plan2[data-pannello="chiuso"] .plan2-side { scrollbar-width: none; }
.plan2[data-pannello="chiuso"] .plan2-side::-webkit-scrollbar { display: none; }

/* L intestazione copre solo il calendario, non il pannello di destra */
@media (min-width: 1024px) {
  .plan2-overlay { margin-right: calc(280px + 16px); transition: margin-right .35s cubic-bezier(.22, 1, .36, 1); }
  [data-page]:has(.plan2[data-pannello="chiuso"]) .plan2-overlay { margin-right: calc(72px + 16px); }
}

/* Planning su desktop: la pagina resta ferma, scorrono solo il calendario, l elenco del giorno e il pannello */
@media (min-width: 1024px) {
  html.pagina-fissa, html.pagina-fissa body { height: 100%; overflow: hidden; overscroll-behavior: none; }
  html.pagina-fissa .content { padding-bottom: 0; }
  html.pagina-fissa .plan2 { align-items: stretch; }
  html.pagina-fissa .plan2-main { gap: 0; }
  html.pagina-fissa .plan2 .planning-scroll { height: var(--alt-calendario, calc(100vh - 140px)); }
  html.pagina-fissa .plan2-agenda { height: var(--alt-calendario, calc(100vh - 140px)); overflow-y: auto; overscroll-behavior: contain; padding-right: 6px; scrollbar-width: thin; }
  html.pagina-fissa .plan2-side { position: static; height: var(--alt-calendario, calc(100vh - 140px)); max-height: none; }
  html.pagina-fissa .planning-legend { display: none; }
}

/* Scheda abbonamento: segna una rata come pagata */
.rata-pagata { margin-right: 6px; }
.rata-form-riga td { background: color-mix(in oklab, var(--brand) 4%, var(--surface)) !important; }
.rata-form { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.rata-campo { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.rata-campo .input { min-width: 150px; }
.rata-azioni { display: flex; gap: 6px; margin-left: auto; }

/* Nuovo abbonamento: card con il listino modificabile */
.module-card-plus { padding: 0; gap: 0; }
.module-main { display: flex; flex-direction: column; gap: 10px; padding: 24px 24px 18px; color: inherit; text-decoration: none; flex: 1; }
.module-main p { color: var(--muted); }
.module-main .badge { align-self: flex-start; }
.module-main .alert { display: flex; gap: 8px; align-items: center; font-size: 13px; padding: 10px 12px; border-radius: var(--radius); background: var(--tone-soft, var(--surface-2)); }
.module-listino { display: flex; flex-direction: column; gap: 8px; padding: 14px 18px 18px 24px; background: var(--surface-2); border-top: 1px solid var(--border); }
.module-listino-head { display: flex; align-items: center; justify-content: space-between; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.module-listino-add { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 650; letter-spacing: 0; text-transform: none; color: var(--brand); background: var(--brand-soft); text-decoration: none; }
.module-listino-add:hover { background: var(--brand); color: #fff; }
.module-listino-vuoto { font-size: 13px; margin: 0; }
.module-card-plus .module-rate li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 6px; }
.module-card-plus .module-rate li > span.num { color: var(--text); font-weight: 600; }
.module-rate-nome { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.module-card-plus .module-rate .btn { width: 28px; height: 28px; color: var(--muted); }
.module-card-plus .module-rate .btn:hover { color: var(--brand); background: var(--brand-soft); }

/* Celle con scadenza e azione rapida (es. Registra quota annuale) */
.cell-scadenza { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cell-azione { height: 28px; padding: 0 10px; font-size: 12px; gap: 4px; }

/* Pulsante "Cestina" nella scheda abbonamento */
.btn-cestina { --btn-bg: color-mix(in oklab, var(--danger) 10%, var(--surface)); --btn-fg: var(--danger); --btn-bd: color-mix(in oklab, var(--danger) 30%, transparent); }
.btn-cestina:hover { --btn-bg: var(--danger); --btn-fg: #fff; --btn-bd: var(--danger); }
.ui-jem .page-header .btn-cestina { --btn-bg: rgba(239, 68, 68, .14) !important; --btn-fg: #fca5a5 !important; --btn-bd: rgba(239, 68, 68, .4) !important; }
.ui-jem .page-header .btn-cestina:hover { --btn-bg: #ef4444 !important; --btn-fg: #fff !important; }

/* Colonna dei pulsanti (modifica, cestina) sempre visibile a destra, anche se la tabella scorre */
.table td.cell-actions-td { position: sticky; right: 0; z-index: 2; background: var(--surface); box-shadow: -10px 0 14px -10px rgba(0, 0, 0, .18); }
.table thead th:last-child:has(> .sr-only) { position: sticky; right: 0; z-index: 2; background: var(--bg); }
.table tbody tr:hover td.cell-actions-td { background: color-mix(in oklab, var(--brand) 5%, var(--surface)); }
.cell-actions .btn.is-danger { color: var(--danger); }
.cell-actions .btn.is-danger:hover { background: color-mix(in oklab, var(--danger) 12%, transparent); }

/* Elenchi (anagrafiche, listini, quote…): colonne compatte, niente spazi vuoti né barra orizzontale */
.registry-table { width: 100%; }
.registry-table .cell-main { min-width: 150px; }
.registry-table th, .registry-table td { padding-left: 10px; padding-right: 10px; }
.registry-table td { white-space: normal; }
.registry-table td .num, .registry-table td .badge, .registry-table td .mono, .registry-table td.num { white-space: nowrap; }
.registry-table td:not(.cell-main):not(.cell-actions-td) { max-width: 260px; }
.registry-table td.cell-main, .registry-table td.cell-main * { white-space: normal; }
.registry-table td.cell-main small, .registry-table td.cell-main .cell-sub { display: block; max-width: 320px; }
.registry-table td.cell-actions-td { width: 1%; }
@media (max-width: 1500px) { .registry-table th, .registry-table td { padding-left: 8px; padding-right: 8px; font-size: 13px; } .registry-table .badge { font-size: 11.5px; } }
@media (max-width: 1320px) { .registry-table th, .registry-table td { padding-left: 6px; padding-right: 6px; } .registry-table .cell-main { min-width: 130px; } .registry-table .cell-actions .btn { width: 28px; } }

/* Badge lunghi (es. accordi delle convenzioni) vanno a capo invece di allargare la tabella */
.registry-table td .badge { white-space: normal; height: auto; min-height: 22px; line-height: 1.3; padding-top: 3px; padding-bottom: 3px; text-align: left; }
.registry-table td:has(> .badge + .badge), .registry-table td:has(.badge ~ .badge) { max-width: 240px; }

/* Archivio abbonamenti: colonne compatte, testo dell abbonamento a capo */
.archive-table:not(.registry-table) th, .archive-table:not(.registry-table) td { padding-left: 9px; padding-right: 9px; }
.archive-table:not(.registry-table) td:nth-child(5) { max-width: 220px; white-space: normal; }
.archive-table:not(.registry-table) td:nth-child(5) * { white-space: normal; }
.archive-table:not(.registry-table) td:nth-child(4) { min-width: 150px !important; }
@media (max-width: 1360px) { .archive-table:not(.registry-table) th, .archive-table:not(.registry-table) td { padding-left: 6px; padding-right: 6px; } .archive-table:not(.registry-table) .cell-actions .btn { width: 28px; } }

/* Archivio: nome dell abbonamento pulito (pallino della tipologia + testo), niente pillole schiacciate */
.abb-nome { display: flex; align-items: flex-start; gap: 9px; min-width: 0; }
.abb-dot { flex: none; width: 9px; height: 9px; margin-top: 6px; border-radius: 50%; background: var(--tone, var(--brand)); box-shadow: 0 0 0 3px var(--tone-soft, var(--brand-soft)); }
.abb-testo { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.abb-testo strong { font-size: 13.5px; font-weight: 650; color: var(--text); }
.abb-testo small { font-size: 12px; color: var(--muted); }

/* Archivio: la ricerca ha sempre spazio per leggere "Cerca…"; se manca posto va sotto le schede */
.archive-tools { flex: 1 1 520px; }
.archive-search { flex: 1 1 260px; min-width: 240px; max-width: none; }

/* Scadenzario: le 5 card sulla stessa riga da notebook in su */
@media (min-width: 1100px) {
  .grid-stats.grid-stats-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
  .grid-stats-5 .stat { padding: 18px 16px 16px; }
  .grid-stats-5 .stat-label { font-size: 13px; }
  .grid-stats-5 .stat-icon { width: 36px; height: 36px; }
  .ui-jem .grid-stats-5 .stat-value { font-size: 34px; }
  .grid-stats-5 .stat-meta { font-size: 12px; }
}

/* Dashboard: lezioni di oggi alte quanto i grafici; sotto, tre riquadri affiancati */
.dashboard-trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 16px; align-items: start; }
@media (max-width: 1100px) { .dashboard-trio { grid-template-columns: minmax(0, 1fr); } }
@media (min-width: 1181px) {
  .dashboard-grid { align-items: stretch; }
  .dashboard-side { position: relative; min-height: 360px; }
  .dashboard-lezioni { position: absolute; inset: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
  .dashboard-lezioni > .card-head { position: sticky; top: 0; z-index: 2; background: var(--surface); }
}
