/* =============================================================================
   Luna Dash · Redesign v1.27 · Design System
   Token + componenti vanilla portati da brand Luna (site design/projects/equity)
   Brand: dark-first, industrial-green accent unico, bone-white fg.
   ============================================================================= */

/* ------ TOKENS ----------------------------------------------------------- */

:root {
  /* Color · sorgente brand · v1.27.1: verde più acceso (Pat 21/05 mattina) */
  --c-obsidian:     #0B0D0E;
  --c-graphite:     #16191B;
  --c-graphite-hi:  #1C2023;
  --c-titanium:     #9EA4A6;
  --c-green:        #7fcc79;       /* verde più vibrante, ancora "industrial" */
  --c-green-hi:     #9bdb95;       /* hover/focus */
  --c-green-dim:    #4ea84a;       /* per gradient/depth */
  --c-green-soft:   rgba(127, 204, 121, 0.13);
  --c-green-glow:   rgba(127, 204, 121, 0.40);
  --c-green-pulse:  rgba(127, 204, 121, 0.22);
  --c-bone:         #F2F0EA;
  --c-bone-mid:     #D8D5CC;
  --c-border:       #1F2326;
  --c-border-hi:    #2A2F33;

  /* Color · semantici Luna */
  --bg:            var(--c-obsidian);
  --bg-elevated:   var(--c-graphite);
  --bg-elev-2:     var(--c-graphite-hi);
  --fg:            var(--c-bone);
  --fg-secondary:  var(--c-bone-mid);
  --fg-muted:      var(--c-titanium);
  --fg-dim:        #5a5f63;       /* placeholder, low-importance */
  --border:        var(--c-border);
  --border-hi:     var(--c-border-hi);
  --primary:       var(--c-green);
  --primary-hi:    var(--c-green-hi);
  --primary-soft:  var(--c-green-soft);
  --primary-glow:  var(--c-green-glow);
  --primary-fg:    var(--c-bone);
  --focus-ring:    var(--c-green);

  /* Status semantici (mantenuti per leggibilità ticket/log) */
  --success:       #6f9876;
  --success-soft:  rgba(111, 152, 118, 0.13);
  --warning:       #b88a4a;
  --warning-soft:  rgba(184, 138, 74, 0.13);
  --danger:        #b46666;
  --danger-soft:   rgba(180, 102, 102, 0.13);
  --info:          #6e8aa0;
  --info-soft:     rgba(110, 138, 160, 0.13);

  /* Typography */
  --font-sans: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, 'SF Mono', 'Cascadia Mono', Menlo, monospace;

  --fs-wordmark:  16px;
  --fs-display:   clamp(2.5rem, 5vw + 1rem, 4rem);
  --fs-h1:        28px;
  --fs-h2:        22px;
  --fs-h3:        17px;
  --fs-body:      13px;
  --fs-body-lg:   14px;
  --fs-eyebrow:   11px;
  --fs-caption:   12px;
  --fs-mono:      12.5px;
  --fs-kpi:       30px;
  --fs-kpi-sm:    20px;

  --lh-tight:     1.1;
  --lh-snug:      1.3;
  --lh-base:      1.5;
  --lh-loose:     1.7;

  --ls-wordmark:  0.4em;
  --ls-eyebrow:   0.16em;
  --ls-display:  -0.02em;
  --ls-headline: -0.01em;
  --ls-mono:      0;
  --ls-caps:      0.08em;

  /* Spacing · 8px grid */
  --s-xs:   4px;
  --s-sm:   8px;
  --s-md:  16px;
  --s-lg:  24px;
  --s-xl:  32px;
  --s-2xl: 48px;
  --s-3xl: 80px;
  --s-4xl: 128px;

  /* Radius */
  --r-xs:  4px;
  --r-sm:  6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 18px;

  /* Motion */
  --ease:        cubic-bezier(0.22, 1, 0.36, 1);
  --dur-hover:   200ms;
  --dur-page:    250ms;
  --dur-enter:   800ms;
  --dur-breathe: 4s;

  /* Layout */
  --sidebar-w:  220px;
  --topbar-h:   56px;

  /* Z-index */
  --z-sidebar: 30;
  --z-topbar:  40;
  --z-drawer:  60;
  --z-modal:   70;
  --z-palette: 80;
  --z-toast:   90;
  --z-tooltip: 100;
}

/* ---- LIGHT THEME · v1.27.2 ---------------------------------------------
   Coerente col brand: bg = bone-white (mai #fff puro), fg = obsidian,
   accent verde scurito per contrasto AA sul background chiaro.
   ----------------------------------------------------------------------- */
[data-theme="light"] {
  --bg:            #ECEDE4;       /* leggera tinta sage sul bone-white */
  --bg-elevated:   #F5F4ED;       /* card · cream con velo verde */
  --bg-elev-2:     #E2E2D6;
  --bg-elev-3:     #D5D6C7;
  --fg:            #0B0D0E;
  --fg-secondary:  #2D3B30;       /* testo secondario tonalizzato verde-scuro */
  --fg-muted:      #5D6F60;       /* muted con tinta verde */
  --fg-dim:        #94A095;
  --border:        #CBD2C2;       /* bordo sage chiaro */
  --border-hi:     #9DAE94;       /* bordo verde più carico */
  --primary:       #2f7a3a;       /* verde profondo · AA su cream · piu' presente */
  --primary-hi:    #4a9152;
  --primary-soft:  rgba(47, 122, 58, 0.18);
  --primary-glow:  rgba(47, 122, 58, 0.40);
  --primary-fg:    #F2F0EA;
  --focus-ring:    #2f7a3a;
  --success:       #2f7a3a;
  --success-soft:  rgba(47, 122, 58, 0.18);
  --warning:       #a8742d;
  --warning-soft:  rgba(168, 116, 45, 0.14);
  --danger:        #a04848;
  --danger-soft:   rgba(160, 72, 72, 0.14);
  --info:          #4a6680;
  --info-soft:     rgba(74, 102, 128, 0.14);
}
[data-theme="light"] .heatmap-cell.lv1 { background: rgba(47, 122, 58, 0.22); }
[data-theme="light"] .heatmap-cell.lv2 { background: rgba(47, 122, 58, 0.45); }
[data-theme="light"] .heatmap-cell.lv3 { background: rgba(47, 122, 58, 0.70); }
[data-theme="light"] .heatmap-cell.lv4 { background: rgba(47, 122, 58, 0.95); }
[data-theme="light"] .legend-cell.lv1 { background: rgba(47, 122, 58, 0.22); }
[data-theme="light"] .legend-cell.lv2 { background: rgba(47, 122, 58, 0.45); }
[data-theme="light"] .legend-cell.lv3 { background: rgba(47, 122, 58, 0.70); }
[data-theme="light"] .legend-cell.lv4 { background: rgba(47, 122, 58, 0.95); }

/* Accent verde più presente in light: sidebar attiva, status pill, bordi card hover */
[data-theme="light"] .nav-item.active {
  background: rgba(47, 122, 58, 0.14);
  color: var(--primary);
}
[data-theme="light"] .status-pill {
  background: rgba(47, 122, 58, 0.16);
  border-color: var(--primary);
  color: var(--primary);
}
[data-theme="light"] .bar-fill {
  background: linear-gradient(90deg, #4a9152, #2f7a3a);
}
[data-theme="light"] .luna-orb {
  background: var(--primary);
  box-shadow: 0 0 12px rgba(47, 122, 58, 0.45);
}
[data-theme="light"] .kpi-value.is-primary {
  text-shadow: 0 0 24px rgba(47, 122, 58, 0.35);
}
[data-theme="light"] .card:hover,
[data-theme="light"] .kpi:hover {
  border-color: var(--border-hi);
  box-shadow:
    0 1px 0 0 rgba(47, 122, 58, 0.20) inset,
    0 16px 36px -22px rgba(47, 122, 58, 0.45);
}
[data-theme="light"] .topbar {
  background: rgba(242, 240, 234, 0.88);
}
[data-theme="light"] ::-webkit-scrollbar-thumb { background: var(--border-hi); }
[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: var(--fg-muted); }
[data-theme="light"] .modal,
[data-theme="light"] .drawer,
[data-theme="light"] .palette {
  box-shadow: 0 24px 60px -16px rgba(11, 13, 14, 0.25);
}
[data-theme="light"] .overlay {
  background: rgba(11, 13, 14, 0.35);
}
[data-theme="light"] .palette-backdrop {
  background: rgba(242, 240, 234, 0.75);
}
[data-theme="light"] html { color-scheme: light; }

/* Icon toggle theme — moon shown when dark active, sun when light active */
.theme-icon-sun { display: none; }
.theme-icon-moon { display: inline; }
[data-theme="light"] .theme-icon-sun { display: inline; }
[data-theme="light"] .theme-icon-moon { display: none; }

/* ------ RESET ------------------------------------------------------------ */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html {
  background: var(--bg);
  color: var(--fg);
  color-scheme: dark;
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-base);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}
body { min-height: 100vh; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; padding: 0; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; margin: 0; padding: 0; }
::selection { background: var(--primary); color: var(--primary-fg); }
:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: 2px;
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-hi); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--fg-muted); }

/* ------ TYPOGRAPHY UTILITIES --------------------------------------------- */

.t-wordmark {
  font-size: var(--fs-wordmark);
  font-weight: 300;
  letter-spacing: var(--ls-wordmark);
  text-transform: uppercase;
  line-height: 1;
}
.t-display {
  font-size: var(--fs-display);
  font-weight: 400;
  letter-spacing: var(--ls-display);
  line-height: var(--lh-tight);
}
.t-h1 { font-size: var(--fs-h1); font-weight: 500; letter-spacing: var(--ls-headline); line-height: var(--lh-tight); }
.t-h2 { font-size: var(--fs-h2); font-weight: 500; letter-spacing: var(--ls-headline); line-height: var(--lh-snug); }
.t-h3 { font-size: var(--fs-h3); font-weight: 500; line-height: var(--lh-snug); }
.t-body { font-size: var(--fs-body); }
.t-body-lg { font-size: var(--fs-body-lg); line-height: var(--lh-loose); }
.t-eyebrow {
  font-size: var(--fs-eyebrow);
  font-weight: 500;
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  color: var(--primary);
}
.t-eyebrow-muted {
  font-size: var(--fs-eyebrow);
  font-weight: 500;
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  color: var(--fg-muted);
}
.t-caption {
  font-size: var(--fs-caption);
  color: var(--fg-muted);
  line-height: var(--lh-snug);
}
.t-mono {
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  font-variant-numeric: tabular-nums;
}
.t-mono-sm { font-family: var(--font-mono); font-size: 11px; font-variant-numeric: tabular-nums; }
.t-secondary { color: var(--fg-secondary); }
.t-muted { color: var(--fg-muted); }
.t-primary { color: var(--primary); }

/* ------ APP LAYOUT ------------------------------------------------------- */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ------ SIDEBAR ---------------------------------------------------------- */

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--bg);
  border-right: 1px solid var(--border);
  padding: var(--s-xl) 0 var(--s-lg);
  display: flex;
  flex-direction: column;
  gap: var(--s-2xl);
  z-index: var(--z-sidebar);
  overflow-y: auto;
}
.sidebar-brand {
  padding: 0 var(--s-lg);
  display: flex;
  align-items: center;
  gap: var(--s-sm);
}
.sidebar-brand .t-wordmark {
  color: var(--fg);
  font-size: var(--fs-wordmark);
}
.sidebar-brand .luna-orb {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 12px var(--primary-glow);
  animation: orb-breathe var(--dur-breathe) ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes orb-breathe {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.55; transform: scale(1.15); }
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 0 var(--s-sm);
}
.sidebar-section + .sidebar-section { margin-top: var(--s-md); }
.sidebar-section-head {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-dim);
  padding: 0 var(--s-md) var(--s-sm);
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  font-size: 12.5px;
  color: var(--fg-muted);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: color var(--dur-hover) var(--ease), background var(--dur-hover) var(--ease);
}
.nav-item:hover { color: var(--fg-secondary); background: var(--bg-elevated); }
.nav-item.active {
  color: var(--primary);
  background: var(--primary-soft);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 18px;
  background: var(--primary);
  border-radius: 0 2px 2px 0;
  box-shadow: 0 0 8px var(--primary-glow);
}
.nav-item .ico { width: 15px; height: 15px; opacity: 0.85; flex-shrink: 0; }
.nav-item.active .ico { opacity: 1; }
.nav-item-meta {
  margin-left: auto;
  font-size: 10px;
  color: var(--fg-dim);
  font-family: var(--font-mono);
}

.sidebar-foot {
  margin-top: auto;
  padding: 0 var(--s-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--fg-muted);
}
.sidebar-foot .avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 500;
  color: var(--primary);
}

/* ------ TOPBAR ----------------------------------------------------------- */

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

.topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-topbar);
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--s-xl);
  background: rgba(11, 13, 14, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--fg);
  letter-spacing: var(--ls-headline);
}
.topbar-actions { display: flex; gap: var(--s-sm); align-items: center; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  background: var(--primary-soft);
  border: 1px solid var(--border-hi);
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  color: var(--primary);
  font-family: var(--font-mono);
}
.status-pill .dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 8px var(--primary-glow);
  animation: orb-breathe 2.4s ease-in-out infinite;
}

.tb-search {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 6px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 12px;
  color: var(--fg-muted);
  cursor: pointer;
  transition: border-color var(--dur-hover) var(--ease);
  font-family: var(--font-mono);
}
.tb-search:hover { border-color: var(--border-hi); color: var(--fg-secondary); }
.tb-search .kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
  color: var(--fg-muted);
}

.tb-icon-btn {
  width: 32px; height: 32px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-muted);
  transition: color var(--dur-hover) var(--ease), border-color var(--dur-hover) var(--ease);
}
.tb-icon-btn:hover { color: var(--fg); border-color: var(--border); }
.tb-icon-btn .ico { width: 16px; height: 16px; }

/* ------ PAGE ------------------------------------------------------------- */

.page {
  flex: 1;
  padding: var(--s-xl) var(--s-xl) var(--s-3xl);
  max-width: 1440px;
  width: 100%;
}
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s-md);
  margin-bottom: var(--s-xl);
  flex-wrap: wrap;
}
.page-head-left .t-eyebrow-muted { margin-bottom: 6px; display: block; }
.page-head-actions { display: flex; gap: var(--s-sm); }

/* ------ GRID ------------------------------------------------------------- */

.grid { display: grid; gap: var(--s-md); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-2-1 { grid-template-columns: 2fr 1fr; }
.grid-1-2 { grid-template-columns: 1fr 2fr; }
@media (max-width: 960px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-2-1, .grid-1-2 { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ------ CARD ------------------------------------------------------------- */

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--s-lg);
  transition: border-color var(--dur-hover) var(--ease);
}
.card:hover { border-color: var(--border-hi); }
.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-md);
  margin-bottom: var(--s-md);
}
.card-title { font-size: 13px; font-weight: 500; color: var(--fg); }
.card-meta { font-size: 11px; color: var(--fg-muted); font-family: var(--font-mono); }
.card-body { display: flex; flex-direction: column; gap: var(--s-sm); }
.card-divider {
  height: 1px;
  background: var(--border);
  margin: var(--s-md) calc(var(--s-lg) * -1);
}

/* ------ KPI TILE --------------------------------------------------------- */

.kpi {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--s-lg);
  display: flex;
  flex-direction: column;
  gap: var(--s-md);
  transition: border-color var(--dur-hover) var(--ease);
  position: relative;
  overflow: hidden;
}
.kpi:hover { border-color: var(--border-hi); }
.kpi-label {
  font-size: var(--fs-eyebrow);
  font-weight: 500;
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  color: var(--fg-muted);
}
.kpi-value {
  font-family: var(--font-mono);
  font-size: var(--fs-kpi);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  color: var(--fg);
  line-height: 1.05;
  letter-spacing: 0.01em;
  display: flex;
  align-items: baseline;
  gap: 2px;
}
.kpi-value.is-primary { color: var(--primary); }
.kpi-value .suffix { font-size: 18px; opacity: 0.7; margin-left: 2px; }
.kpi-meta { font-size: 11.5px; color: var(--fg-muted); font-family: var(--font-mono); }
.kpi-meta .delta { color: var(--primary); margin-left: 6px; }
.kpi-meta .delta.neg { color: var(--danger); }

/* ------ BUTTON ----------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: 12.5px;
  font-weight: 500;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background var(--dur-hover) var(--ease), border-color var(--dur-hover) var(--ease), color var(--dur-hover) var(--ease);
  white-space: nowrap;
}
.btn .ico { width: 14px; height: 14px; }
.btn-primary {
  background: var(--primary);
  color: var(--primary-fg);
  border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-hi); border-color: var(--primary-hi); }
.btn-secondary {
  background: transparent;
  color: var(--fg);
  border-color: var(--border-hi);
}
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }
.btn-ghost {
  background: transparent;
  color: var(--fg-muted);
  border-color: transparent;
}
.btn-ghost:hover { color: var(--fg); background: var(--bg-elevated); }
.btn-sm { padding: 5px 10px; font-size: 11.5px; }
.btn-lg { padding: 11px 18px; font-size: 13.5px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ------ BADGE / CHIP ----------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: var(--r-xs);
  background: var(--bg-elev-2);
  color: var(--fg-muted);
  font-family: var(--font-mono);
}
.badge-primary { background: var(--primary-soft); color: var(--primary); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger  { background: var(--danger-soft);  color: var(--danger); }
.badge-info    { background: var(--info-soft);    color: var(--info); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  font-size: 11.5px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--fg-secondary);
  background: var(--bg-elevated);
  transition: border-color var(--dur-hover) var(--ease), color var(--dur-hover) var(--ease);
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.active { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }

/* ------ INPUT ------------------------------------------------------------ */

.field { display: flex; flex-direction: column; gap: 6px; }
.field-label {
  font-size: 11.5px;
  color: var(--fg-secondary);
  letter-spacing: 0.02em;
}
.input, .select, .textarea {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 9px 12px;
  font-size: 13px;
  color: var(--fg);
  width: 100%;
  transition: border-color var(--dur-hover) var(--ease);
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); }
.input::placeholder { color: var(--fg-dim); }

/* ------ TABLE ------------------------------------------------------------ */

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table thead th {
  text-align: left;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  color: var(--fg-muted);
  padding: var(--s-sm) var(--s-md);
  border-bottom: 1px solid var(--border);
  background: transparent;
  position: sticky;
  top: 0;
  z-index: 1;
}
.table tbody td {
  padding: 11px var(--s-md);
  border-bottom: 1px solid var(--border);
  color: var(--fg-secondary);
  vertical-align: middle;
}
.table tbody tr { transition: background var(--dur-hover) var(--ease); }
.table tbody tr:hover { background: var(--bg-elevated); }
.table tbody tr:hover td { color: var(--fg); }
.table .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; text-align: right; }
.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-md);
  margin-bottom: var(--s-md);
  flex-wrap: wrap;
}
.table-filters { display: flex; gap: var(--s-sm); align-items: center; flex-wrap: wrap; }

/* ------ KANBAN ----------------------------------------------------------- */

.kanban {
  display: grid;
  grid-template-columns: repeat(5, minmax(220px, 1fr));
  gap: var(--s-md);
  overflow-x: auto;
  padding-bottom: var(--s-sm);
}
.kanban-col {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--s-md);
  min-height: 480px;
  display: flex;
  flex-direction: column;
  gap: var(--s-sm);
}
.kanban-col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--s-sm);
}
.kanban-col-title {
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  color: var(--fg-muted);
}
.kanban-col-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-muted);
}
.kanban-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: var(--s-md);
  cursor: grab;
  transition: border-color var(--dur-hover) var(--ease);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.kanban-card:hover { border-color: var(--border-hi); }
.kanban-card:active { cursor: grabbing; }
.kanban-card .title { font-size: 13px; color: var(--fg); font-weight: 500; }
.kanban-card .meta { font-size: 11px; color: var(--fg-muted); display: flex; justify-content: space-between; }
.kanban-card .value { font-family: var(--font-mono); color: var(--primary); font-size: 11.5px; }

/* ------ TREND HEATMAP ---------------------------------------------------- */

.heatmap-row {
  display: grid;
  grid-template-columns: 160px 1fr 140px;
  align-items: center;
  gap: var(--s-md);
  padding: 6px 0;
}
.heatmap-row + .heatmap-row { border-top: 1px solid var(--border); }
.heatmap-row:hover {
  background: var(--bg-elev-2);
  margin: 0 calc(var(--s-sm) * -1);
  padding: 6px var(--s-sm);
  border-radius: var(--r-xs);
}
.heatmap-label {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg);
}
.heatmap-cells {
  display: grid;
  grid-template-columns: repeat(30, 1fr);
  gap: 2px;
}
.heatmap-cell {
  aspect-ratio: 1;
  border-radius: 2px;
  background: var(--bg);
  border: 1px solid var(--border);
  position: relative;
  transition: transform 120ms var(--ease);
}
.heatmap-cell:hover { transform: scale(1.5); z-index: 2; border-color: var(--primary); }
.heatmap-cell[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: 130%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-elev-2);
  color: var(--fg);
  border: 1px solid var(--border-hi);
  border-radius: var(--r-xs);
  padding: 4px 8px;
  font-size: 10.5px;
  font-family: var(--font-mono);
  white-space: nowrap;
  pointer-events: none;
  z-index: 10;
}
.heatmap-cell.lv1 { background: rgba(127, 204, 121, 0.20); border-color: transparent; }
.heatmap-cell.lv2 { background: rgba(127, 204, 121, 0.40); border-color: transparent; }
.heatmap-cell.lv3 { background: rgba(127, 204, 121, 0.65); border-color: transparent; }
.heatmap-cell.lv4 { background: rgba(127, 204, 121, 0.92); border-color: transparent; }
.heatmap-stats {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-muted);
  text-align: right;
}
.heatmap-stats .v { color: var(--fg); }
.heatmap-stats .sub { display: block; font-size: 10px; color: var(--fg-dim); margin-top: 1px; }
.heatmap-axis {
  display: grid;
  grid-template-columns: 160px 1fr 140px;
  gap: var(--s-md);
  margin-top: var(--s-sm);
  padding-top: var(--s-sm);
  border-top: 1px solid var(--border);
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--fg-muted);
}
.heatmap-axis-cells { display: flex; justify-content: space-between; }
.heatmap-legend {
  display: flex;
  align-items: center;
  gap: var(--s-md);
  margin-top: var(--s-md);
  padding-top: var(--s-md);
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--fg-muted);
  flex-wrap: wrap;
}
.heatmap-legend .scale { display: inline-flex; align-items: center; gap: 4px; }
.heatmap-legend .scale-cell { width: 10px; height: 10px; border-radius: 2px; background: var(--bg); border: 1px solid var(--border); }
.heatmap-legend .scale-cell.lv1 { background: rgba(127, 204, 121, 0.20); border-color: transparent; }
.heatmap-legend .scale-cell.lv2 { background: rgba(127, 204, 121, 0.40); border-color: transparent; }
.heatmap-legend .scale-cell.lv3 { background: rgba(127, 204, 121, 0.65); border-color: transparent; }
.heatmap-legend .scale-cell.lv4 { background: rgba(127, 204, 121, 0.92); border-color: transparent; }

/* ------ CALENDAR (week view) -------------------------------------------- */

.cal {
  display: grid;
  grid-template-columns: 60px repeat(7, 1fr);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--bg-elevated);
}
.cal-head { display: contents; }
.cal-head-cell {
  padding: var(--s-sm) var(--s-md);
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--fg-muted);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cal-head-cell.today {
  color: var(--primary);
  background: var(--primary-soft);
}
.cal-head-cell .day-num { font-size: 18px; font-weight: 400; color: var(--fg); }
.cal-head-cell.today .day-num { color: var(--primary); }
.cal-slot {
  height: 48px;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  position: relative;
}
.cal-time {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  font-size: 10.5px;
  font-family: var(--font-mono);
  color: var(--fg-dim);
  padding: 4px 8px;
  text-align: right;
  height: 48px;
}
.cal-event {
  position: absolute;
  left: 4px; right: 4px;
  background: var(--primary-soft);
  border-left: 2px solid var(--primary);
  border-radius: var(--r-xs);
  padding: 4px 6px;
  font-size: 11px;
  color: var(--fg);
  cursor: pointer;
  overflow: hidden;
  z-index: 1;
}
.cal-event:hover { background: var(--primary-soft); border-left-color: var(--primary-hi); }
.cal-event .ev-title { font-weight: 500; line-height: 1.2; }
.cal-event .ev-time { font-family: var(--font-mono); font-size: 10px; color: var(--fg-muted); margin-top: 2px; }

/* ------ SPARKLINE / DONUT (SVG containers) ------------------------------ */

.spark { width: 100%; height: 56px; }
.donut { width: 120px; height: 120px; }

/* ------ PROGRESS BAR ----------------------------------------------------- */

.bar-row {
  display: grid;
  grid-template-columns: 90px 1fr 50px;
  align-items: center;
  gap: var(--s-md);
  padding: 7px 0;
  font-size: 12px;
}
.bar-row .bar-lbl { color: var(--fg-secondary); }
.bar-row .bar-val { text-align: right; color: var(--fg); font-family: var(--font-mono); font-size: 11.5px; }
.bar-track {
  height: 4px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
  transition: width var(--dur-page) var(--ease);
}

/* ------ EVENTS LIST (DashboardMock-style) ------------------------------- */

.events {
  display: flex;
  flex-direction: column;
}
.event {
  display: grid;
  grid-template-columns: 50px 1fr 8px;
  align-items: center;
  gap: var(--s-md);
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
}
.event:last-child { border-bottom: 0; }
.event-time {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-muted);
}
.event-title { color: var(--fg-secondary); }
.event-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--primary);
  opacity: 0.6;
  justify-self: end;
}

/* ------ MODAL / DRAWER --------------------------------------------------- */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(11, 13, 14, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: var(--z-modal);
  display: none;
  align-items: center;
  justify-content: center;
  animation: fade-in var(--dur-page) var(--ease);
}
.overlay.open { display: flex; }
.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border-hi);
  border-radius: var(--r-lg);
  width: 480px;
  max-width: calc(100vw - 32px);
  padding: var(--s-xl);
  animation: scale-in var(--dur-page) var(--ease);
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--s-md);
}
.modal-title { font-size: 18px; font-weight: 500; color: var(--fg); }
.modal-close {
  width: 28px; height: 28px;
  border-radius: var(--r-sm);
  color: var(--fg-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.modal-close:hover { color: var(--fg); background: var(--bg-elev-2); }
.modal-body { color: var(--fg-secondary); }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: var(--s-sm);
  margin-top: var(--s-lg);
}

.drawer {
  position: fixed;
  top: 0; right: 0;
  height: 100vh;
  width: 420px;
  max-width: 100vw;
  background: var(--bg-elevated);
  border-left: 1px solid var(--border-hi);
  z-index: var(--z-drawer);
  transform: translateX(100%);
  transition: transform var(--dur-page) var(--ease);
  padding: var(--s-xl);
  overflow-y: auto;
}
.drawer.open { transform: translateX(0); }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes scale-in {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}

/* ------ COMMAND PALETTE ------------------------------------------------- */

.palette-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11, 13, 14, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: var(--z-palette);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
}
.palette-backdrop.open { display: flex; animation: fade-in 200ms var(--ease); }
.palette {
  width: 560px;
  max-width: calc(100vw - 32px);
  background: var(--bg-elevated);
  border: 1px solid var(--border-hi);
  border-radius: var(--r-lg);
  overflow: hidden;
  animation: scale-in var(--dur-page) var(--ease);
}
.palette-input-wrap {
  display: flex;
  align-items: center;
  gap: var(--s-sm);
  padding: 14px var(--s-md);
  border-bottom: 1px solid var(--border);
}
.palette-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 15px;
  color: var(--fg);
}
.palette-input::placeholder { color: var(--fg-muted); }
.palette-list { max-height: 360px; overflow-y: auto; padding: 6px; }
.palette-section {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  color: var(--fg-dim);
  padding: 8px var(--s-md) 4px;
}
.palette-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  font-size: 13px;
  color: var(--fg-secondary);
  cursor: pointer;
}
.palette-item:hover, .palette-item.active {
  background: var(--primary-soft);
  color: var(--primary);
}
.palette-item .ico { width: 15px; height: 15px; color: var(--fg-muted); }
.palette-item.active .ico { color: var(--primary); }
.palette-item .meta { margin-left: auto; font-family: var(--font-mono); font-size: 10px; color: var(--fg-dim); }

/* ------ TOAST ------------------------------------------------------------ */

.toast-host {
  position: fixed;
  bottom: var(--s-lg);
  right: var(--s-lg);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--s-sm);
  pointer-events: none;
}
.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border-hi);
  border-radius: var(--r-md);
  padding: 12px 16px;
  min-width: 240px;
  max-width: 380px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  pointer-events: auto;
  animation: toast-in 300ms var(--ease);
  font-size: 12.5px;
  color: var(--fg-secondary);
}
.toast .ico { width: 16px; height: 16px; color: var(--primary); margin-top: 1px; flex-shrink: 0; }
.toast-title { color: var(--fg); font-weight: 500; }
.toast-msg { color: var(--fg-muted); font-size: 11.5px; margin-top: 2px; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ------ EMPTY STATE ----------------------------------------------------- */

.empty {
  text-align: center;
  padding: var(--s-3xl) var(--s-md);
  color: var(--fg-muted);
}
.empty-title { font-size: 15px; color: var(--fg-secondary); margin-bottom: 4px; }
.empty-msg { font-size: 12.5px; color: var(--fg-muted); }
.empty-icon {
  width: 32px; height: 32px;
  margin: 0 auto var(--s-md);
  color: var(--fg-dim);
}

/* ------ BREADCRUMB ------------------------------------------------------- */

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--fg-muted);
  font-family: var(--font-mono);
}
.breadcrumb .sep { color: var(--fg-dim); }
.breadcrumb .crumb:hover { color: var(--fg-secondary); }
.breadcrumb .crumb.current { color: var(--fg); }

/* ------ AVATAR ----------------------------------------------------------- */

.avatar {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9.5px;
  font-weight: 500;
  color: var(--primary);
  font-family: var(--font-mono);
}
.avatar-group { display: inline-flex; }
.avatar-group .avatar + .avatar { margin-left: -8px; }

/* ------ ROUTE VISIBILITY ------------------------------------------------- */

.route { display: none; }
.route.active { display: block; animation: route-in 350ms var(--ease); }
@keyframes route-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ------ ANELLO RESPIRO (hero ornament — opt-in) ------------------------- */

.luna-ring {
  position: relative;
  width: 160px; height: 160px;
  border-radius: 50%;
  border: 1px solid var(--primary);
  box-shadow: 0 0 30px var(--primary-glow), inset 0 0 30px var(--primary-glow);
  animation: ring-breathe var(--dur-breathe) ease-in-out infinite;
}
@keyframes ring-breathe {
  0%, 100% { transform: scale(1); opacity: 0.85; }
  50%      { transform: scale(1.03); opacity: 1; }
}

/* =============================================================================
   v1.27.1 · MOTION LIBRARY (esagerata · hover ricchi · DnD · entrance)
   ============================================================================= */

/* ---- Keyframes core ----------------------------------------------------- */

@keyframes lu-fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes lu-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes lu-scale-in {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes lu-slide-right {
  from { opacity: 0; transform: translateX(-16px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes lu-draw {
  from { stroke-dashoffset: var(--draw-len, 1000); }
  to   { stroke-dashoffset: 0; }
}
@keyframes lu-ring-pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--c-green-pulse); }
  50%      { box-shadow: 0 0 0 10px transparent; }
}
@keyframes lu-glow-pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--c-green-glow); opacity: 1; }
  50%      { box-shadow: 0 0 28px 4px var(--c-green-glow); opacity: 0.85; }
}
@keyframes lu-shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes lu-marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
@keyframes lu-skeleton {
  0%, 100% { opacity: 0.4; }
  50%      { opacity: 0.7; }
}
@keyframes lu-rotate { to { transform: rotate(360deg); } }
@keyframes lu-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-3px); }
}

/* ---- Route entrance ricca (override base) ------------------------------ */

.route.active { animation: lu-fade-up 450ms var(--ease); }
.route.active .card,
.route.active .kpi,
.route.active .kanban-col,
.route.active .heatmap-row {
  animation: lu-fade-up 500ms var(--ease) backwards;
}
.route.active .card:nth-child(1)  { animation-delay: 40ms; }
.route.active .card:nth-child(2)  { animation-delay: 80ms; }
.route.active .card:nth-child(3)  { animation-delay: 120ms; }
.route.active .card:nth-child(4)  { animation-delay: 160ms; }
.route.active .card:nth-child(5)  { animation-delay: 200ms; }
.route.active .card:nth-child(6)  { animation-delay: 240ms; }
.route.active .card:nth-child(n+7) { animation-delay: 280ms; }
.route.active .grid > .kpi:nth-child(1) { animation-delay: 40ms; }
.route.active .grid > .kpi:nth-child(2) { animation-delay: 120ms; }
.route.active .grid > .kpi:nth-child(3) { animation-delay: 200ms; }
.route.active .grid > .kpi:nth-child(4) { animation-delay: 280ms; }
.route.active .kanban-col:nth-child(1) { animation-delay: 40ms; }
.route.active .kanban-col:nth-child(2) { animation-delay: 100ms; }
.route.active .kanban-col:nth-child(3) { animation-delay: 160ms; }
.route.active .kanban-col:nth-child(4) { animation-delay: 220ms; }
.route.active .kanban-col:nth-child(5) { animation-delay: 280ms; }
.route.active .heatmap-row { animation-delay: calc(var(--row, 0) * 60ms + 100ms); }

/* ---- Sidebar nav · hover esagerato ------------------------------------- */

.nav-item {
  transform: translateX(0);
  transition:
    color 200ms var(--ease),
    background 200ms var(--ease),
    transform 220ms var(--ease),
    padding 220ms var(--ease);
}
.nav-item:hover {
  color: var(--fg);
  background: var(--bg-elevated);
  transform: translateX(2px);
}
.nav-item:hover .ico {
  color: var(--primary);
  transform: scale(1.08);
  transition: transform 200ms var(--ease), color 200ms var(--ease);
}
.nav-item.active::before {
  animation: lu-glow-pulse 3s ease-in-out infinite;
}

/* ---- Card · hover lift + glow + sweep ---------------------------------- */

.card, .kpi {
  position: relative;
  overflow: hidden;
  transition:
    border-color 250ms var(--ease),
    transform 300ms var(--ease),
    box-shadow 350ms var(--ease);
}
.card::after, .kpi::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    120deg,
    transparent 30%,
    var(--c-green-soft) 50%,
    transparent 70%
  );
  transform: translateX(-110%);
  transition: transform 900ms var(--ease);
  z-index: 0;
}
.card:hover, .kpi:hover {
  border-color: var(--border-hi);
  transform: translateY(-2px);
  box-shadow:
    0 1px 0 0 var(--c-green-soft) inset,
    0 24px 60px -32px var(--c-green-glow);
}
.card:hover::after, .kpi:hover::after {
  transform: translateX(110%);
}
.card > *, .kpi > * { position: relative; z-index: 1; }

/* ---- KPI value · "respiro" sottile sull'accent ------------------------- */

.kpi-value.is-primary {
  text-shadow: 0 0 24px var(--c-green-glow);
  transition: text-shadow 400ms var(--ease);
}
.kpi:hover .kpi-value.is-primary {
  text-shadow: 0 0 40px var(--c-green-glow);
}

/* ---- Button primary · sweep light + scale active ----------------------- */

.btn-primary {
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 0 0 var(--c-green-glow);
  transition:
    background 220ms var(--ease),
    border-color 220ms var(--ease),
    transform 160ms var(--ease),
    box-shadow 320ms var(--ease);
}
.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    100deg,
    transparent 35%,
    rgba(255, 255, 255, 0.22) 50%,
    transparent 65%
  );
  transform: translateX(-120%);
  transition: transform 700ms var(--ease);
}
.btn-primary:hover {
  box-shadow: 0 8px 24px -8px var(--c-green-glow);
  transform: translateY(-1px);
}
.btn-primary:hover::before { transform: translateX(120%); }
.btn-primary:active { transform: translateY(0) scale(0.98); }

.btn-secondary, .btn-ghost {
  transition:
    border-color 200ms var(--ease),
    color 200ms var(--ease),
    background 200ms var(--ease),
    transform 160ms var(--ease);
}
.btn-secondary:hover, .btn-ghost:hover { transform: translateY(-1px); }
.btn-secondary:active, .btn-ghost:active { transform: translateY(0); }

/* ---- Chip · highlight on hover ----------------------------------------- */

.chip {
  transition:
    border-color 200ms var(--ease),
    color 200ms var(--ease),
    background 200ms var(--ease),
    transform 180ms var(--ease);
}
.chip:hover {
  transform: translateY(-1px);
  background: var(--bg-elev-2);
}

/* ---- Kanban card · hover lift + glow + grab ---------------------------- */

.kanban-card {
  transition:
    border-color 220ms var(--ease),
    transform 240ms var(--ease),
    box-shadow 320ms var(--ease);
}
.kanban-card:hover {
  border-color: var(--primary);
  transform: translateY(-3px) scale(1.01);
  box-shadow:
    0 12px 28px -12px var(--c-green-glow),
    0 0 0 1px var(--primary) inset;
}
.kanban-card.dragging {
  opacity: 0.4;
  transform: scale(0.96) rotate(-1deg);
  cursor: grabbing;
}
.kanban-col {
  transition: background 220ms var(--ease), border-color 220ms var(--ease);
}
.kanban-col.drop-target {
  background: var(--c-green-soft);
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary) inset, 0 0 24px -4px var(--c-green-glow) inset;
}

/* ---- Table row hover ---------------------------------------------------- */

.table tbody tr {
  transition: background 180ms var(--ease), color 180ms var(--ease);
}
.table tbody tr:hover { background: var(--bg-elev-2); }
.table tbody tr:hover td:first-child { box-shadow: inset 2px 0 0 var(--primary); }

/* ---- Heatmap cell · pulse on lv4 + grow hover -------------------------- */

.heatmap-cell { transition: transform 180ms var(--ease), background 220ms var(--ease); }
.heatmap-cell.lv4 { animation: lu-glow-pulse 3s ease-in-out infinite; }
.heatmap-cell:hover {
  transform: scale(1.7);
  z-index: 3;
  box-shadow: 0 0 0 2px var(--bg-elevated), 0 0 16px var(--c-green-glow);
}

/* ---- Status pill · ring + dot pulse ------------------------------------ */

.status-pill {
  transition: background 220ms var(--ease), border-color 220ms var(--ease);
}
.status-pill:hover { border-color: var(--primary); }
.status-pill .dot { animation: lu-ring-pulse 2.2s ease-in-out infinite; }

/* ---- Topbar icon button · scale hover ---------------------------------- */

.tb-icon-btn, .tb-search {
  transition:
    color 200ms var(--ease),
    border-color 200ms var(--ease),
    background 200ms var(--ease),
    transform 200ms var(--ease);
}
.tb-icon-btn:hover { transform: translateY(-1px); border-color: var(--primary); color: var(--primary); }
.tb-search:hover { background: var(--bg-elev-2); }

/* ---- Calendar event hover ---------------------------------------------- */

.cal-event {
  transition: background 220ms var(--ease), border-left-color 220ms var(--ease), transform 220ms var(--ease), box-shadow 280ms var(--ease);
}
.cal-event:hover {
  background: var(--c-green-soft);
  border-left-color: var(--primary-hi);
  transform: scale(1.03);
  z-index: 4;
  box-shadow: 0 4px 16px -4px var(--c-green-glow);
}

/* ---- Bar fill · grow on enter ------------------------------------------ */

.bar-fill {
  background: linear-gradient(90deg, var(--c-green-dim), var(--primary));
  transform-origin: left;
  animation: lu-bar-grow 800ms var(--ease) backwards;
}
@keyframes lu-bar-grow {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

/* ---- Donut · stroke draw ----------------------------------------------- */

.donut circle.is-progress {
  --draw-len: 240;
  stroke-dasharray: 226 240;
  animation: lu-draw 1100ms var(--ease) backwards;
  animation-delay: 200ms;
}

/* ---- Sparkline path draw ----------------------------------------------- */

.spark path[stroke] {
  stroke-dasharray: 600;
  stroke-dashoffset: 600;
  animation: lu-draw 1300ms var(--ease) forwards;
  --draw-len: 600;
}

/* ---- Number ticker · monospace count-up (via JS) ----------------------- */

.num-ticker {
  display: inline-block;
  font-variant-numeric: tabular-nums;
}

/* ---- Skeleton shimmer (per loading states demo) ------------------------ */

.skel {
  background: linear-gradient(90deg, var(--bg-elevated) 0%, var(--bg-elev-2) 50%, var(--bg-elevated) 100%);
  background-size: 200% 100%;
  animation: lu-shimmer 1.8s linear infinite;
  border-radius: var(--r-xs);
}

/* ---- Modal/Drawer/Palette · enter più ricco ---------------------------- */

.overlay.open { animation: lu-fade-in 220ms var(--ease); }
.modal { animation: lu-scale-in 320ms var(--ease); }
.drawer.open { animation: lu-slide-right 380ms var(--ease); transform: translateX(0); }
.palette-backdrop.open .palette { animation: lu-scale-in 280ms var(--ease); }

/* ---- Toast · slide-up + soft bounce ------------------------------------ */

.toast {
  animation: toast-slide 380ms var(--ease);
  border-left: 2px solid var(--primary);
}
@keyframes toast-slide {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---- Luna orb · breath + float ----------------------------------------- */

.luna-orb {
  animation: orb-breathe var(--dur-breathe) ease-in-out infinite, lu-float 6s ease-in-out infinite;
}

/* ---- Luna orbit · signature shape ricorrente (anello + orbita + punto) -
   Stile derivato dal donut "Operativo" della Panoramica. Si usa come:
   1. Pattern decorativo angolare sui card hero (.has-orbit-bg)
   2. Ornament inline (.luna-orbit) con varianti sm/md/lg
   3. Status indicator (.orbit-status · stile compatto)
   ---------------------------------------------------------------------- */

.luna-orbit {
  display: inline-block;
  position: relative;
  flex-shrink: 0;
  --orbit-size: 64px;
  --orbit-color: var(--primary);
  --orbit-opacity: 1;
  width: var(--orbit-size);
  height: var(--orbit-size);
}
.luna-orbit.sm  { --orbit-size: 36px; }
.luna-orbit.md  { --orbit-size: 56px; }
.luna-orbit.lg  { --orbit-size: 96px; }
.luna-orbit.xl  { --orbit-size: 160px; }
.luna-orbit svg {
  width: 100%; height: 100%;
  opacity: var(--orbit-opacity);
}
.luna-orbit .ring-outer { fill: none; stroke: var(--orbit-color); stroke-width: 1.5; }
.luna-orbit .ring-inner { fill: none; stroke: var(--border); stroke-width: 1; }
.luna-orbit .dot-center { fill: var(--orbit-color); }
.luna-orbit .dot-satellite { fill: var(--orbit-color); }
.luna-orbit.spinning .ring-outer { transform-origin: center; animation: lu-rotate 18s linear infinite; }
.luna-orbit.spinning .dot-satellite { transform-origin: 50% 50%; animation: lu-rotate 9s linear infinite; }

/* Pattern decorativo angolare top-right sulle card "hero" · molto soft */
.has-orbit-bg {
  position: relative;
  overflow: hidden;
}
.has-orbit-bg::after {
  content: '';
  position: absolute;
  top: -100px;
  right: -100px;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  border: 1px solid var(--primary);
  opacity: 0.12;
  pointer-events: none;
  z-index: 0;
}
.has-orbit-bg::before {
  content: '';
  position: absolute;
  top: -60px;
  right: -60px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  border: 1px solid var(--border-hi);
  opacity: 0.4;
  pointer-events: none;
  z-index: 0;
}
.has-orbit-bg > * { position: relative; z-index: 1; }
[data-theme="light"] .has-orbit-bg::after { opacity: 0.16; }
[data-theme="light"] .has-orbit-bg::before { opacity: 0.55; }

/* Variante per il page-head: orbita molto grande e tenue a destra */
.page-head.has-orbit-hero {
  position: relative;
}
.page-head.has-orbit-hero::after {
  content: '';
  position: absolute;
  top: -80px;
  right: 8%;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  border: 1px solid var(--primary);
  opacity: 0.10;
  pointer-events: none;
}
.page-head.has-orbit-hero::before {
  content: '';
  position: absolute;
  top: -40px;
  right: 14%;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  border: 1px solid var(--border-hi);
  opacity: 0.35;
  pointer-events: none;
}

/* Mini "orbit dot" per status compatto (sostituisce il dot semplice in alcuni posti) */
.orbit-mini {
  display: inline-block;
  position: relative;
  width: 14px;
  height: 14px;
  vertical-align: middle;
}
.orbit-mini::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid var(--primary);
  opacity: 0.6;
}
.orbit-mini::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 6px var(--primary-glow);
}

/* ---- Anelli quote · entrance rotate ------------------------------------ */

.quote-ring circle.is-progress {
  stroke-dasharray: 251;
  stroke-dashoffset: 251;
  animation: lu-draw 1400ms var(--ease) backwards;
}

/* ---- DnD drag preview --------------------------------------------------- */

[draggable="true"] { cursor: grab; }
[draggable="true"]:active { cursor: grabbing; }

.dnd-ghost {
  opacity: 0.5;
  transform: scale(0.94) rotate(-1.5deg);
  filter: blur(0.3px);
}

/* ---- Highlight pill ----------------------------------------------------- */

.pill-hot {
  position: relative;
}
.pill-hot::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 6px;
  border: 1px solid var(--c-green-glow);
  animation: lu-ring-pulse 2.5s ease-in-out infinite;
  pointer-events: none;
}

/* ---- Card variants · interactive ---------------------------------------- */

.card-interactive {
  cursor: pointer;
}
.card-interactive::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 28px; height: 28px;
  background: radial-gradient(circle at top right, var(--c-green-soft), transparent 60%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 280ms var(--ease);
}
.card-interactive:hover::before { opacity: 1; }

/* ---- Ring quote SVG style ---------------------------------------------- */

.quote-ring {
  width: 90px; height: 90px;
  transform: rotate(-90deg);
}

/* ------ REDUCED MOTION -------------------------------------------------- */

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

/* ------ RESPONSIVE ------------------------------------------------------- */

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; transform: translateX(-100%); z-index: var(--z-modal); transition: transform var(--dur-page) var(--ease); }
  .sidebar.open { transform: translateX(0); }
  .page { padding: var(--s-lg) var(--s-md) var(--s-2xl); }
}
