/* ============================================================================
   NorthStar Design System — Tokens & Components
   Instrument Serif + DM Sans | Phosphor Icons Filled
   ============================================================================
   Riferimento: preview-projects-page.html (gold standard)
   ============================================================================ */

/* ==========================================
   TOKENS — provided by Theme Engine (_theme.ejs)
   No hardcoded :root here. All CSS variables
   come from the active theme in the database.
   ========================================== */

* { margin: 0; padding: 0; box-sizing: border-box; }
body { background: var(--bg); color: var(--text-1); font-family: 'DM Sans', -apple-system, sans-serif; -webkit-font-smoothing: antialiased; font-size: 13.5px; }
.app { display: flex; height: 100vh; }
[x-cloak] { display: none !important; }

/* ==========================================
   TOPBAR (fixed)
   ========================================== */
.topbar {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; height: 48px;
  padding: 0 16px; background: var(--bg-card);
  border-bottom: 1px solid var(--border-light);
}
.topbar-left { display: flex; align-items: center; gap: 10px; }
.topbar-back { font-size: 18px; color: var(--text-3); cursor: pointer; padding: 4px; text-decoration: none; }
.topbar-back:hover { color: var(--text-1); }
.topbar-frontend { font-size: 12px; color: var(--accent); font-weight: 600; display: flex; align-items: center; gap: 4px; cursor: pointer; }
.topbar-frontend i { font-size: 14px; }
.topbar-title { font-size: 14px; font-weight: 700; color: var(--text-1); margin-left: 8px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.topbar-icon { font-size: 18px; color: var(--text-3); cursor: pointer; transition: color 0.12s; }
.topbar-icon:hover { color: var(--text-1); }
.topbar-app-badge { padding: 4px 10px; border-radius: var(--r-pill); background: var(--topbar-badge-bg); font-size: 11px; font-weight: 700; color: var(--topbar-badge-text); }
.topbar-notif { position: relative; }
.topbar-notif-count { position: absolute; top: -6px; right: -8px; background: var(--red); color: #fff; font-size: 9px; font-weight: 700; padding: 1px 5px; border-radius: 10px; }
.topbar-avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; box-shadow: inset 0 2px 0 rgba(255,255,255,0.22), inset 0 -2px 0 rgba(0,0,0,0.18), 0 1px 3px rgba(0,0,0,0.10); text-shadow: 0 1px 0 rgba(0,0,0,0.12); }
.topbar-username { font-size: 12.5px; font-weight: 600; color: var(--text-1); }

/* ==========================================
   SIDEBAR
   ========================================== */
.sidebar {
  width: 240px; min-width: 240px; display: flex; flex-direction: column;
  padding: 16px 10px;
  margin: 10px 0 10px 10px; border-radius: 18px;
  background: var(--bg-sidebar); border: 1px solid var(--border-light);
  position: sticky; top: 10px; height: calc(100vh - 20px);
  z-index: 101;
  transition: width 0.25s ease, min-width 0.25s ease, padding 0.25s ease;
}
.sidebar.collapsed { width: 68px; min-width: 68px; padding: 16px 8px; }
.sidebar.collapsed .logo-text,
.sidebar.collapsed .sb-section,
.sidebar.collapsed .sb-item span,
.sidebar.collapsed .sb-count,
.sidebar.collapsed .sb-arrow,
.sidebar.collapsed .sb-fav,
.sidebar.collapsed .sb-sub,
/* .sb-submenu è il nome ATTUALE dei sottomenù (main.ejs / main-v2.ejs); .sb-sub qui sopra è il nome
   vecchio, tenuto per eventuali view non migrate. Senza questa riga i sottomenù aperti restavano
   visibili anche a barra chiusa, schiacciati nei 68px: si leggevano solo le prime lettere delle voci
   (segnalato dall'operatore su agri-web il 2026-08-07). .sb-subtoggle è il chevron apri/chiudi. */
.sidebar.collapsed .sb-submenu,
.sidebar.collapsed .sb-user-info { display: none; }
/* Il chevron porta `display:flex` INLINE (main.ejs/main-v2.ejs): senza !important lo stile inline
   vince e il bottone resta visibile sopra la voce solo-icona. */
.sidebar.collapsed .sb-subtoggle { display: none !important; }
/* Misura del chevron: DEVE stare qui e non nell'attributo `style` della <svg>. Quel tag porta
   `:style` di Alpine per la rotazione, e Alpine RISCRIVE l'attributo: width/height sparivano e
   la freccia nasceva 0x0 — invisibile. Risultato: le sotto-voci esistevano ma nessuno poteva
   scoprirle. Misurato in browser il 2026-08-08 su ecoconsult (getComputedStyle → 0px).
   Il bottone passa da 8x8 a 28x28: a 8 pixel non si centra, tantomeno col dito (regola 13). */
.sb-chevron { width: 12px; height: 12px; transition: transform .15s; flex-shrink: 0; }
.sb-subtoggle { width: 28px; height: 28px; justify-content: center; border-radius: 6px; }
.sb-subtoggle:hover { opacity: 1 !important; background: var(--surface-2, rgba(0,0,0,.06)) !important; }
/* padding !important: le voci CON sottomenù portano `padding-right:32px` INLINE (spazio del chevron,
   main.ejs riga ~668) che a barra chiusa vince sul padding della classe: le loro icone finivano
   spostate a sinistra rispetto alle altre (icone «non allineate», operatore 2026-08-07). */
.sidebar.collapsed .sb-item { justify-content: center; padding: 9px !important; }
.sidebar.collapsed .sb-item i { font-size: 19px; }
/* Blocchi COSTRUITI DA JAVASCRIPT dentro la sidebar (oggi: il toggle «Notifiche desktop»
   iniettato da public/js/desktop-notifications.js accanto alla voce Notifiche). Nascono con
   tutto lo stile scritto in linea, quindi nessuna delle regole qui sopra li intercetta e a
   barra chiusa restavano dentro i 68px con titolo, scritta di stato e interruttore, sbordando
   (segnalato dall'operatore il 2026-08-24, screenshot). Chi genera markup in sidebar da JS
   marchia il nodo con questa classe. !important perché deve battere lo stile in linea.
   Solo da 768px in su: sotto quella soglia la barra non si contrae e main-v2 neutralizza
   `collapsed` a mano — fuori soglia non cambiamo nulla di com'è oggi. */
@media (min-width: 768px) {
  .sidebar.collapsed .ns-hide-collapsed { display: none !important; }
}
/* A barra chiusa avatar e logout (che sidebar-v8 sposta dentro .sb-user) vanno in COLONNA: in riga
   non stanno nei 68px — l'avatar si schiaccia a fettina e il logout finisce sotto il toggle
   (segnalato dall'operatore su agri-web il 2026-08-07). Niente spazio extra sotto: la separazione
   dal toggle la fa il toggle stesso, che a barra chiusa entra in colonna (vedi agri-glass.css). */
.sidebar.collapsed .sb-user { justify-content: center; padding: 10px 0; flex-direction: column; gap: 6px; }
.sidebar.collapsed .logo { justify-content: center; padding: 6px 0; }

.sidebar-toggle {
  position: absolute; top: 18px; right: -12px; z-index: 10;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--bg-card); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-3);
  font-size: 14px; transition: all 0.15s;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}
.sidebar-toggle:hover { color: var(--text-1); border-color: #ccc; transform: scale(1.08); }

.sidebar .logo { display: flex; align-items: center; gap: 9px; padding: 8px 10px; margin-bottom: 24px; }
.sidebar .logo-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--brand-logo-bg); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 15px; }
/* Marchio del cliente al posto della stella (tema con brand_logo_url): niente quadrato
   colorato sotto — un logo con trasparenza ci perderebbe le parti scure dentro. */
/* `!important` + `html.dark` non sono decorazione: layouts/main-v2 ha una sua regola
   `html.dark .logo-mark { background:#374151 !important }` che altrimenti rimetterebbe il
   quadrato sotto al logo in tema scuro. Qui la specificità è più alta e vince. */
.sidebar .logo-mark--img,
html.dark .sidebar .logo-mark--img { background: transparent !important; border-radius: 0; }
/* Marchio in due versioni, una per fondo chiaro e una per fondo scuro (tema con
   brand_logo_dark_url). Lo scambio avviene SOLO se la versione scura esiste davvero: senza la
   classe `--ha-scuro` niente si nasconde, quindi un tema con un logo solo resta come prima. */
/* `.logo-mark--img` nel selettore NON è ridondante: due righe più su c'è
   `.sidebar .logo-mark--img img { display:block }`, che è più specifica di un semplice
   `.sidebar .logo-su-scuro` e lascerebbe visibili ENTRAMBI i loghi, uno sopra l'altro. */
.sidebar .logo-mark--img .logo-su-scuro { display: none; }
html.dark .sidebar .logo-mark--ha-scuro .logo-su-chiaro { display: none; }
html.dark .sidebar .logo-mark--ha-scuro .logo-su-scuro { display: block; }
.sidebar .logo-mark--img img { width: 30px; height: 30px; object-fit: contain; display: block; }
.sidebar .logo-text { font-family: 'Instrument Serif', Georgia, serif; font-size: 20px; font-weight: 400; color: var(--brand-text); letter-spacing: -0.3px; }

.sb-section { font-size: 10px; text-transform: uppercase; letter-spacing: 1.3px; padding: 18px 10px 6px; color: var(--text-4); font-weight: 600; }
.sidebar .sb-item, .sidebar a.sb-item, .sidebar a.sb-item:link, .sidebar a.sb-item:visited { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; font-size: 13.5px; font-weight: 500; cursor: pointer; transition: all 0.12s; color: var(--sidebar-item-text) !important; text-decoration: none !important; }
.sidebar .sb-item i { font-size: 18px; opacity: var(--sidebar-icon-opacity); }
.sidebar a.sb-item:hover, .sidebar .sb-item:hover { background: var(--sidebar-item-hover-bg); color: var(--sidebar-item-hover-text) !important; }
.sidebar .sb-item:hover i { opacity: 0.7; }
.sidebar a.sb-item.active, .sidebar .sb-item.active { background: var(--sidebar-item-active-bg); color: var(--sidebar-item-active-text) !important; font-weight: 600; }
.sidebar .sb-item.active i { opacity: 1; color: var(--sidebar-item-active-text); }
/* Lucchetto (demo Innovation Machine): voce lucchettata resa come lo stato hover, per evidenziare che è bloccata */
.sidebar a.sb-item.sb-locked, .sidebar .sb-item.sb-locked { background: var(--sidebar-item-hover-bg); color: var(--sidebar-item-hover-text) !important; }
.sb-item .sb-count { margin-left: auto; font-size: 11px; color: var(--text-4); font-weight: 600; }
.sb-item .sb-arrow { margin-left: auto; font-size: 14px; color: var(--text-4); }
.sb-item .badge-new,
.sb-item .badge-beta,
.sb-item .badge-soon {
  margin-left: auto; font-size: 9px; padding: 2px 7px;
  border-radius: 6px; font-weight: 800; letter-spacing: 0.5px;
  color: #fff; box-shadow: 0 2px 6px rgba(0,0,0,0.12);
  transform: rotate(-4deg);
}
.sb-item .badge-new { background: #0364F8; }
.sb-item .badge-beta { background: #8B5CF6; transform: rotate(3deg); }
.sb-item .badge-soon { background: #F59E0B; }
.sb-sub { padding-left: 18px; }
.sb-sub .sb-item { font-size: 12.5px; padding: 6px 10px; }
.sb-fav { font-size: 10px; color: var(--accent); font-weight: 600; padding: 4px 10px; cursor: pointer; }
.sb-divider { height: 1px; background: var(--border-light); margin: 10px 10px; }
.sb-user { margin-top: auto; padding: 12px 10px; display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--border-light); }
/* flex-shrink:0: l'avatar è un cerchio e non deve MAI schiacciarsi a ellisse, qualunque cosa gli
   metta accanto il flex (es. il logout spostato da sidebar-v8). */
.sb-avatar { width: 32px; height: 32px; flex-shrink: 0; border-radius: 50%; background: var(--text-1); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; box-shadow: inset 0 2px 0 rgba(255,255,255,0.18), inset 0 -2px 0 rgba(0,0,0,0.22), 0 1px 3px rgba(0,0,0,0.12); text-shadow: 0 1px 0 rgba(0,0,0,0.18); }
.sb-user-info .n { font-size: 13px; font-weight: 600; color: var(--text-1); }
.sb-user-info .r { font-size: 10.5px; color: var(--sidebar-user-role); }

/* ==========================================
   MAIN
   ========================================== */
.main { flex: 1; overflow-y: auto; display: flex; flex-direction: column; margin-top: 48px; }

/* Breadcrumb */
.breadcrumb { padding: 10px 28px; font-size: 12px; color: var(--text-4); display: flex; align-items: center; gap: 6px; }
.breadcrumb a, .breadcrumb a:link, .breadcrumb a:visited { color: var(--breadcrumb-text); text-decoration: none; font-weight: 500; }
.breadcrumb a:hover { color: var(--breadcrumb-hover); }
.breadcrumb span { color: var(--text-1); font-weight: 600; }

/* PM Nav — pill tabs (identical to gold standard) */
.pm-nav { display: flex; align-items: center; gap: 2px; padding: 6px 28px 8px; border-bottom: 1px solid var(--border-light); overflow-x: auto; flex-shrink: 0; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.pm-nav::-webkit-scrollbar { display: none; }
.pm-item { display: flex; align-items: center; gap: 5px; padding: 7px 12px; border-radius: var(--r-pill, 20px); font-size: 12px; font-weight: 500; color: var(--text-3); cursor: pointer; transition: all 0.12s; white-space: nowrap; text-decoration: none; }
.pm-item i { font-size: 15px; }
.pm-item:hover { color: var(--text-2); background: var(--bg); }
.pm-item.active { color: var(--text-1); background: var(--bg-input); font-weight: 600; }
.pm-item.active i { color: var(--accent); }
.pm-sep { width: 1px; height: 18px; background: var(--border-light); margin: 0 4px; flex-shrink: 0; }
@media (max-width: 767px) {
  .pm-nav { padding: 4px 16px 6px; }
  .pm-item { padding: 6px 10px; font-size: 11px; gap: 3px; }
  .pm-item i { font-size: 14px; }
  .pm-lbl { display: none; }
  .pm-item.active .pm-lbl { display: inline; }
}

/* Page content area */
.page-body { flex: 1; padding: 24px 28px 48px; overflow-y: auto; min-width: 0; }

/* Page header */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; gap: 16px; flex-wrap: wrap; }
.page-header h1 { font-family: 'Instrument Serif', Georgia, serif; font-size: 28px; font-weight: 400; }
.page-header .subtitle { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.page-header-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

/* App Footer */
.app-footer { padding: 8px 28px; font-size: 11px; color: var(--text-4); display: flex; justify-content: space-between; border-top: 1px solid var(--border-light); background: var(--bg-card); flex-shrink: 0; }

/* ==========================================
   BUTTONS (3D inset)
   ========================================== */
.btn { padding: 10px 18px; border-radius: 12px; border: none; font-family: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; transition: all 0.2s ease; position: relative; }
.btn i { font-size: 15px; }
.btn-primary {
  background: var(--btn-primary-bg); color: #fff;
  box-shadow: inset 0 2px 0 rgba(255,255,255,0.25), inset 0 -3px 0 rgba(0,0,0,0.2), 0 1px 2px rgba(0,0,0,0.15);
}
.btn-primary:hover { background: var(--btn-primary-hover); }
.btn-primary:active { background: var(--btn-primary-active); box-shadow: inset 0 3px 6px rgba(0,0,0,0.3), inset 0 -1px 0 rgba(255,255,255,0.1); }
.btn-dark {
  background: var(--btn-dark-bg); color: #fff;
  box-shadow: inset 0 2px 0 rgba(255,255,255,0.12), inset 0 -3px 0 rgba(0,0,0,0.35), 0 1px 2px rgba(0,0,0,0.2);
}
.btn-dark:hover { background: var(--btn-dark-hover); }
.btn-dark:active { background: var(--btn-dark-active); box-shadow: inset 0 3px 6px rgba(0,0,0,0.4), inset 0 -1px 0 rgba(255,255,255,0.05); }
.btn-dark i { color: #fff; }
.btn-secondary { background: var(--bg-card); color: var(--text-2); border: 1px solid var(--border); box-shadow: none; outline: none; }
.btn-secondary:hover { border-color: #D0D0D0; color: var(--text-1); background: var(--bg-input); }
.btn-secondary:focus-visible { box-shadow: 0 0 0 2px var(--accent-soft); }
.btn-success {
  background: var(--green); color: #fff;
  box-shadow: inset 0 2px 0 rgba(255,255,255,0.2), inset 0 -3px 0 rgba(0,0,0,0.2), 0 1px 2px rgba(0,0,0,0.15);
}
.btn-success:hover { background: var(--btn-success-hover); }
.btn-amber {
  background: var(--yellow); color: #fff;
  box-shadow: inset 0 2px 0 rgba(255,255,255,0.2), inset 0 -3px 0 rgba(0,0,0,0.2), 0 1px 2px rgba(0,0,0,0.15);
}
.btn-amber:hover { background: var(--btn-amber-hover); }
.btn-indigo {
  background: var(--btn-indigo-bg); color: #fff;
  box-shadow: inset 0 2px 0 rgba(255,255,255,0.2), inset 0 -3px 0 rgba(0,0,0,0.2), 0 1px 2px rgba(0,0,0,0.15);
}
.btn-indigo:hover { background: var(--btn-indigo-hover); }
.btn-ghost { background: none; color: var(--accent); padding: 8px 14px; font-size: 12px; box-shadow: none; }
.btn-ghost:hover { background: var(--accent-soft); }
.btn:disabled, .btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn-cta { width: 100%; padding: 16px 24px; justify-content: center; font-size: 15px; }

/* ==========================================
   INPUTS
   ========================================== */
.input { width: 100%; padding: 10px 14px; border: 1px solid var(--border-light); border-radius: var(--r-sm); font-family: inherit; font-size: 13px; background: var(--bg-card); color: var(--text-1); outline: none; transition: border-color 0.15s; }
.input:focus { border-color: var(--text-3); }
.input-mono { font-family: 'SF Mono', 'Menlo', monospace; font-size: 12px; }
.textarea { resize: vertical; min-height: 60px; }
.label { display: block; font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 5px; }
.helper { font-size: 11px; color: var(--text-4); margin-top: 4px; }
.helper-green { color: var(--green); }

/* ==========================================
   CARDS
   ========================================== */
.card { background-color: var(--bg-card); border-radius: var(--r); border: 1px solid var(--border-light); margin-bottom: 20px; }
.card-amber { background: #FFFBEB; border: 2px solid #F59E0B; }
.card h3 { font-size: 15px; font-weight: 700; color: var(--text-1); margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.card h3 i { font-size: 18px; }
.card .desc { font-size: 13px; color: var(--text-2); margin-bottom: 20px; }

/* ==========================================
   TABS
   ========================================== */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.tab-btn { padding: 10px 18px; border: none; background: none; font-family: inherit; font-size: 13px; font-weight: 600; color: var(--text-3); cursor: pointer; border-bottom: 2px solid transparent; transition: all 0.15s; }
.tab-btn:hover { color: var(--text-2); }
.tab-btn.active { color: var(--text-1); border-bottom-color: var(--text-1); }
.tab-btn i { font-size: 15px; margin-right: 5px; vertical-align: -2px; }

/* ==========================================
   TOGGLE / FILTER GROUPS
   ========================================== */
.filter-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.filter-search { padding: 10px 14px; border: 1px solid var(--border-light); background: var(--bg-card); border-radius: 12px; font-family: inherit; font-size: 12.5px; color: var(--filter-search-text); width: 200px; outline: none; transition: border-color 0.15s; }
.filter-search::placeholder { color: var(--filter-search-placeholder); }
.filter-search:focus { border-color: #9B9B9B; }
.filter-group { display: inline-flex; align-items: center; gap: 2px; padding: 4px; background: var(--bg-card); border: 1px solid var(--border-light); border-radius: 14px; flex-shrink: 0; }
.filter-btn, a.filter-btn, button.filter-btn { padding: 7px 14px; border-radius: 10px; border: none; background: transparent; font-family: inherit; font-size: 12px; font-weight: 600; color: var(--filter-text); cursor: pointer; transition: all 0.15s; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.filter-btn i { font-size: 14px; }
.filter-btn:hover { color: var(--filter-hover-text); background: var(--bg-input); }
.filter-btn.active { background: var(--filter-active-bg); color: var(--filter-active-text); }
.filter-btn.active:hover { background: var(--filter-active-bg); color: var(--filter-active-text); }
.filter-btn.active i { color: var(--filter-active-text); }
.filter-sort { padding: 9px 12px; border: 1px solid var(--border-light); border-radius: 12px; font-family: inherit; font-size: 11.5px; color: var(--text-2); background: var(--bg-card); cursor: pointer; font-weight: 600; }

/* ==========================================
   STAT BADGES
   ========================================== */
.stats-row { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.stat-badge { padding: 5px 14px; border-radius: 8px; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; gap: 6px; }
.stat-badge i { font-size: 14px; }
.stat-new { background: var(--green-soft); color: var(--green); }
.stat-modified { background: var(--yellow-soft); color: var(--yellow); }
.stat-collision { background: var(--red-soft); color: var(--red); }
.stat-identical { background: var(--bg-input); color: var(--text-3); }

/* ==========================================
   SELECTION BAR
   ========================================== */
.selection-bar { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-radius: var(--r-sm); background: var(--bg); margin-bottom: 4px; }
.selection-count { font-size: 13px; font-weight: 600; color: var(--text-2); }
.deselect-link { font-size: 12px; font-weight: 600; color: var(--accent); cursor: pointer; text-decoration: none; }
.deselect-link:hover { text-decoration: underline; }

/* ==========================================
   TABLE
   ========================================== */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; padding: 10px 14px; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.7px; color: var(--text-4); border-bottom: 1px solid var(--border); }
.table td { padding: 12px 14px; font-size: 13px; border-bottom: 1px solid var(--border-light); color: var(--text-1); }
.table tr:hover td { background: var(--table-row-hover); }
.table .mono { font-family: 'SF Mono', 'Menlo', monospace; font-size: 12px; }
.table .meta { color: var(--text-3); font-size: 12px; }
.table .note { color: var(--text-4); font-size: 11px; font-style: italic; }
.table .actions { text-align: right; white-space: nowrap; }
.table-btn { padding: 5px 12px; border-radius: 8px; font-size: 11px; font-weight: 700; border: none; cursor: pointer; transition: all 0.15s; }
.table-btn-blue { background: var(--accent-soft); color: var(--accent); }
.table-btn-blue:hover { background: #D6E4FF; }
.table-btn-red { background: var(--red-soft); color: var(--red); }
.table-btn-red:hover { background: #FECACA; }

/* ==========================================
   FILE LIST
   ========================================== */
.file-list-card { background: var(--bg-card); border-radius: var(--r); border: 1px solid var(--border-light); overflow: hidden; margin-bottom: 20px; max-height: 500px; overflow-y: auto; }
.file-group-header { display: flex; align-items: center; justify-content: space-between; padding: 8px 14px; background: var(--bg); border-bottom: 1px solid var(--border-light); position: sticky; top: 0; z-index: 2; }
.file-group-header .group-name { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; color: var(--text-2); }
.file-group-header .group-name i { font-size: 16px; color: var(--text-3); }
.file-group-header .group-count { font-size: 11px; padding: 2px 8px; border-radius: var(--r-pill); background: var(--border-light); color: var(--text-3); font-weight: 700; }
.file-row { display: flex; align-items: center; gap: 12px; padding: 10px 20px; border-bottom: 1px solid var(--border-light); transition: background 0.1s; }
.file-row:last-child { border-bottom: none; }
.file-row:hover { background: var(--table-row-hover); }
.file-row.collision { background: #FFF5F5; }
.file-row.collision:hover { background: #FEE2E2; }
.file-check { width: 15px; height: 15px; border-radius: 4px; border: 1.5px solid #D0D0D0; cursor: pointer; appearance: none; -webkit-appearance: none; background: #fff; accent-color: var(--text-1); flex-shrink: 0; }
.file-check:checked { appearance: auto; -webkit-appearance: auto; }
.file-icon { width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }
.file-icon.js { background: var(--yellow-soft); color: var(--yellow); }
.file-icon.json { background: var(--purple-soft); color: var(--purple); }
.file-icon.ejs { background: var(--pastel-orange); color: #9A3412; }
.file-icon.css { background: var(--accent-soft); color: var(--accent); }
.file-icon.md { background: var(--accent-soft); color: var(--accent); }
.file-icon.html { background: var(--red-soft); color: var(--red); }
.file-icon.config { background: var(--bg-input); color: var(--text-3); }
.file-path { flex: 1; min-width: 0; font-size: 12.5px; font-weight: 500; color: var(--text-1); font-family: 'SF Mono', 'Menlo', monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-path .dir { color: var(--text-4); }
.file-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.file-btn-analyze { padding: 5px 12px; border-radius: 8px; background: var(--green-soft); color: var(--green); font-size: 11px; font-weight: 700; border: none; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; transition: all 0.15s; }
.file-btn-analyze:hover { background: #BBF7D0; }
.file-btn-analyze i { font-size: 13px; }
.file-badge-status { padding: 2px 7px; border-radius: 5px; font-size: 9.5px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; }
.badge-nuovo { background: var(--green-soft); color: var(--green); }
.badge-modificato { background: var(--yellow-soft); color: var(--yellow); }
.badge-collisione { background: var(--red-soft); color: var(--red); }

/* AI Analysis panel */
.ai-panel { padding: 16px 20px; border-top: 1px solid var(--border-light); background: var(--accent-soft); }
.ai-panel-collision { background: var(--red-soft); border-top-color: #FECACA; }
.ai-panel-header { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--accent); margin-bottom: 8px; }
.ai-panel-header i { font-size: 16px; }
.ai-panel-body { font-size: 12px; line-height: 1.6; color: var(--text-2); }
.ai-panel-body strong { color: var(--text-1); }
.ai-panel-body code { background: var(--accent-soft); padding: 1px 5px; border-radius: 4px; font-size: 11px; font-family: 'SF Mono', 'Menlo', monospace; }

/* ==========================================
   INFO BOX
   ========================================== */
.info-box { padding: 14px 18px; border-radius: var(--r-sm); font-size: 12.5px; line-height: 1.5; display: flex; align-items: flex-start; gap: 10px; }
.info-box i { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.info-box b { font-weight: 700; }
.info-blue { background: var(--accent-soft); color: var(--accent); }
.info-indigo { background: #EEF2FF; color: #3730A3; }
.info-amber { background: var(--yellow-soft); color: var(--yellow); }
.info-green { background: var(--green-soft); color: #166534; }
.info-red { background: var(--red-soft); color: #9F1239; }

.warning-box { padding: 14px 18px; border-radius: var(--r-sm); background: var(--red-soft); border: 1px solid #FECACA; font-size: 12px; font-weight: 600; color: #9F1239; margin-bottom: 16px; }

/* ==========================================
   STATUS BOX
   ========================================== */
.status-box { padding: 14px 18px; border-radius: var(--r-sm); display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; }
.status-box .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.status-green { background: var(--green-soft); color: #166534; }
.status-green .dot { background: var(--green); }
.status-amber { background: var(--yellow-soft); color: var(--yellow); }
.status-amber .dot { background: var(--yellow); }

/* ==========================================
   PROGRESS BAR
   ========================================== */
.progress-wrap { margin-top: 16px; }
.progress-meta { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--text-3); margin-bottom: 6px; }
.progress-bar { width: 100%; height: 8px; border-radius: 4px; background: var(--bg-input); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 4px; transition: width 0.5s ease; }
.progress-fill-amber { background: #F59E0B; }
.progress-fill-green { background: var(--green); }
.progress-fill-blue { background: var(--accent); }

/* ==========================================
   GUIDE SECTIONS
   ========================================== */
.guide-card { background: var(--bg-card); border-radius: var(--r); border: 1px solid var(--border-light); padding: 28px; margin-bottom: 20px; }
.guide-card h3 { font-size: 15px; font-weight: 700; margin-bottom: 4px; display: flex; align-items: center; gap: 8px; }
.guide-card h3 i { font-size: 18px; }
.guide-card .guide-desc { font-size: 13px; color: var(--text-2); margin-bottom: 20px; }
.guide-list { list-style: none; counter-reset: step; }
.guide-list li { position: relative; padding: 8px 0 8px 36px; font-size: 13px; line-height: 1.5; color: var(--text-2); counter-increment: step; }
.guide-list li::before { content: counter(step); position: absolute; left: 0; top: 8px; width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.guide-list li strong { color: var(--text-1); font-weight: 700; }
.guide-list li code { background: var(--bg-input); padding: 2px 6px; border-radius: 4px; font-family: 'SF Mono', 'Menlo', monospace; font-size: 11px; }
.guide-ul { list-style: none; padding: 0; }
.guide-ul li { padding: 6px 0 6px 20px; position: relative; font-size: 13px; line-height: 1.5; color: var(--text-2); }
.guide-ul li::before { content: ''; position: absolute; left: 6px; top: 14px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.guide-ul li strong { color: var(--text-1); }
.guide-ul li code { background: var(--bg-input); padding: 2px 6px; border-radius: 4px; font-family: 'SF Mono', 'Menlo', monospace; font-size: 11px; }

/* ==========================================
   TOAST
   ========================================== */
.toast-area { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 12px 20px; border-radius: var(--r-sm); font-size: 13px; font-weight: 600; color: #fff; box-shadow: 0 4px 16px rgba(0,0,0,0.15); animation: toastIn 0.3s ease; }
.toast-success { background: var(--green); }
.toast-error { background: var(--red); }
@keyframes toastIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ==========================================
   KPI, PASTEL, HERO (dashboard)
   ========================================== */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 28px; }
.kpi-card { background: var(--bg-card); border-radius: var(--r); padding: 22px 20px; border: 1px solid var(--border-light); position: relative; overflow: hidden; transition: transform 0.25s, box-shadow 0.25s; }
.kpi-card:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(0,0,0,0.07); }
.kpi-card .kpi-label { font-size: 11.5px; color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 10px; margin-top: 4px; }
.kpi-card .kpi-value { font-size: 34px; font-weight: 800; color: var(--text-1); letter-spacing: -1px; line-height: 1; }
.kpi-card .kpi-meta { font-size: 12px; color: var(--text-3); margin-top: 8px; font-weight: 500; }
.kpi-card .kpi-meta .positive { color: var(--green); }
.kpi-card .kpi-icon { position: absolute; right: 18px; bottom: 18px; font-size: 28px; opacity: 0.06; color: var(--text-1); }
.pastel-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 28px; }
.pastel-block { padding: 22px; border-radius: var(--r); position: relative; overflow: hidden; cursor: pointer; transition: transform 0.25s, box-shadow 0.25s; }
.pastel-block:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(0,0,0,0.08); }
.pastel-block .block-icon { font-size: 22px; margin-bottom: 10px; opacity: 0.7; }
.pastel-block h4 { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.pastel-block p { font-size: 12.5px; opacity: 0.6; line-height: 1.5; }
.pastel-block .block-count { position: absolute; top: 18px; right: 18px; font-size: 24px; font-weight: 800; opacity: 0.12; }
.pastel-blue { background: var(--pastel-blue); color: #2456A4; }
.pastel-green { background: var(--pastel-green); color: #1B7A42; }
.pastel-yellow { background: var(--pastel-yellow); color: #8B6914; }
.pastel-pink { background: var(--pastel-pink); color: #9B3355; }
.pastel-purple { background: var(--pastel-purple); color: #5B3D99; }
.pastel-orange { background: var(--pastel-orange); color: #9B5B1E; }
.hero-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-bottom: 28px; }
.hero-card { position: relative; border-radius: 18px; padding: 28px; background: var(--bg-card); border: 1px solid var(--border-light); cursor: pointer; min-height: 160px; display: flex; flex-direction: column; justify-content: space-between; transition: transform 0.25s, box-shadow 0.25s; }
.hero-card:hover { transform: translateY(-3px); box-shadow: 0 16px 40px rgba(0,0,0,0.06); }
.hero-card-content { display: flex; align-items: flex-start; gap: 16px; }
.hero-card .hero-icon { width: 56px; height: 56px; border-radius: var(--r); background: #F5F5F5; display: flex; align-items: center; justify-content: center; font-size: 26px; color: var(--text-1); flex-shrink: 0; }
.hero-card .hero-text h3 { font-size: 20px; font-weight: 800; color: var(--text-1); margin-bottom: 4px; letter-spacing: -0.3px; }
.hero-card .hero-text p { font-size: 13px; color: var(--text-2); font-weight: 500; }
.hero-card-meta { display: flex; align-items: flex-end; justify-content: space-between; margin-top: 16px; }
.hero-count { font-size: 36px; font-weight: 800; color: var(--text-1); letter-spacing: -1.2px; line-height: 1; }
.hero-badge { padding: 4px 11px; border-radius: 8px; font-size: 10px; font-weight: 800; letter-spacing: 0.6px; color: #fff; background: var(--text-1); }
.hero-card.hero-pastel-blue { background: var(--pastel-blue); border-color: transparent; }
.hero-card.hero-pastel-blue .hero-text h3, .hero-card.hero-pastel-blue .hero-count { color: #2456A4; }
.hero-card.hero-pastel-blue .hero-text p { color: rgba(36,86,164,0.7); }
.hero-card.hero-pastel-blue .hero-icon { background: rgba(255,255,255,0.7); color: #2456A4; }
.hero-card.hero-pastel-green { background: var(--pastel-green); border-color: transparent; }
.hero-card.hero-pastel-green .hero-text h3, .hero-card.hero-pastel-green .hero-count { color: #1B7A42; }
.hero-card.hero-pastel-green .hero-text p { color: rgba(27,122,66,0.7); }
.hero-card.hero-pastel-green .hero-icon { background: rgba(255,255,255,0.7); color: #1B7A42; }
.hero-card.hero-pastel-yellow { background: var(--pastel-yellow); border-color: transparent; }
.hero-card.hero-pastel-yellow .hero-text h3, .hero-card.hero-pastel-yellow .hero-count { color: #8B6914; }
.hero-card.hero-pastel-yellow .hero-text p { color: rgba(139,105,20,0.7); }
.hero-card.hero-pastel-yellow .hero-icon { background: rgba(255,255,255,0.7); color: #8B6914; }
.hero-card.hero-pastel-purple { background: var(--pastel-purple); border-color: transparent; }
.hero-card.hero-pastel-purple .hero-text h3, .hero-card.hero-pastel-purple .hero-count { color: #5B3D99; }
.hero-card.hero-pastel-purple .hero-text p { color: rgba(91,61,153,0.7); }
.hero-card.hero-pastel-purple .hero-icon { background: rgba(255,255,255,0.7); color: #5B3D99; }

/* Content cards, tasks, projects, meetings */
.content-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 28px; }
.content-card { background: var(--bg-card); border-radius: var(--r); padding: 24px; border: 1px solid var(--border-light); transition: transform 0.25s, box-shadow 0.25s; }
.content-card:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(0,0,0,0.06); }
.content-card h3 { font-size: 14px; font-weight: 700; color: var(--text-1); margin-bottom: 18px; display: flex; align-items: center; gap: 8px; }
.content-card h3 i { font-size: 18px; color: var(--accent); }
.task-list { list-style: none; }
.task-item { display: flex; align-items: center; gap: 10px; padding: 11px 0; font-size: 13.5px; color: var(--text-2); border-bottom: 1px solid var(--border-light); }
.task-item:last-child { border-bottom: none; }
.task-item:hover { color: var(--text-1); }
.task-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: #93C5FD; }
.task-item .date { margin-left: auto; font-size: 12px; color: var(--text-3); font-weight: 500; }
.project-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; font-size: 13.5px; border-bottom: 1px solid var(--border-light); }
.project-row:last-child { border-bottom: none; }
.project-name { width: 130px; font-weight: 600; color: var(--text-1); font-size: 13px; }
.progress-track { flex: 1; height: 6px; background: var(--bg-input); border-radius: 3px; overflow: hidden; }
.project-pct { width: 36px; text-align: right; font-size: 12px; color: var(--text-3); font-weight: 700; }
.full-card { background: var(--bg-card); border-radius: var(--r); padding: 24px; border: 1px solid var(--border-light); margin-bottom: 28px; transition: transform 0.25s, box-shadow 0.25s; }
.full-card:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(0,0,0,0.06); }
.full-card h3 { font-size: 14px; font-weight: 700; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.full-card h3 i { font-size: 18px; color: #8B5CF6; }
.meeting-row { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: var(--r-sm); margin-bottom: 4px; transition: background 0.12s; }
.meeting-row:hover { background: var(--bg); }
.meeting-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.meeting-time { font-size: 13px; font-weight: 700; color: var(--text-1); width: 50px; }
.meeting-title { font-size: 13.5px; color: var(--text-2); font-weight: 500; }
.quick-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 32px; }
.quick-action { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: var(--r-pill); background: var(--bg-card); border: 1px solid var(--border); font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer; transition: all 0.15s; }
.quick-action:hover { border-color: #ccc; color: var(--text-1); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.05); }
.quick-action .action-dot { width: 8px; height: 8px; border-radius: 50%; }
.section-divider { border-top: 1px solid var(--border); padding-top: 32px; margin-top: 36px; margin-bottom: 24px; }
.section-title { font-size: 10px; text-transform: uppercase; letter-spacing: 1.4px; color: var(--text-3); font-weight: 600; margin-bottom: 20px; }
.typo-demo { margin-bottom: 20px; }
.typo-demo h2 { font-family: 'Instrument Serif', Georgia, serif; font-weight: 400; color: var(--text-1); }
.typo-demo p { font-size: 15px; line-height: 1.7; color: var(--text-2); max-width: 520px; margin-top: 6px; }
.btn-row { display: flex; gap: 10px; margin-bottom: 16px; }
.badge-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.domain-badge { padding: 5px 12px; border-radius: var(--r-sm); font-size: 11.5px; font-weight: 700; display: inline-flex; align-items: center; gap: 6px; }
.domain-badge i { font-size: 14px; }
.swatch-grid { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.swatch { width: 56px; height: 56px; border-radius: var(--r); box-shadow: 0 1px 3px rgba(0,0,0,0.03); }
.swatch-name { font-size: 9px; text-align: center; margin-top: 4px; color: var(--text-3); font-weight: 600; }

/* ==========================================
   PTABLE — Projects Grid Table
   ========================================== */
.ptable { background: var(--bg-card); border-radius: var(--r); border: 1px solid var(--border-light); overflow: hidden; }
.ptable-head { display: grid; grid-template-columns: 32px 1fr 100px 150px 50px 36px 70px; padding: 8px 14px; border-bottom: 1px solid var(--border-light); font-size: 10px; text-transform: uppercase; letter-spacing: 0.7px; color: var(--text-4); font-weight: 600; align-items: center; }
.ptable-row { display: grid; grid-template-columns: 32px 1fr 100px 150px 50px 36px 70px; padding: 10px 14px; border-bottom: 1px solid var(--border-light); align-items: center; transition: background 0.1s; cursor: pointer; }
.ptable-row:last-child { border-bottom: none; }
.ptable-row:hover { background: var(--table-row-hover); }
.ptable-row.internal { background: rgba(59,130,246,0.015); }
.ptable-row.internal:hover { background: rgba(59,130,246,0.035); }
.ptable-row.selected { background: #EEF2FF; }
.p-cb { width: 15px; height: 15px; border-radius: 4px; border: 1.5px solid #D0D0D0; cursor: pointer; appearance: none; -webkit-appearance: none; background: #fff; }
.p-cb:checked { background: var(--accent); border-color: var(--accent); }

/* Project cell */
.pcell { display: flex; align-items: center; gap: 9px; min-width: 0; }
.picon { width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 13px; flex-shrink: 0; }
.picon.cli { background: var(--green-soft); color: var(--green); }
.picon.int { background: var(--accent-soft); color: var(--accent); }
.pinfo { min-width: 0; }
.pinfo .pname { font-weight: 600; font-size: 12.5px; color: var(--text-1); white-space: nowrap; }
.pinfo .pcode { font-size: 10.5px; color: var(--text-4); font-family: 'SF Mono', 'Menlo', monospace; }

/* Team avatars */
.p-team { display: flex; }
.p-tm { width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 8.5px; font-weight: 700; color: #fff; margin-left: -5px; border: 2px solid var(--bg-card); }
.p-tm:first-child { margin-left: 0; }
.p-tm-over { width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 8.5px; font-weight: 700; background: var(--bg-input); color: var(--text-3); margin-left: -5px; border: 2px solid var(--bg-card); }

/* Hours */
.p-hrs { display: flex; flex-direction: column; gap: 1px; }
.p-hr { display: flex; align-items: center; gap: 5px; font-size: 11px; }
.p-hr-l { color: var(--text-4); width: 40px; font-weight: 500; }
.p-hr-v { color: var(--text-2); font-weight: 600; }

/* Type badge */
.tbadge { padding: 2px 7px; border-radius: 5px; font-size: 9.5px; font-weight: 700; letter-spacing: 0.5px; }
.tbadge.cli { background: var(--green-soft); color: var(--green); }
.tbadge.int { background: var(--accent-soft); color: var(--accent); }

/* Status dot */
.sdot { width: 9px; height: 9px; border-radius: 50%; cursor: pointer; transition: transform 0.12s; }
.sdot:hover { transform: scale(1.3); }
.s-active { background: var(--green); }
.s-planning { background: var(--purple); }
.s-completed { background: var(--accent); }
.s-hold { background: var(--yellow); }
.s-inactive { background: var(--red); }

/* Actions */
.p-acts { display: flex; align-items: center; gap: 5px; }
.p-alink { font-size: 11px; font-weight: 600; color: var(--accent); cursor: pointer; text-decoration: none; }
.p-alink:hover { text-decoration: underline; }
.p-alink.sub { color: var(--text-3); }
.p-adel { font-size: 15px; color: var(--text-4); cursor: pointer; }
.p-adel:hover { color: var(--red); }

/* Footer */
.ptable-foot { display: flex; align-items: center; gap: 14px; padding: 10px 14px; border-top: 1px solid var(--border-light); font-size: 11.5px; color: var(--text-3); }

/* Responsive: hide columns on mobile */
@media (max-width: 767px) {
  .ptable-head, .ptable-row { grid-template-columns: 1fr 36px 70px; }
  .ptable-head > div:nth-child(1),
  .ptable-head > div:nth-child(3),
  .ptable-head > div:nth-child(4),
  .ptable-head > div:nth-child(5),
  .ptable-row > div:nth-child(1),
  .ptable-row > div:nth-child(3),
  .ptable-row > div:nth-child(4),
  .ptable-row > div:nth-child(5) { display: none; }
}

/* ==========================================
   DOMAIN NAV — breadcrumb + tabs unificate
   ========================================== */
.domain-nav {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 28px 12px;
}
.domain-mode-toggle {
  display: inline-flex; align-items: center;
  padding: 3px; gap: 2px;
  background: var(--bg-input); border-radius: var(--r-pill, 20px);
  flex-shrink: 0;
}
.domain-mode-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 12px; border: none; background: transparent;
  border-radius: var(--r-pill, 20px);
  font-size: 12px; font-weight: 600; color: var(--text-3);
  cursor: pointer; transition: all 0.12s; white-space: nowrap;
  font-family: inherit;
}
.domain-mode-btn i { font-size: 13px; }
.domain-mode-btn:hover { color: var(--text-1); }
.domain-mode-btn.active {
  background: var(--bg-card); color: var(--text-1);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.domain-mode-btn.active i { color: var(--accent); }
@media (max-width: 768px) {
  .domain-mode-toggle { padding: 2px; }
  .domain-mode-btn { padding: 4px 8px; font-size: 11px; }
  .domain-mode-btn span { display: none; }
}
.domain-nav-home { font-size: 12px; color: var(--text-3); text-decoration: none; font-weight: 500; white-space: nowrap; }
.domain-nav-home:hover { color: var(--text-1); }
.domain-nav-sep { font-size: 12px; color: var(--text-4); }
/* Anno contabile (08/10/2026): la tendina in fondo a destra della striscia, solo dentro
   Amministrazione. Stessa pillola del toggle Personale/PM; il select nativo perde la sua
   freccia e ne riceve una nostra (il caret a destra), così resta uguale nei due temi. */
.domain-year {
  display: inline-flex; align-items: center; gap: 6px;
  margin-left: auto; flex-shrink: 0;
  padding: 4px 10px 4px 12px;
  background: var(--bg-input); border-radius: var(--r-pill, 20px);
  font-size: 12px; font-weight: 600; color: var(--text-3);
  cursor: pointer;
}
.domain-year > i:first-child { font-size: 13px; color: var(--accent); }
.domain-year-select {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  border: none; background: transparent; font: inherit; font-weight: 600;
  color: var(--text-1); padding: 2px 14px 2px 2px; margin-right: -14px;
  cursor: pointer; border-radius: 6px;
}
.domain-year-select:focus { outline: none; }
.domain-year-select:focus-visible { box-shadow: 0 0 0 2px var(--accent-soft); }
.domain-year-select option { color: var(--text-1); background: var(--bg-card); }
.domain-year-caret { font-size: 11px; color: var(--text-3); pointer-events: none; }
@media (max-width: 768px) {
  .domain-year { padding: 3px 8px 3px 10px; font-size: 11px; }
}
.domain-nav-tabs { display: flex; align-items: center; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.domain-nav-tabs::-webkit-scrollbar { display: none; }
/* Seconda riga (sottovoci con `parent`): sotto la prima, un filo più piccola. */
.domain-nav:has(.domain-nav-subtabs) { flex-wrap: wrap; row-gap: 2px; }
.domain-nav-subtabs { flex-basis: 100%; padding-left: 4px; }
.domain-nav-subtabs .domain-tab { padding: 5px 12px; font-size: 12px; }
.domain-tab, a.domain-tab, a.domain-tab:link, a.domain-tab:visited {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: var(--r-sm, 10px);
  font-size: 12.5px; font-weight: 600; color: var(--text-3) !important;
  text-decoration: none !important; white-space: nowrap;
  transition: all 0.12s; cursor: pointer;
}
.domain-tab i { font-size: 15px; }
.domain-tab:hover { color: var(--text-1) !important; background: var(--bg-input); }
a.domain-tab.active, a.domain-tab.active:link, a.domain-tab.active:visited {
  color: var(--text-1) !important; background: var(--bg-card);
  border: 1px solid transparent; box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.domain-tab.active i { color: var(--accent) !important; }
.domain-tab-separator { width: 1px; height: 20px; background: var(--border); margin: 0 6px; flex-shrink: 0; }
/* Dropdown "Gestione" per tab role_restricted */
.domain-tab-dropdown { position: relative; }
button.domain-tab { border: none; background: none; font-family: inherit; }
button.domain-tab.active, button.domain-tab.active:hover {
  color: var(--text-1) !important; background: var(--bg-card);
  border: 1px solid transparent; box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
button.domain-tab.active i { color: var(--accent) !important; }
.domain-dropdown-panel {
  position: fixed; z-index: 50;
  min-width: 220px; padding: 6px 0;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--r, 14px); box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}
.domain-dropdown-item, a.domain-dropdown-item, a.domain-dropdown-item:link, a.domain-dropdown-item:visited {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 16px; font-size: 12.5px; font-weight: 500;
  color: var(--text-2) !important; text-decoration: none !important;
  transition: background 0.1s;
}
.domain-dropdown-item i { font-size: 15px; color: var(--text-3); }
.domain-dropdown-item:hover { background: var(--bg-input); }
a.domain-dropdown-item.active, a.domain-dropdown-item.active:link, a.domain-dropdown-item.active:visited {
  color: var(--accent) !important; font-weight: 600; background: var(--accent-soft);
}
a.domain-dropdown-item.active i { color: var(--accent) !important; }
@media (max-width: 767px) {
  .domain-nav { padding: 0 16px 10px; }
  .domain-tab { padding: 6px 10px; font-size: 11.5px; }
  .domain-tab-separator { margin: 0 2px; }
  .domain-dropdown-panel { right: auto; left: 0; min-width: 200px; }
}

/* ==========================================
   NS-SELECT — Custom dropdown (Alpine.js)
   Sostituisce <select> nativi con dropdown stilizzati DS v2.
   Usa: partial partials/ns-select-init.ejs per il JS.
   ========================================== */
.ns-select { position: relative; }
.ns-select.is-open,
.ns-select:has(.ns-select-trigger.open) { z-index: 200; }
/* ============================================================
   DROPDOWN/POPOVER STACKING — fix universale
   ============================================================
   Il .card base in design-system.css ha overflow:hidden + le card
   sibling possono coprire popover absolute. Quando una .card
   contiene un dropdown/popover aperto, sollevarla e liberare overflow.

   Pattern catturati:
   - .ns-select (custom select Alpine)
   - .dt-popover (DataTable edit inline, Alpine x-show)
   - .task-slash-palette (slash menu rich-editor)
   - convenzioni *.is-open / *-popover.is-open / *-popup.is-open
*/
.card:has(.ns-select.is-open),
.card:has(.ns-select-trigger.open),
.card:has(.dt-popover:not([style*="display: none"])),
.card:has([data-dt-popover]:not([style*="display: none"])),
.card:has(.task-slash-palette.is-open),
.card:has([class*="-popover"].is-open),
.card:has([class*="-popup"].is-open),
.card:has([class*="-menu"].is-open),
.card:has([class*="-dropdown"].is-open) {
  position: relative;
  z-index: 100;
  overflow: visible;
}
.ns-select-trigger {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 9px 13px; font-size: 13px; font-family: inherit;
  border: 1px solid var(--border); border-radius: var(--r-sm, 10px);
  background: var(--bg-card); color: var(--text-1); cursor: pointer;
  transition: border-color 0.15s; user-select: none; min-height: 38px;
}
.ns-select-trigger:hover { border-color: #D0D0D0; }
.ns-select-trigger.open { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(3,100,248,0.08); border-radius: var(--r-sm, 10px) var(--r-sm, 10px) 0 0; }
.ns-select-trigger .ns-caret { font-size: 14px; color: var(--text-4); transition: transform 0.15s; flex-shrink: 0; }
.ns-select-trigger.open .ns-caret { transform: rotate(180deg); }
.ns-select-trigger .ns-placeholder { color: var(--text-4); }
.ns-select-trigger .ns-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.ns-select-trigger .ns-val { display: flex; align-items: center; gap: 8px; min-width: 0; }

.ns-select-drop {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 200;
  background: var(--bg-card); border: 1px solid var(--accent);
  border-top: none; border-radius: 0 0 var(--r-sm, 10px) var(--r-sm, 10px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
  max-height: 220px; overflow-y: auto; padding: 4px;
}
.ns-select-search { padding: 6px 6px 4px; }
.ns-select-search input {
  width: 100%; border: none; background: var(--bg-input); border-radius: 8px;
  padding: 7px 10px; font-size: 12.5px; font-family: inherit; color: var(--text-1); outline: none;
}
.ns-select-search input::placeholder { color: var(--text-4); }
.ns-select-group { padding: 8px 10px 3px; font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-4); font-weight: 600; }
.ns-select-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 8px; cursor: pointer;
  font-size: 13px; color: var(--text-2); transition: background 0.1s;
}
.ns-select-item:hover { background: var(--accent-soft); color: var(--text-1); }
.ns-select-item.sel { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.ns-select-item .ns-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.ns-select-item .ns-check { font-size: 14px; margin-left: auto; color: var(--accent); }

/* ==========================================
   UTILITIES
   ========================================== */
.flex-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-28 { margin-bottom: 28px; }
.mt-16 { margin-top: 16px; }

/* ==========================================
   AI BRIEFING (ambient intelligence header)
   Moved here from ds-v2.css so both main.ejs
   and main-v2.ejs can use it.
   ========================================== */
.ai-briefing { margin-bottom: 20px; }

.ai-briefing-metrics {
  font-size: 12.5px; color: var(--text-3); margin-top: 4px;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.ai-briefing-metrics .m-val { font-weight: 600; }
.ai-briefing-metrics .m-bad { color: var(--red); }
.ai-briefing-metrics .m-warn { color: var(--yellow); }
.ai-briefing-metrics .m-ok { color: var(--accent); }
.ai-briefing-metrics .m-sep { color: var(--text-4); }

.ai-briefing-card {
  margin-top: 12px; padding: 14px 16px;
  border-radius: var(--r-sm, 10px);
  background: var(--accent-soft); border-left: 3px solid var(--accent);
  display: flex; align-items: flex-start; gap: 10px;
  transition: opacity 0.2s;
}
.ai-briefing-card i.ai-icon {
  font-size: 16px; color: var(--accent); flex-shrink: 0; margin-top: 1px;
}
.ai-briefing-card .ai-text {
  font-size: 12.5px; color: var(--text-2); line-height: 1.5;
}
.ai-briefing-card .ai-text strong { color: var(--text-1); }

.ai-briefing-card .ai-actions {
  display: flex; gap: 8px; margin-top: 8px;
}
.ai-btn {
  padding: 5px 14px; border-radius: 8px; border: none;
  font-family: inherit; font-size: 11.5px; font-weight: 600; cursor: pointer;
  transition: all 0.12s;
}
.ai-btn-yes { background: var(--accent); color: #fff; }
.ai-btn-yes:hover { background: #0250C7; }
.ai-btn-later { background: var(--bg-card); color: var(--text-3); border: 1px solid var(--border); }
.ai-btn-later:hover { border-color: var(--text-4); }
.ai-btn-dismiss { background: none; color: var(--text-4); padding: 5px 8px; }
.ai-btn-dismiss:hover { color: var(--text-2); }

html.dark .ai-briefing-card { background: rgba(3,100,248,0.08) !important; }

/* ==========================================
   PM PIPELINE — Editorial DS v2 (namespace pmp-)
   Specifiche della view /backend/projects/pm/pipeline
   ========================================== */

/* KPI row — pastello pieno */
.pmp-kpi-row {
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 14px; margin-bottom: 28px;
}
.pmp-kpi {
  position: relative;
  border-radius: var(--r); padding: 18px 20px 20px;
  min-height: 110px; overflow: hidden;
  transition: transform 0.15s;
}
.pmp-kpi:hover { transform: translateY(-1px); }
.pmp-kpi-purple { background: #eef0fc; color: #4338ca; }
.pmp-kpi-blue   { background: #e4edff; color: #1e40af; }
.pmp-kpi-yellow { background: #fef3c7; color: #92400e; }
.pmp-kpi-green  { background: #dcfce7; color: #166534; }
.pmp-kpi-red    { background: #fee2e2; color: #991b1b; }
.pmp-kpi-icon-tl { font-size: 22px; opacity: 0.85; margin-bottom: 18px; display: block; }
.pmp-kpi-value-tr {
  position: absolute; top: 14px; right: 18px;
  font-size: 40px; font-weight: 700; line-height: 1;
  opacity: 0.18; letter-spacing: -0.02em;
}
.pmp-kpi-name { font-size: 15px; font-weight: 700; margin-bottom: 2px; color: inherit; }
.pmp-kpi-sub  { font-size: 12.5px; font-weight: 500; opacity: 0.75; color: inherit; }
@media (max-width: 900px) {
  .pmp-kpi-row { grid-template-columns: repeat(2, 1fr); }
}

/* Main grid */
.pmp-main-grid { display: grid; grid-template-columns: 3fr 1fr; gap: 24px; }
@media (max-width: 1100px) {
  .pmp-main-grid { grid-template-columns: 1fr; }
}

/* Kanban */
.pmp-kanban-wrap { overflow-x: auto; padding-bottom: 8px; }
.pmp-kanban-wrap::-webkit-scrollbar { height: 6px; }
.pmp-kanban-wrap::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.pmp-kanban-cols { display: flex; gap: 14px; min-width: min-content; }
.pmp-kanban-col { width: 286px; flex-shrink: 0; }

/* Phase header */
.pmp-phase-header {
  padding: 14px 16px; border-radius: var(--r) var(--r) 0 0;
  border-bottom: 2px solid;
}
.pmp-phase-head-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 4px;
}
.pmp-phase-badge { display: inline-flex; align-items: center; gap: 8px; }
.pmp-phase-num {
  width: 28px; height: 28px; border-radius: 50%;
  color: #fff; font-weight: 700; font-size: 12px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.pmp-phase-label { font-weight: 600; font-size: 14px; color: var(--text-1); }
.pmp-phase-count {
  padding: 3px 10px; background: var(--bg-card); border-radius: var(--r-pill);
  font-size: 11px; font-weight: 600; color: var(--text-2);
  border: 1px solid var(--border-light);
}
.pmp-phase-desc { font-size: 11.5px; color: var(--text-3); margin-top: 4px; font-weight: 500; }
.pmp-phase-body {
  background: var(--bg-card); border: 1px solid var(--border-light);
  border-top: none; border-radius: 0 0 var(--r) var(--r);
  min-height: 340px; padding: 10px; display: flex; flex-direction: column; gap: 10px;
}

/* Project card */
.pmp-pcard {
  background: var(--bg-card); border: 1px solid var(--border-light);
  border-radius: var(--r-sm);
  padding: 14px 14px 12px;
  cursor: pointer; transition: all 0.15s;
  border-left: 6px solid var(--border);
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.pmp-pcard:hover {
  border-color: var(--accent); border-left-color: var(--accent);
  box-shadow: 0 2px 8px rgba(37,99,235,0.08);
  transform: translateY(-1px);
}
.pmp-pcard-critical { border-left-color: var(--red); }
.pmp-pcard-high     { border-left-color: var(--yellow); }
.pmp-pcard-top {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 10px; gap: 8px;
}
.pmp-pcard-title {
  font-size: 14.5px; font-weight: 600; line-height: 1.3;
  color: var(--text-1);
}
.pmp-pcard-client {
  font-size: 11.5px; color: var(--text-3); margin-top: 3px; font-weight: 500;
}
.pmp-pcard-flag { font-size: 15px; flex-shrink: 0; }
.pmp-pcard-flag.critical { color: var(--red); }
.pmp-pcard-flag.high     { color: var(--yellow); }
.pmp-pcard-meta {
  display: flex; align-items: center; gap: 6px;
  font-size: 11.5px; color: var(--text-3); margin-bottom: 8px;
}
.pmp-pcard-meta i { font-size: 13px; color: var(--text-4); }
.pmp-pcard-progress {
  height: 4px; background: var(--border-light); border-radius: 2px;
  overflow: hidden; margin-bottom: 10px;
}
.pmp-pcard-progress-bar { height: 100%; border-radius: 2px; }
.pmp-pcard-foot {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11px; color: var(--text-3);
  padding-top: 8px; border-top: 1px dashed var(--border-light);
}

/* Empty phase */
.pmp-empty-phase {
  text-align: center; padding: 32px 16px; color: var(--text-4);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.pmp-empty-phase i { font-size: 32px; color: var(--border); }
.pmp-empty-phase p { font-size: 12.5px; font-weight: 500; }

/* Sidebar */
.pmp-sidebar {
  background: var(--bg-card); border: 1px solid var(--border-light);
  border-radius: var(--r);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  position: sticky; top: 20px;
  max-height: calc(100vh - 40px); overflow-y: auto;
  align-self: start;
}
.pmp-sidebar-section { padding: 20px 20px 18px; }
.pmp-sidebar-section + .pmp-sidebar-section { border-top: 1px solid var(--border-light); }
.pmp-sidebar-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.pmp-sidebar-title {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 20px; font-weight: 400; color: var(--text-1);
  letter-spacing: -0.01em;
}
.pmp-badge-count {
  padding: 3px 10px; background: var(--yellow-soft); color: var(--yellow);
  border-radius: var(--r-pill); font-size: 11px; font-weight: 600;
}

/* Approval card */
.pmp-appr-card {
  background: var(--bg-input); border: 1px solid var(--border-light);
  border-radius: var(--r-sm); padding: 14px;
  margin-bottom: 10px; transition: all 0.15s;
}
.pmp-appr-card:hover { border-color: var(--accent); background: var(--bg-card); }
.pmp-appr-top {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 8px; gap: 8px;
}
.pmp-appr-title { font-size: 13.5px; font-weight: 600; color: var(--text-1); }
.pmp-appr-type  { font-size: 11px; color: var(--text-3); margin-top: 2px; text-transform: capitalize; }
.pmp-appr-urgent {
  padding: 2px 8px; background: var(--red-soft); color: var(--red);
  border-radius: var(--r-pill); font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em; flex-shrink: 0;
}
.pmp-appr-meta { font-size: 11.5px; color: var(--text-3); margin-bottom: 12px; line-height: 1.6; }
.pmp-appr-actions { display: flex; gap: 6px; }
.pmp-appr-actions .btn { flex: 1; padding: 6px 10px; font-size: 11.5px; }

/* Btn variante danger ghost per "Rifiuta" */
.pmp-btn-danger-ghost { color: var(--red) !important; border-color: var(--red) !important; }
.pmp-btn-danger-ghost:hover { background: var(--red-soft) !important; }

/* Team utilization */
.pmp-team-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.pmp-team-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--purple-soft); color: var(--purple);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; flex-shrink: 0;
  /* Effetto 3D editorial (visual contract sez. Avatar) */
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.40),
    inset 0 -2px 0 rgba(0, 0, 0, 0.08),
    0 1px 3px rgba(0, 0, 0, 0.06);
}
.pmp-team-info { flex: 1; min-width: 0; }
.pmp-team-line {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11.5px; margin-bottom: 4px;
}
.pmp-team-name  { color: var(--text-2); font-weight: 500; }
.pmp-team-hours { color: var(--text-4); font-weight: 500; }
.pmp-team-bar   { height: 4px; background: var(--border-light); border-radius: 2px; overflow: hidden; }
.pmp-team-bar-fill { height: 100%; border-radius: 2px; }

/* Empty state sidebar */
.pmp-empty {
  text-align: center; padding: 32px 16px; color: var(--text-4);
}
.pmp-empty i { font-size: 42px; color: var(--border); display: block; margin-bottom: 10px; }
.pmp-empty-title {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 16px; color: var(--text-3); font-weight: 400;
}
.pmp-empty-desc { font-size: 12px; margin-top: 4px; color: var(--text-4); }

/* ==========================================
   MODAL UNIFICATION — override globale
   ==========================================
   Alza i modali Tailwind (fixed inset-0 z-50) sopra sidebar/topbar (z-100).
   Vale per tutte le app NorthStar che usano questo kernel CSS.
*/
.fixed.inset-0.z-50 {
  z-index: 160 !important;
}

/* ====== Badge «Da configurare» nel menu (middleware/setup-badges.js, partials/sb-da-configurare.ejs) ======
   Pillola gialla ricavata dal token --yellow: giusta in chiaro e in scuro, testo sempre --text-1 (leggibile).
   Nella barra chiusa sparisce con gli altri span della voce (.sidebar.collapsed .sb-item span). */
.sb-badge-setup {
  margin-left: auto; flex: none;
  font-size: 9.5px; font-weight: 700; letter-spacing: .3px; line-height: 1;
  padding: 3px 7px; border-radius: var(--r-pill, 20px);
  color: var(--text-1);
  background: color-mix(in srgb, var(--yellow, #D97706) 20%, transparent);
  border: 1px solid color-mix(in srgb, var(--yellow, #D97706) 55%, transparent);
  white-space: nowrap;
}
.sb-sub-link:has(.sb-badge-setup) { display: flex; align-items: center; gap: 6px; }
/* Sulla voce attiva (fondo scuro pieno) la pillola si inverte con i colori della voce stessa: leggibile in ogni tema. */
.sidebar .sb-item.active .sb-badge-setup {
  background: var(--sidebar-item-active-text); color: var(--sidebar-item-active-bg); border-color: var(--sidebar-item-active-text);
}
