/* ============================================================================
   JETTULIO DESIGN SYSTEM — COMPONENTI BASE (prefisso .ds-)
   ----------------------------------------------------------------------------
   Consuma esclusivamente i token di tokens.css. Nessuna collisione con le
   classi legacy: le schermate esistenti non cambiano finche' non adottano
   queste classi (Mossa 2+). Tutte le animazioni rispettano
   prefers-reduced-motion e durano 120-260ms.
   ========================================================================== */

/* ---- Base tipografica dei componenti ------------------------------------ */
.ds-root {
  font-family: var(--ds-font-sans);
  font-size: var(--ds-text-base);
  font-weight: var(--ds-weight-regular);
  line-height: var(--ds-leading-normal);
  color: var(--ds-text);
  background: var(--ds-bg);
  -webkit-font-smoothing: antialiased;
}
.ds-tabular { font-variant-numeric: tabular-nums; font-feature-settings: var(--ds-numeric); }

.ds-h1 { font-size: var(--ds-text-2xl); font-weight: var(--ds-weight-bold); line-height: var(--ds-leading-tight); margin: 0; letter-spacing: -.01em; }
.ds-h2 { font-size: var(--ds-text-xl); font-weight: var(--ds-weight-bold); line-height: var(--ds-leading-snug); margin: 0; letter-spacing: -.005em; }
.ds-h3 { font-size: var(--ds-text-lg); font-weight: var(--ds-weight-semibold); line-height: var(--ds-leading-snug); margin: 0; }
.ds-body { font-size: var(--ds-text-base); }
.ds-muted { color: var(--ds-text-secondary); }
.ds-label {
  font-size: var(--ds-text-xs); font-weight: var(--ds-weight-bold);
  letter-spacing: var(--ds-tracking-label); text-transform: uppercase;
  color: var(--ds-text-secondary);
}
.ds-kpi-number {
  font-size: var(--ds-text-kpi); font-weight: var(--ds-weight-bold);
  line-height: var(--ds-leading-tight); letter-spacing: -.02em;
  font-variant-numeric: tabular-nums; font-feature-settings: var(--ds-numeric);
}
.ds-kpi-number.ds-kpi-lg { font-size: var(--ds-text-kpi-lg); }

/* ---- Bottoni ------------------------------------------------------------- */
.ds-btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--ds-space-2);
  min-height: 40px; padding: 8px 16px;
  border-radius: var(--ds-radius-sm);
  border: 1px solid transparent;
  font-family: var(--ds-font-sans); font-size: var(--ds-text-base);
  font-weight: var(--ds-weight-semibold); line-height: 1.2;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color var(--ds-dur-fast) var(--ds-ease),
              border-color var(--ds-dur-fast) var(--ds-ease),
              color var(--ds-dur-fast) var(--ds-ease),
              transform var(--ds-dur-fast) var(--ds-ease),
              box-shadow var(--ds-dur-fast) var(--ds-ease);
}
.ds-btn:focus-visible { outline: 3px solid var(--ds-focus-ring); outline-offset: 2px; }
.ds-btn:active { transform: scale(.97); }
.ds-btn:disabled, .ds-btn[aria-disabled="true"] {
  opacity: .5; cursor: not-allowed; transform: none; pointer-events: none;
}
.ds-btn--sm { min-height: 32px; padding: 4px 12px; font-size: var(--ds-text-sm); }

.ds-btn--primary { background: var(--ds-brand-solid); color: var(--ds-on-brand); }
.ds-btn--primary:hover { background: var(--ds-brand-solid-hover); box-shadow: var(--ds-shadow-1); }

.ds-btn--secondary {
  background: var(--ds-surface); color: var(--ds-text);
  border-color: var(--ds-border-strong);
}
.ds-btn--secondary:hover { border-color: var(--ds-text-secondary); background: var(--ds-surface-subtle); }

.ds-btn--ghost { background: transparent; color: var(--ds-brand-text); }
.ds-btn--ghost:hover { background: var(--ds-brand-soft); }

.ds-btn--danger { background: transparent; color: var(--ds-danger); border-color: var(--ds-danger-border); }
.ds-btn--danger:hover { background: var(--ds-danger-surface); border-color: var(--ds-danger); }

/* Stato di caricamento: spinner al posto del contenuto, larghezza stabile. */
.ds-btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.ds-btn.is-loading::after {
  content: ""; position: absolute; inset: 0; margin: auto;
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-top-color: transparent;
  color: var(--ds-on-brand);
  animation: ds-spin .7s linear infinite;
}
.ds-btn--secondary.is-loading::after, .ds-btn--ghost.is-loading::after { color: var(--ds-text-secondary); }
.ds-btn--danger.is-loading::after { color: var(--ds-danger); }
@keyframes ds-spin { to { transform: rotate(360deg); } }

/* ---- Campi: input, select, textarea -------------------------------------- */
.ds-field { display: grid; gap: var(--ds-space-1); }
.ds-field > label { font-size: var(--ds-text-sm); font-weight: var(--ds-weight-semibold); color: var(--ds-text); }
.ds-field > small { font-size: var(--ds-text-xs); color: var(--ds-text-secondary); }
.ds-field .ds-field-error { font-size: var(--ds-text-xs); font-weight: var(--ds-weight-semibold); color: var(--ds-danger); }

.ds-input, .ds-select, .ds-textarea {
  box-sizing: border-box; width: 100%; min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--ds-border-strong);
  border-radius: var(--ds-radius-sm);
  background: var(--ds-surface); color: var(--ds-text);
  font-family: var(--ds-font-sans); font-size: var(--ds-text-base);
  transition: border-color var(--ds-dur-fast) var(--ds-ease),
              box-shadow var(--ds-dur-fast) var(--ds-ease);
}
.ds-input::placeholder, .ds-textarea::placeholder { color: var(--ds-text-faint); }
.ds-input:focus-visible, .ds-select:focus-visible, .ds-textarea:focus-visible {
  outline: none; border-color: var(--ds-brand);
  box-shadow: 0 0 0 3px var(--ds-focus-ring);
}
.ds-input[aria-invalid="true"] { border-color: var(--ds-danger); }
.ds-input--numeric { text-align: right; font-variant-numeric: tabular-nums; font-feature-settings: var(--ds-numeric); }
.ds-select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ds-text-secondary) 50%),
                    linear-gradient(135deg, var(--ds-text-secondary) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px; background-repeat: no-repeat;
  padding-right: 34px;
}
.ds-textarea { min-height: 80px; resize: vertical; }

/* ---- Checkbox e toggle ---------------------------------------------------- */
.ds-check {
  display: inline-flex; align-items: center; gap: var(--ds-space-2);
  font-size: var(--ds-text-base); cursor: pointer; min-height: 28px;
}
.ds-check input[type="checkbox"] {
  appearance: none; margin: 0; width: 18px; height: 18px; flex: 0 0 auto;
  border: 1.5px solid var(--ds-border-strong); border-radius: 5px;
  background: var(--ds-surface); cursor: pointer; display: grid; place-content: center;
  transition: background-color var(--ds-dur-fast) var(--ds-ease),
              border-color var(--ds-dur-fast) var(--ds-ease);
}
.ds-check input[type="checkbox"]::before {
  content: ""; width: 10px; height: 10px; transform: scale(0);
  transition: transform var(--ds-dur-fast) var(--ds-ease-out);
  background: var(--ds-on-brand);
  clip-path: polygon(14% 44%, 0 60%, 40% 100%, 100% 16%, 84% 4%, 38% 71%);
}
.ds-check input[type="checkbox"]:checked { background: var(--ds-brand-solid); border-color: var(--ds-brand-solid); }
.ds-check input[type="checkbox"]:checked::before { transform: scale(1); }
.ds-check input[type="checkbox"]:focus-visible { outline: 3px solid var(--ds-focus-ring); outline-offset: 2px; }

.ds-switch {
  display: inline-flex; align-items: center; gap: var(--ds-space-2);
  cursor: pointer; min-height: 28px; font-size: var(--ds-text-base);
}
.ds-switch input {
  appearance: none; margin: 0; width: 38px; height: 22px; flex: 0 0 auto;
  border-radius: var(--ds-radius-full);
  background: var(--ds-surface-inset); border: 1px solid var(--ds-border-strong);
  position: relative; cursor: pointer;
  transition: background-color var(--ds-dur-base) var(--ds-ease), border-color var(--ds-dur-base) var(--ds-ease);
}
.ds-switch input::before {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--ds-text-secondary);
  transition: transform var(--ds-dur-base) var(--ds-ease-out), background-color var(--ds-dur-base) var(--ds-ease);
}
.ds-switch input:checked { background: var(--ds-brand-solid); border-color: var(--ds-brand-solid); }
.ds-switch input:checked::before { transform: translateX(16px); background: #fff; }
.ds-switch input:focus-visible { outline: 3px solid var(--ds-focus-ring); outline-offset: 2px; }

/* ---- Card ----------------------------------------------------------------- */
.ds-card {
  background: var(--ds-surface);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-lg);
  padding: var(--ds-space-5);
  box-shadow: var(--ds-shadow-1);
}
.ds-card--interactive {
  cursor: pointer; display: block; color: inherit; text-decoration: none;
  transition: border-color var(--ds-dur-base) var(--ds-ease),
              box-shadow var(--ds-dur-base) var(--ds-ease),
              transform var(--ds-dur-base) var(--ds-ease);
}
.ds-card--interactive:hover {
  border-color: var(--ds-border-strong);
  box-shadow: var(--ds-shadow-2); transform: translateY(-1px);
  text-decoration: none;
}
.ds-card--interactive:focus-visible { outline: 3px solid var(--ds-focus-ring); outline-offset: 2px; }

.ds-card--kpi { display: grid; gap: var(--ds-space-2); min-width: 0; }
.ds-card--kpi .ds-kpi-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--ds-space-2); }
.ds-kpi-delta {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: var(--ds-text-sm); font-weight: var(--ds-weight-bold);
  font-variant-numeric: tabular-nums;
}
.ds-kpi-delta.is-up { color: var(--ds-success); }
.ds-kpi-delta.is-down { color: var(--ds-danger); }

/* Comparsa a cascata delle card al caricamento della pagina. */
.ds-cascade > * { animation: ds-rise var(--ds-dur-slow) var(--ds-ease-out) backwards; }
.ds-cascade > :nth-child(1) { animation-delay: 0ms; }
.ds-cascade > :nth-child(2) { animation-delay: 40ms; }
.ds-cascade > :nth-child(3) { animation-delay: 80ms; }
.ds-cascade > :nth-child(4) { animation-delay: 120ms; }
.ds-cascade > :nth-child(5) { animation-delay: 160ms; }
.ds-cascade > :nth-child(6) { animation-delay: 200ms; }
.ds-cascade > :nth-child(n+7) { animation-delay: 240ms; }
@keyframes ds-rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ---- Tabelle -------------------------------------------------------------- */
.ds-table-wrap {
  overflow: auto; max-width: 100%;
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-md);
  background: var(--ds-surface);
}
.ds-table { width: 100%; border-collapse: collapse; font-size: var(--ds-text-sm); }
.ds-table th, .ds-table td {
  padding: 8px 12px; text-align: left;
  border-bottom: 1px solid var(--ds-border);
}
.ds-table thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--ds-surface-subtle);
  font-size: var(--ds-text-xs); font-weight: var(--ds-weight-bold);
  letter-spacing: var(--ds-tracking-label); text-transform: uppercase;
  color: var(--ds-text-secondary); white-space: nowrap;
}
.ds-table tbody tr { transition: background-color var(--ds-dur-fast) var(--ds-ease); }
.ds-table tbody tr:hover { background: var(--ds-surface-subtle); }
.ds-table tbody tr:last-child td { border-bottom: none; }
.ds-table .ds-num, .ds-table th.ds-num {
  text-align: right; font-variant-numeric: tabular-nums;
  font-feature-settings: var(--ds-numeric); white-space: nowrap;
}
.ds-table .is-positive { color: var(--ds-success); font-weight: var(--ds-weight-semibold); }
.ds-table .is-negative { color: var(--ds-danger); font-weight: var(--ds-weight-semibold); }

/* ---- Badge e chip ---------------------------------------------------------- */
.ds-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 10px; border-radius: var(--ds-radius-full);
  font-size: var(--ds-text-xs); font-weight: var(--ds-weight-bold);
  letter-spacing: .02em; white-space: nowrap;
  border: 1px solid var(--ds-border);
  background: var(--ds-surface-subtle); color: var(--ds-text-secondary);
}
.ds-badge--success { background: var(--ds-success-surface); border-color: var(--ds-success-border); color: var(--ds-success); }
.ds-badge--danger { background: var(--ds-danger-surface); border-color: var(--ds-danger-border); color: var(--ds-danger); }
.ds-badge--warning { background: var(--ds-warning-surface); border-color: var(--ds-warning-border); color: var(--ds-warning); }
.ds-badge--info { background: var(--ds-info-surface); border-color: var(--ds-info-border); color: var(--ds-info); }
.ds-badge--brand { background: var(--ds-brand-soft); border-color: var(--ds-brand-border); color: var(--ds-brand-text); }

/* Chip prodotto: pallino nel colore fisso del prodotto + nome. */
.ds-chip-product {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: var(--ds-radius-full);
  border: 1px solid var(--ds-border);
  background: var(--ds-surface); color: var(--ds-text);
  font-size: var(--ds-text-xs); font-weight: var(--ds-weight-bold);
}
.ds-chip-product::before {
  content: ""; width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto;
  background: var(--ds-product-color, var(--ds-text-faint));
}

/* ---- Tooltip (solo CSS, via data-ds-tooltip) ------------------------------- */
.ds-tooltip-host { position: relative; }
.ds-tooltip-host::after {
  content: attr(data-ds-tooltip);
  position: absolute; bottom: calc(100% + 8px); left: 50%;
  transform: translateX(-50%) translateY(2px);
  z-index: var(--ds-z-tooltip);
  max-width: 280px; width: max-content; padding: 6px 10px;
  border-radius: var(--ds-radius-sm);
  background: var(--ds-chart-tooltip-bg); color: var(--ds-chart-tooltip-text);
  font-size: var(--ds-text-xs); font-weight: var(--ds-weight-medium);
  line-height: var(--ds-leading-snug); text-transform: none; letter-spacing: 0;
  box-shadow: var(--ds-shadow-2);
  pointer-events: none;
  /* display:none quando non attivo: uno pseudo-elemento solo trasparente
     occuperebbe comunque layout e creava overflow orizzontale a bordo pagina. */
  display: none;
}
.ds-tooltip-host:hover::after, .ds-tooltip-host:focus-visible::after {
  display: block;
  animation: ds-tooltip-in var(--ds-dur-fast) var(--ds-ease) 250ms both;
}
@keyframes ds-tooltip-in {
  from { opacity: 0; transform: translateX(-50%) translateY(2px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ---- Modali e drawer (elemento nativo <dialog>) ---------------------------- */
.ds-modal, .ds-drawer {
  border: 1px solid var(--ds-border);
  background: var(--ds-surface-elevated); color: var(--ds-text);
  box-shadow: var(--ds-shadow-3); padding: 0;
}
.ds-modal::backdrop, .ds-drawer::backdrop { background: var(--ds-backdrop); }
.ds-modal {
  width: min(560px, calc(100vw - 32px));
  max-height: min(84vh, 720px);
  border-radius: var(--ds-radius-lg);
  margin: auto;
}
.ds-modal[open] { animation: ds-modal-in var(--ds-dur-slow) var(--ds-ease-out); }
@keyframes ds-modal-in {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to { opacity: 1; transform: none; }
}
.ds-drawer {
  width: min(420px, 92vw); height: 100dvh; max-height: 100dvh;
  margin: 0 0 0 auto; border-radius: 0;
  border-top: none; border-bottom: none; border-right: none;
}
.ds-drawer[open] { animation: ds-drawer-in var(--ds-dur-slow) var(--ds-ease-out); }
@keyframes ds-drawer-in {
  from { transform: translateX(40px); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.ds-dialog-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--ds-space-3); padding: var(--ds-space-4) var(--ds-space-5);
  border-bottom: 1px solid var(--ds-border);
}
.ds-dialog-body { padding: var(--ds-space-5); overflow: auto; }
.ds-dialog-foot {
  display: flex; justify-content: flex-end; gap: var(--ds-space-2);
  padding: var(--ds-space-4) var(--ds-space-5);
  border-top: 1px solid var(--ds-border);
}
.ds-dialog-close {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border: none; border-radius: var(--ds-radius-sm);
  background: transparent; color: var(--ds-text-secondary);
  font-size: 18px; cursor: pointer;
  transition: background-color var(--ds-dur-fast) var(--ds-ease), color var(--ds-dur-fast) var(--ds-ease);
}
.ds-dialog-close:hover { background: var(--ds-surface-subtle); color: var(--ds-text); }

/* ---- Toast ----------------------------------------------------------------- */
.ds-toast-region {
  position: fixed; right: var(--ds-space-4);
  bottom: calc(var(--ds-space-4) + env(safe-area-inset-bottom, 0px));
  z-index: var(--ds-z-toast);
  display: grid; gap: var(--ds-space-2); justify-items: end;
}
.ds-toast[hidden] { display: none; }
.ds-toast {
  display: flex; align-items: center; gap: var(--ds-space-3);
  min-width: 260px; max-width: min(380px, calc(100vw - 32px));
  padding: 10px 14px;
  border: 1px solid var(--ds-border);
  border-left: 4px solid var(--ds-info);
  border-radius: var(--ds-radius-md);
  background: var(--ds-surface-elevated); color: var(--ds-text);
  font-size: var(--ds-text-base); box-shadow: var(--ds-shadow-2);
  animation: ds-toast-in var(--ds-dur-slow) var(--ds-ease-out);
}
.ds-toast--success { border-left-color: var(--ds-success); }
.ds-toast--danger { border-left-color: var(--ds-danger); }
.ds-toast--warning { border-left-color: var(--ds-warning); }
.ds-toast.is-leaving { animation: ds-toast-out var(--ds-dur-base) var(--ds-ease-in) forwards; }
@keyframes ds-toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes ds-toast-out { to { opacity: 0; transform: translateY(6px); } }

/* ---- Skeleton di caricamento ----------------------------------------------- */
.ds-skeleton {
  position: relative; overflow: hidden;
  border-radius: var(--ds-radius-sm);
  background: var(--ds-surface-subtle);
  min-height: 14px; color: transparent !important; user-select: none;
}
.ds-skeleton::after {
  content: ""; position: absolute; inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent,
    color-mix(in srgb, var(--ds-text) 7%, transparent), transparent);
  animation: ds-shimmer 1.4s var(--ds-ease) infinite;
}
@keyframes ds-shimmer { to { transform: translateX(100%); } }
.ds-skeleton--text { height: 14px; }
.ds-skeleton--title { height: 22px; width: 40%; }
.ds-skeleton--kpi { height: 38px; width: 55%; }
.ds-skeleton--block { min-height: 120px; border-radius: var(--ds-radius-md); }

/* ---- Tab e selettore di periodo -------------------------------------------- */
.ds-tabs {
  display: flex; gap: var(--ds-space-1);
  border-bottom: 1px solid var(--ds-border);
}
.ds-tab {
  appearance: none; border: none; background: transparent; cursor: pointer;
  padding: 9px 14px; margin-bottom: -1px;
  font-family: var(--ds-font-sans); font-size: var(--ds-text-base);
  font-weight: var(--ds-weight-semibold); color: var(--ds-text-secondary);
  border-bottom: 2px solid transparent;
  transition: color var(--ds-dur-fast) var(--ds-ease), border-color var(--ds-dur-fast) var(--ds-ease);
}
.ds-tab:hover { color: var(--ds-text); }
.ds-tab[aria-selected="true"], .ds-tab.is-active {
  color: var(--ds-brand-text); border-bottom-color: var(--ds-brand);
}
.ds-tab:focus-visible { outline: 3px solid var(--ds-focus-ring); outline-offset: -2px; border-radius: var(--ds-radius-sm); }

/* Selettore di periodo: gruppo segmentato compatto (7g / 30g / 12m ...). */
.ds-segmented {
  display: inline-flex; padding: 3px; gap: 2px;
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-sm);
  background: var(--ds-surface-inset);
}
.ds-segmented button {
  appearance: none; border: none; cursor: pointer;
  padding: 5px 12px; min-height: 30px;
  border-radius: calc(var(--ds-radius-sm) - 2px);
  background: transparent; color: var(--ds-text-secondary);
  font-family: var(--ds-font-sans); font-size: var(--ds-text-sm);
  font-weight: var(--ds-weight-semibold);
  transition: background-color var(--ds-dur-fast) var(--ds-ease), color var(--ds-dur-fast) var(--ds-ease),
              box-shadow var(--ds-dur-fast) var(--ds-ease);
}
.ds-segmented button:hover { color: var(--ds-text); }
.ds-segmented button[aria-pressed="true"], .ds-segmented button.is-active {
  background: var(--ds-surface); color: var(--ds-text); box-shadow: var(--ds-shadow-1);
}
.ds-segmented button:focus-visible { outline: 3px solid var(--ds-focus-ring); outline-offset: 1px; }

/* ---- Empty state ------------------------------------------------------------ */
.ds-empty {
  display: grid; justify-items: center; gap: var(--ds-space-2);
  padding: var(--ds-space-10) var(--ds-space-5);
  text-align: center; color: var(--ds-text-secondary);
}
.ds-empty .ds-empty-icon {
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-content: center;
  background: var(--ds-surface-subtle); color: var(--ds-text-faint);
  font-size: 20px;
}
.ds-empty strong { color: var(--ds-text); font-size: var(--ds-text-md); }
.ds-empty p { margin: 0; font-size: var(--ds-text-sm); max-width: 42ch; }

/* ---- Selettore tema nell'header --------------------------------------------
   Tre stati: chiaro (sole), scuro (luna), automatico (meta' e meta').
   Le tre icone convivono nel bottone; e' visibile solo quella dello stato
   attivo, pilotata da data-theme su <html>. */
.ds-theme-toggle .ds-icon-theme-light,
.ds-theme-toggle .ds-icon-theme-dark,
.ds-theme-toggle .ds-icon-theme-auto { display: none; }
html[data-theme="light"] .ds-theme-toggle .ds-icon-theme-light { display: block; }
html[data-theme="dark"] .ds-theme-toggle .ds-icon-theme-dark { display: block; }
html[data-theme="auto"] .ds-theme-toggle .ds-icon-theme-auto,
html:not([data-theme]) .ds-theme-toggle .ds-icon-theme-auto { display: block; }

/* ---- Riduzione del movimento ------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  .ds-cascade > * { animation: none; }
  .ds-modal[open], .ds-drawer[open], .ds-toast { animation: none; }
  .ds-skeleton::after { animation: none; }
  .ds-btn, .ds-btn:active { transform: none; transition: none; }
  .ds-card--interactive, .ds-card--interactive:hover { transform: none; }
}

/* ---- Vista ingrandita dei grafici (chart_zoom.js) ----------------------------------------
   Il pannello del grafico viene SPOSTATO qui dentro con tutti i suoi
   controlli e ripristinato alla chiusura: nessun clone, stato condiviso. */
dialog.chart-zoom-dialog {
  width: min(1500px, 96vw); max-width: 96vw;
  height: min(94vh, 1000px); max-height: 94vh;
  padding: 0; border: 1px solid var(--ds-border, #d5d9df);
  border-radius: var(--ds-radius-lg, 14px);
  background: var(--ds-bg, #f4f6f8); color: var(--ds-text, #1f2933);
  flex-direction: column; overflow: hidden;
}
/* Il display va dichiarato SOLO da aperto: un display incondizionato
   vincerebbe sul display:none nativo del dialog chiuso, che resterebbe
   visibile a intercettare i click (stessa lezione della regola [hidden]). */
dialog.chart-zoom-dialog[open] { display: flex; }
dialog.chart-zoom-dialog::backdrop { background: var(--ds-backdrop, rgba(15, 18, 22, .55)); }
.chart-zoom-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--ds-border, #d5d9df);
  background: var(--ds-surface, #fff);
}
.chart-zoom-head strong { font-size: var(--ds-text-md, 15px); }
.chart-zoom-close {
  min-width: 44px; min-height: 44px; border: 1px solid var(--ds-border, #d5d9df);
  border-radius: 10px; background: var(--ds-surface, #fff);
  color: var(--ds-text, #1f2933); font-size: 16px; cursor: pointer;
}
.chart-zoom-close:hover { border-color: var(--ds-brand-border, #e10712); }
.chart-zoom-body { flex: 1; overflow: auto; padding: 14px 16px 18px; }
.chart-zoom-body > .panel, .chart-zoom-body > [data-sales-panel] { margin: 0; }
@media (max-width: 760px) {
  dialog.chart-zoom-dialog {
    width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh;
    border: none; border-radius: 0; margin: 0;
  }
  .chart-zoom-body { padding: 10px 10px calc(14px + env(safe-area-inset-bottom, 0px)); }
}
