/* NATURA CLOUD — Sistema Cognitivo Agricolo
   Design System v2.0 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* ===== TOKENS ===== */
:root {
  --bg:        #0e0e0d;
  --bg-2:      #141413;
  --bg-3:      #1c1c1a;
  --bg-hover:  #222220;
  --text-1:    #eeedea;
  --text-2:    rgba(238,237,234,.78);   /* era .58 — livello descrittivo leggibile */
  --text-3:    rgba(238,237,234,.50);   /* era .28 — metadati e label visibili */
  --accent:    #5ba44f;
  --accent-t:  #7eca72;
  --accent-bg: rgba(91,164,79,.11);
  --live:      #22c55e;
  --warn:      #f59e0b;
  --err:       #ef4444;
  --orange:    #f97316;                 /* azione richiesta */
  --orange-bg: rgba(249,115,22,.09);
  --info:      #60a5fa;                 /* informazione / neutro */
  --info-bg:   rgba(96,165,250,.08);
  --border:    rgba(238,237,234,.08);   /* era .065 — leggermente più visibile */
  --border-2:  rgba(238,237,234,.14);
  --sidebar-w: 210px;
  --topbar-h:  38px;
  --banner-h:  26px;
  --font:  'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono:  'JetBrains Mono', 'SF Mono', ui-monospace, monospace;
  --r:     3px;
  --r-md:  7px;
  --r-lg:  11px;
}

[data-theme="light"] {
  --bg:        #f0ede6;
  --bg-2:      #eae7e0;
  --bg-3:      #e2dfd7;
  --bg-hover:  #dbd8d0;
  --text-1:    #1a1a18;
  --text-2:    rgba(26,26,24,.72);   /* era .56 */
  --text-3:    rgba(26,26,24,.50);   /* era .34 */
  --accent:    #2d6025;
  --accent-t:  #2d6025;
  --accent-bg: rgba(45,96,37,.08);
  --border:    rgba(26,26,24,.07);
  --border-2:  rgba(26,26,24,.13);
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-1);
  line-height: 1.55;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; }

/* ===== LAYOUT ===== */

/* BANNER DEMO — fisso sopra la topbar */
.nc-demo-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--banner-h);
  background: rgba(234,179,8,.10);
  border-bottom: 1px solid rgba(234,179,8,.20);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 1.25rem 0 calc(var(--sidebar-w) + 1.25rem);
  font-family: var(--mono);
  font-size: 0.63rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  color: var(--warn);
  z-index: 300;
}
.nc-demo-banner .nc-demo-sub {
  font-weight: 400;
  color: var(--text-3);
  letter-spacing: 0;
}

/* TOPBAR — linea di stato sistema */
.nc-topbar {
  position: fixed;
  top: var(--banner-h); left: 0; right: 0;
  height: var(--topbar-h);
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px 0 calc(var(--sidebar-w) + 20px);
  z-index: 200;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--text-2);
}

.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-brand { color: var(--text-1); font-weight: 500; letter-spacing: 0.10em; }
.topbar-sep { color: var(--text-3); }

.topbar-status { display: flex; align-items: center; gap: 6px; }
.status-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--live);
  box-shadow: 0 0 7px var(--live);
  animation: pulse 2.5s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.topbar-right { display: flex; align-items: center; gap: 12px; }

/* sync pill + orologio HH:MM */
.topbar-sync {
  display: flex; align-items: center; gap: 5px;
  font-family: var(--mono); font-size: 9.5px;
  color: var(--text-3); letter-spacing: .04em; user-select: none;
}
.topbar-sync .status-dot {
  width: 4px; height: 4px;
  box-shadow: 0 0 4px var(--live);
}
.topbar-clock {
  font-variant-numeric: tabular-nums;
  color: var(--text-3);
  padding-left: 7px;
  border-left: 1px solid var(--border-2);
  font-family: var(--mono); font-size: 9.5px;
}


/* SIDEBAR */
.nc-sidebar {
  position: fixed;
  top: calc(var(--banner-h) + var(--topbar-h)); left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow: hidden;
}

.nc-sidebar-logo {
  padding: 14px 14px 12px;
  display: flex;
  align-items: center;
  gap: 9px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.nc-sidebar-logo .logo-mark {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent-t);
  background: var(--accent-bg);
  border: 1px solid rgba(91,164,79,.2);
  border-radius: 5px;
  padding: 3px 7px;
  flex-shrink: 0;
}
.nc-sidebar-logo .logo-name {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.12em;
  color: var(--text-3);
  text-transform: uppercase;
  line-height: 1.3;
}
.nc-sidebar-logo .logo-sub {
  font-size: 7.5px;
  color: var(--text-3);
  letter-spacing: 0.08em;
}

.nc-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 8px 8px;
  overflow-y: auto;
  gap: 1px;
}

/* Sezione header */
.nc-nav-section {
  font-family: var(--mono);
  font-size: 0.60rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 10px 6px 3px;
  margin-top: 4px;
  flex-shrink: 0;
}
.nc-nav-section:first-child { margin-top: 0; }

.nc-nav a {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 9px;
  padding: 6px 8px;
  border-radius: var(--r-md);
  color: var(--text-2);
  transition: all 0.10s;
  position: relative;
  min-height: 0;
}

.nc-nav a:hover {
  background: var(--bg-hover);
  color: var(--text-1);
}

.nc-nav a.active {
  background: var(--accent-bg);
  color: var(--accent-t);
}
.nc-nav a.active svg { color: var(--accent-t); }

.nc-nav a svg { flex-shrink: 0; opacity: 0.82; }
.nc-nav a:hover svg,
.nc-nav a.active svg { opacity: 1; }

.nc-nav a .nav-label {
  font-size: 0.80rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  text-align: left;
  line-height: 1.2;
  white-space: nowrap;
}

/* Badge "presto" */
.nc-nav-presto {
  font-family: var(--mono);
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(255,255,255,.04);
  color: var(--text-3);
  border: 1px solid var(--border);
  margin-left: auto;
  flex-shrink: 0;
}

/* Voci non ancora disponibili */
.nc-nav a.nc-nav-soon {
  opacity: 0.46;
  pointer-events: none;
  cursor: default;
}

/* Blocco utente in fondo alla sidebar */
.nc-sidebar-user {
  padding: 8px 8px 10px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  display: flex; align-items: center; gap: 6px;
}
.sidebar-user-link {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 8px;
  padding: 5px 6px; border-radius: var(--r-md);
  text-decoration: none;
  transition: background .1s;
}
.sidebar-user-link:hover { background: var(--bg-hover); }
.sidebar-avatar {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  background: var(--accent-bg); border: 1px solid rgba(91,164,79,.25);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: .7rem; font-weight: 800; color: var(--accent-t);
}
.sidebar-user-info { min-width: 0; }
.sidebar-user-name {
  font-size: .75rem; font-weight: 600; color: var(--text-1);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user-role {
  font-family: var(--mono); font-size: .58rem; color: var(--text-3); letter-spacing: .05em;
}
.sidebar-logout-btn {
  width: 28px; height: 28px; border-radius: var(--r-md);
  background: transparent; border: 1px solid transparent;
  color: var(--text-3); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .1s, color .1s, border-color .1s;
}
.sidebar-logout-btn:hover {
  background: rgba(239,68,68,.08); border-color: rgba(239,68,68,.2); color: var(--err);
}

.nc-sidebar-footer {
  padding: 6px 8px 10px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.nc-sidebar-footer a {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 9px;
  padding: 6px 8px;
  border-radius: var(--r-md);
  color: var(--text-3);
  font-size: 0.78rem;
  font-weight: 500;
  transition: all 0.10s;
}
.nc-sidebar-footer a:hover {
  background: var(--bg-hover);
  color: var(--text-1);
}

/* CONTENT */
.nc-content {
  margin-left: var(--sidebar-w);
  margin-top: calc(var(--banner-h) + var(--topbar-h));
  min-height: calc(100vh - var(--banner-h) - var(--topbar-h));
  display: flex;
  flex-direction: column;
}

.nc-content-header {
  padding: 22px 44px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.nc-content-header h1 {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
}

.nc-topbar-actions { display: flex; gap: 8px; align-items: center; }

/* ===== BREADCRUMB ===== */
.nc-breadcrumb {
  padding: 7px 44px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text-3);
}
.nc-breadcrumb a {
  color: var(--text-3);
  text-decoration: none;
}
.nc-breadcrumb a:hover { color: var(--text-1); }
.nc-breadcrumb .bc-sep {
  margin: 0 0.4rem;
  opacity: 0.4;
}
.nc-breadcrumb .bc-current {
  color: var(--text-2);
  font-weight: 500;
}

.nc-main {
  padding: 44px 44px;
  flex: 1;
}

/* ===== HERO (dashboard) ===== */
.nc-hero {
  padding: 16px 0 52px;
}

.nc-hero-eyebrow {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 14px;
}

.nc-hero-title {
  font-size: clamp(2.8rem, 5vw, 4.2rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.0;
  color: var(--text-1);
  margin-bottom: 16px;
}

.nc-hero-sub {
  font-size: 0.95rem;
  color: var(--text-2);
  max-width: 480px;
  line-height: 1.7;
  margin-bottom: 14px;
}

.nc-hero-eco {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-3);
  letter-spacing: 0.06em;
}

/* ===== STAT GRID ===== */
.nc-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-bottom: 56px;
}

.nc-stat {
  background: var(--bg);
  padding: 26px 24px 28px;
}

[data-theme="light"] .nc-stat { background: var(--bg-2); }

.nc-stat-label {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 12px;
}

.nc-stat-value {
  font-size: 2.6rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--text-1);
  margin-bottom: 6px;
}

.nc-stat-sub {
  font-size: 0.75rem;
  color: var(--text-3);
  line-height: 1.4;
}

/* ===== SECTION HEADING ===== */
.nc-section-label {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.nc-section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ===== NAV CARDS (dashboard) ===== */
.nc-module-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-bottom: 56px;
}

.nc-module-card {
  background: var(--bg);
  padding: 28px 28px 32px;
  display: block;
  transition: background 0.12s;
}

[data-theme="light"] .nc-module-card { background: var(--bg-2); }

.nc-module-card:hover { background: var(--bg-hover); }

.nc-module-card-icon {
  width: 28px; height: 28px;
  margin-bottom: 20px;
  color: var(--text-3);
  transition: color 0.12s;
}
.nc-module-card:hover .nc-module-card-icon { color: var(--accent-t); }

.nc-module-card-label {
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--text-1);
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}

.nc-module-card-count {
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--text-3);
  letter-spacing: 0.06em;
  margin-bottom: 12px;
  text-transform: uppercase;
}

.nc-module-card-desc {
  font-size: 0.8rem;
  color: var(--text-2);
  line-height: 1.6;
}

/* ===== CARDS ===== */
.nc-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px;
}

.nc-card-title {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 14px;
}

.nc-card-value {
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--text-1);
  margin-bottom: 6px;
}

.nc-card-sub {
  font-size: 0.75rem;
  color: var(--text-3);
}

/* ===== GRID COMPAT ===== */
.nc-grid { display: grid; gap: 20px; }
.nc-grid-4 { grid-template-columns: repeat(4, 1fr); }
.nc-grid-3 { grid-template-columns: repeat(3, 1fr); }
.nc-grid-2 { grid-template-columns: repeat(2, 1fr); }

/* NAV CARD (old class - compatibilità) */
.nc-nav-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px;
  display: block;
  transition: all 0.12s;
  color: var(--text-1);
}
.nc-nav-card:hover {
  background: var(--bg-hover);
  border-color: var(--border-2);
}
.nc-nav-card .card-icon {
  width: 36px; height: 36px;
  background: var(--accent-bg);
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
  color: var(--accent-t);
}
.nc-nav-card .card-label {
  font-weight: 700; font-size: 0.9rem;
  color: var(--text-1); margin-bottom: 4px;
}
.nc-nav-card .card-desc {
  font-size: 0.78rem; color: var(--text-2); line-height: 1.5;
}

/* ===== PAGE HEADER ===== */
.nc-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 36px;
}
.nc-page-header-left h2 {
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  color: var(--text-1);
  line-height: 1.05;
}
.nc-page-header-left h2::after { content: '.'; color: var(--accent-t); }
.nc-page-header-left p {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--text-3);
  margin-top: 8px;
  text-transform: uppercase;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 18px;
  font-size: 0.82rem;
  font-weight: 500;
  border-radius: var(--r-md);
  transition: all 0.12s;
  cursor: pointer;
  border: 1px solid transparent;
  line-height: 1.3;
  font-family: var(--font);
  letter-spacing: 0.01em;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover { opacity: 0.86; color: #fff; }
.btn-secondary {
  background: transparent;
  color: var(--text-1);
  border-color: var(--border-2);
}
.btn-secondary:hover { background: var(--bg-hover); }
.btn-danger {
  background: transparent;
  color: var(--err);
  border-color: rgba(239,68,68,.22);
}
.btn-danger:hover { background: rgba(239,68,68,.08); }
.btn-sm { padding: 5px 12px; font-size: 0.78rem; }

/* ===== TABLE ===== */
.nc-table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--bg-2);
}
/* Sticky header opt-in */
.nc-table-wrap.nc-sticky { overflow-y: auto; max-height: 72vh; }
.nc-table-wrap.nc-sticky .nc-table thead th { position: sticky; top: 0; z-index: 2; }

table.nc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.855rem;
}
.nc-table thead th {
  background: var(--bg-3);
  padding: 11px 16px;
  text-align: left;
  font-family: var(--mono);
  font-size: 10px;               /* era 9px — più leggibile */
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--text-2);          /* era --text-3 — più visibile */
  border-bottom: 1px solid var(--border);
  font-weight: 500;              /* era 400 */
  white-space: nowrap;
}

/* Colonne ordinabili */
.nc-table th[data-sort] {
  cursor: pointer; user-select: none; position: relative; padding-right: 24px;
}
.nc-table th[data-sort]::after {
  content: '↕'; position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  opacity: 0.28; font-size: 9px; font-style: normal;
}
.nc-table th[data-sort="asc"]::after  { content: '↑'; opacity: 0.9; color: var(--accent-t); }
.nc-table th[data-sort="desc"]::after { content: '↓'; opacity: 0.9; color: var(--accent-t); }
.nc-table th[data-sort]:hover { color: var(--text-1); }

.nc-table tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.nc-table tbody tr:last-child td { border-bottom: none; }
.nc-table tbody tr:hover td { background: var(--bg-hover); }

/* Densità compatta */
.nc-table-wrap[data-density="compact"] .nc-table tbody td { padding: 7px 12px; font-size: .78rem; }
.nc-table-wrap[data-density="compact"] .nc-table thead th { padding: 7px 12px; }

/* Toolbar opzionale sopra la tabella */
.nc-table-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  padding: .55rem .9rem;
  background: var(--bg-3); border-bottom: 1px solid var(--border);
}
.nc-table-toolbar-left,
.nc-table-toolbar-right { display: flex; align-items: center; gap: .4rem; }
.nc-tbl-btn {
  font-family: var(--mono); font-size: .60rem; letter-spacing: .05em;
  padding: .2rem .5rem; border-radius: 4px;
  border: 1px solid var(--border-2); background: transparent;
  color: var(--text-3); cursor: pointer; white-space: nowrap;
  transition: color .1s, border-color .1s;
}
.nc-tbl-btn:hover { color: var(--text-1); border-color: var(--text-3); }

/* ===== BADGES ===== */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--r);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-family: var(--mono);
}
.badge-green {
  background: rgba(34,197,94,.12); color: #4ade80;
}
[data-theme="light"] .badge-green {
  background: rgba(45,96,37,.10); color: #2d6025;
}
.badge-sand {
  background: rgba(245,158,11,.10); color: #d97706;
}
.badge-gray {
  background: var(--bg-3); color: var(--text-2);
  border: 1px solid var(--border);
}
.badge-red {
  background: rgba(239,68,68,.10); color: #f87171;
}
[data-theme="light"] .badge-red { color: #dc2626; }
.badge-blue {
  background: rgba(99,102,241,.10); color: #818cf8;
}
[data-theme="light"] .badge-blue { color: #4338ca; }

/* ===== FORMS ===== */
.nc-form {
  max-width: 780px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 36px;
}
.nc-form-section { margin-bottom: 32px; }
.nc-form-section-title {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-t);
  margin-bottom: 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 6px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-3);
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  color: var(--text-1);
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
  -webkit-appearance: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}
.form-group textarea { resize: vertical; min-height: 88px; line-height: 1.5; }
.form-check {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px;
  font-size: 0.875rem;
  color: var(--text-1);
}
.form-check input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--accent);
  flex-shrink: 0;
}
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 20px; }
.form-actions {
  display: flex; gap: 10px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  margin-top: 24px;
}

/* ===== FILTERS ===== */
.nc-filters {
  display: flex; gap: 10px; align-items: center;
  flex-wrap: wrap; margin-bottom: 20px;
}
.nc-filters select {
  padding: 7px 12px;
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  color: var(--text-1);
  font-size: 0.82rem;
  outline: none; cursor: pointer;
}

/* ===== DETAIL GRID ===== */
.nc-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 32px;
}
.nc-detail-item label {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
  display: block;
  margin-bottom: 4px;
}
.nc-detail-item .value {
  font-size: 0.9rem;
  color: var(--text-1);
}

/* ===== NEBULA INDEX ===== */
.nebula-block {
  background: var(--accent-bg);
  border: 1px solid rgba(91,164,79,.18);
  border-radius: var(--r-lg);
  padding: 24px;
  margin-bottom: 16px;
}
.nebula-block .score-label {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-t);
  margin-bottom: 8px;
}
.nebula-block .score-value {
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  margin-bottom: 4px;
}
.nebula-score-bar {
  height: 3px;
  background: var(--border-2);
  border-radius: 2px;
  margin: 12px 0 10px;
  overflow: hidden;
}
.nebula-score-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.5s ease;
}
.nebula-block .score-motivazione {
  font-size: 0.82rem;
  color: var(--text-2);
  line-height: 1.65;
  margin-top: 6px;
}
.nebula-tag-list {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px;
}
.nebula-tag {
  font-family: var(--mono);
  font-size: 0.7rem;
  padding: 3px 9px;
  border-radius: var(--r);
}
.nebula-tag-bonus {
  background: rgba(34,197,94,.10); color: #4ade80;
}
[data-theme="light"] .nebula-tag-bonus {
  background: rgba(45,96,37,.10); color: #2d6025;
}
.nebula-tag-malus {
  background: rgba(239,68,68,.08); color: #f87171;
}
[data-theme="light"] .nebula-tag-malus {
  background: rgba(220,38,38,.08); color: #dc2626;
}

/* ===== ALERTS ===== */
.nc-messages { margin-bottom: 24px; }
.nc-alert {
  padding: 11px 16px;
  border-radius: var(--r-md);
  font-size: 0.855rem;
  border: 1px solid var(--border-2);
  background: var(--bg-2);
  margin-bottom: 8px;
  color: var(--text-1);
}
.nc-alert-success { border-color: rgba(34,197,94,.2); color: #4ade80; background: rgba(34,197,94,.06); }
.nc-alert-error   { border-color: rgba(239,68,68,.2); color: #f87171; background: rgba(239,68,68,.06); }

/* ===== EMPTY STATE ===== */
.nc-empty {
  text-align: center;
  padding: 88px 24px;
  color: var(--text-3);
}
.nc-empty-icon {
  font-size: 2rem;
  margin-bottom: 16px;
  opacity: 0.3;
  display: block;
}
.nc-empty h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}
.nc-empty p {
  font-size: 0.85rem;
  color: var(--text-2);
  margin-bottom: 24px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1100px) {
  .nc-stats { grid-template-columns: repeat(2, 1fr); }
  .nc-module-grid { grid-template-columns: repeat(2, 1fr); }
  .nc-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .nc-grid-3 { grid-template-columns: repeat(2, 1fr); }
  .nc-main { padding: 32px 28px; }
  .nc-content-header { padding: 18px 28px; }
}
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .nc-sidebar { display: none; }
  .nc-topbar { padding: 0 16px; }
  .nc-demo-banner { padding: 0 1rem; }
  .nc-main { padding: 20px 16px; }
  .nc-content-header { padding: 16px 16px; }
  .nc-stats,
  .nc-module-grid,
  .nc-grid-2, .nc-grid-3, .nc-grid-4 { grid-template-columns: 1fr; }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  .nc-detail-grid { grid-template-columns: 1fr; }
  .nc-hero-title { font-size: 2.2rem; }
  .nc-form { padding: 20px; }
}

/* ===== UTILITIES ===== */
.mt-4  { margin-top: 16px; }
.mt-6  { margin-top: 24px; }
.mt-8  { margin-top: 32px; }
.mb-4  { margin-bottom: 16px; }
.mb-6  { margin-bottom: 24px; }
.mb-8  { margin-bottom: 32px; }
.flex  { display: flex; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.items-center    { align-items: center; }
.justify-between { justify-content: space-between; }
.text-muted  { color: var(--text-2); }
.text-dim    { color: var(--text-3); }
.text-accent { color: var(--accent-t); }
.text-warn   { color: var(--warn); }
.text-err    { color: var(--err); }
.text-orange { color: var(--orange); }
.text-info   { color: var(--info); }
.font-mono   { font-family: var(--mono); }
.font-bold   { font-weight: 700; }
.text-sm     { font-size: 0.82rem; }
.w-full      { width: 100%; }

/* ── Campo di testo / select generico ── */
.nc-input {
  background: var(--bg-3);
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  color: var(--text-1);
  font-family: inherit; font-size: 0.82rem;
  padding: 7px 11px;
  outline: none; width: 100%;
  transition: border-color .12s, box-shadow .12s;
  -webkit-appearance: none; appearance: none;
}
.nc-input::placeholder { color: var(--text-3); }
.nc-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-bg);
}
select.nc-input { cursor: pointer; }

/* ── Pulsante fantasma ── */
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border-2);
  color: var(--text-2);
  border-radius: var(--r-md);
  padding: .38rem .75rem;
  font-size: .8rem; font-family: inherit;
  cursor: pointer; display: inline-flex; align-items: center; gap: .35rem;
  transition: background .12s, color .12s, border-color .12s;
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-1); border-color: var(--text-3); }

/* ── Pill semantici ── */
.pill-orange { background: var(--orange-bg); color: var(--orange); border: 1px solid rgba(249,115,22,.22); }
.pill-info   { background: var(--info-bg);   color: var(--info);   border: 1px solid rgba(96,165,250,.22); }

/* ── Paginator ── */
.nc-paginator {
  display: flex; align-items: center; justify-content: center; gap: .3rem;
  padding: .65rem 0; font-family: var(--mono); font-size: .72rem;
}
.nc-page-btn {
  width: 28px; height: 28px; border-radius: 5px;
  border: 1px solid var(--border-2); background: transparent;
  color: var(--text-3); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: color .1s, border-color .1s, background .1s;
}
.nc-page-btn:hover { color: var(--text-1); background: var(--bg-hover); }
.nc-page-btn.active { background: var(--accent-bg); color: var(--accent-t); border-color: rgba(91,164,79,.3); }

/* ── Switcher Azienda (sidebar) ── */
.nc-az-switcher {
  position: relative;
  margin: 0 .6rem .5rem;
}
.nc-az-current {
  display: flex; align-items: center; gap: .45rem;
  padding: .42rem .6rem; border-radius: var(--r-md);
  border: 1px solid var(--border-2);
  background: var(--bg-3);
  cursor: pointer;
  user-select: none;
  font-size: .72rem; color: var(--text-2);
  font-family: var(--mono);
  transition: background .12s, border-color .12s;
}
.nc-az-current:hover { background: var(--bg-hover); border-color: var(--text-3); }
.nc-az-current svg:first-child { color: var(--accent-t); flex-shrink: 0; }
.nc-az-nome { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nc-az-chevron { flex-shrink: 0; color: var(--text-3); transition: transform .15s; }

.nc-az-switcher:hover .nc-az-dropdown { display: block; }
.nc-az-switcher:hover .nc-az-chevron { transform: rotate(180deg); }

.nc-az-dropdown {
  display: none;
  position: absolute;
  bottom: calc(100% + 4px); left: 0; right: 0;
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  padding: .3rem;
  z-index: 200;
  box-shadow: 0 4px 20px rgba(0,0,0,.35);
}
.nc-az-option {
  display: block; width: 100%; text-align: left;
  padding: .38rem .55rem; border-radius: 5px;
  font-size: .72rem; font-family: var(--mono);
  color: var(--text-2); background: transparent; border: none;
  cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-decoration: none;
  transition: background .1s, color .1s;
}
.nc-az-option:hover { background: var(--bg-hover); color: var(--text-1); }
.nc-az-nuova {
  display: flex; align-items: center; gap: .35rem;
  margin-top: .25rem; padding-top: .38rem;
  border-top: 1px solid var(--border);
  color: var(--accent-t);
}
.nc-az-nuova:hover { color: var(--accent-t); background: var(--accent-bg); }

/* ── Badge notifica inviti topbar ── */
.topbar-inviti-badge {
  display: flex; align-items: center; gap: .3rem;
  font-family: var(--mono); font-size: .65rem; font-weight: 700;
  color: var(--orange); background: var(--orange-bg);
  border: 1px solid rgba(249,115,22,.25);
  border-radius: 20px; padding: .2rem .6rem;
  text-decoration: none; transition: background .12s;
}
.topbar-inviti-badge:hover { background: rgba(249,115,22,.18); }
