/* ==========================================================================
   NOWY UI 2.0 — "Linear": denso, preciso, premium. Si carica per ULTIMO.
   13px, righe 34-36px, pulsanti 28px, accento indaco, fili al posto delle ombre,
   percorso piccolo al posto del titolone, tema scuro curato come principale.
   ========================================================================== */
:root {
  --nw-accent: #5e6ad2; --nw-accent-hover: #6c78e6; --nw-accent-tint: rgba(94, 106, 210, .12);
  --bs-primary: #5e6ad2; --bs-primary-rgb: 94, 106, 210; --bs-link-color: #5e6ad2;
  --nw-canvas: #f4f5f8; --nw-panel-bg: #ffffff; --nw-surface: #ffffff; --nw-surface-2: #f8f9fb; --nw-band: #f4f5f7;
  --nw-label: #1b1c1f; --nw-label-2: #5f636b; --nw-label-3: #8b8f97;
  --nw-border: #e6e7eb; --nw-sep: #eceef1; --nw-sep-strong: #dfe1e6;
  --nw-fill: rgba(27, 28, 31, .06); --nw-fill-2: rgba(27, 28, 31, .035);
  --nw-r-lg: 8px; --nw-r: 7px; --nw-r-sm: 6px;
  --nw-elev-1: 0 0 0 1px var(--nw-border); --nw-elev-2: 0 0 0 1px var(--nw-sep-strong), 0 8px 24px -8px rgba(16, 18, 27, .18);
  --nw-highlight: 0 0 #0000; --nw-shadow: var(--nw-elev-1);
  --nw-font: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable", "Segoe UI", system-ui, sans-serif;
}
html[data-theme="dark"] {
  --nw-accent: #7079e0; --nw-accent-hover: #828af0; --nw-accent-tint: rgba(112, 121, 224, .16);
  --bs-primary: #7079e0; --bs-link-color: #8c93f0;
  --nw-canvas: #0f1011; --nw-panel-bg: #151618; --nw-surface: #18191c; --nw-surface-2: #1c1d21; --nw-band: #1b1c20;
  --nw-label: #eeeff1; --nw-label-2: #9a9ea6; --nw-label-3: #6c7078;
  --nw-border: rgba(255, 255, 255, .07); --nw-sep: rgba(255, 255, 255, .055); --nw-sep-strong: rgba(255, 255, 255, .10);
  --nw-fill: rgba(255, 255, 255, .07); --nw-fill-2: rgba(255, 255, 255, .04);
  --nw-elev-1: 0 0 0 1px var(--nw-border); --nw-elev-2: 0 0 0 1px var(--nw-sep-strong), 0 16px 40px -12px rgba(0, 0, 0, .8);
  --nw-sidebar: #0f1011;
}

/* --- tipografia -------------------------------------------------------------------------------------- */
body { font-family: var(--nw-font); font-size: 13px; letter-spacing: -.003em; font-feature-settings: "cv11", "ss01", "ss03";
  background: var(--nw-canvas); color: var(--nw-label); }
.small, small { font-size: 12px; }
.text-muted, .nw-note { color: var(--nw-label-2) !important; }

/* --- struttura: tela + finestra ------------------------------------------------------------------------ */
.sidebar { width: 232px; flex-basis: 232px; padding: 0 8px 20px 10px; }
.content { margin: 6px 6px 6px 0; height: calc(100vh - 12px); border-radius: 10px; background: var(--nw-panel-bg);
  box-shadow: 0 0 0 1px var(--nw-border), 0 1px 2px rgba(16, 18, 27, .04); padding: 0 24px 40px; }
html[data-theme="dark"] .content { box-shadow: 0 0 0 1px var(--nw-border); }

/* barra in alto: percorso piccolo al posto del titolone */
.topbar { margin: 0 -24px 16px; padding: 10px 20px; min-height: 46px; background: var(--nw-panel-bg);
  border-bottom: 1px solid var(--nw-sep); border-radius: 10px 10px 0 0; align-items: center; }
.topbar h1 { font-size: 13.5px; font-weight: 500; letter-spacing: -.01em; display: flex; align-items: center; gap: 6px; }
.nw-crumb { color: var(--nw-label-2); font-weight: 500; }
.nw-crumb-sep { color: var(--nw-label-3); font-weight: 400; margin: 0 6px; }
.topbar .subtitle { font-size: 12px; color: var(--nw-label-3); margin-top: 0; }
.topbar .d-flex > div > .subtitle { display: none; }   /* il contesto va nella pagina, non sotto il percorso */
.topbar-right { gap: 6px; }
.topbar-right .badge.text-bg-warning-subtle { font-size: 11px; font-weight: 500; }
.user { font-size: 12px; }

/* --- pulsanti 28px ------------------------------------------------------------------------------------ */
.btn { height: 28px; padding: 0 10px; font-size: 12.5px; font-weight: 500; border-radius: 6px; display: inline-flex; align-items: center;
  gap: 6px; letter-spacing: -.005em; line-height: 1; }
.btn-sm { height: 26px; padding: 0 9px; font-size: 12.5px; border-radius: 6px; }
.btn-lg { height: 34px; font-size: 13.5px; }
.btn:active { transform: none; }
.btn-primary { background: var(--nw-accent); color: #fff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), 0 0 0 1px rgba(0, 0, 0, .06); }
.btn-primary:hover, .btn-primary:focus { background: var(--nw-accent-hover); color: #fff; }
.btn-success { background: #4cb782; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15); }
.btn-danger { background: #eb5757; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15); }
.btn-outline-secondary, .btn[class*="btn-outline-"] { background: transparent !important; color: var(--nw-label) !important;
  box-shadow: inset 0 0 0 1px var(--nw-sep-strong) !important; }
.btn-outline-secondary:hover, .btn[class*="btn-outline-"]:hover { background: var(--nw-fill-2) !important; }
.btn-outline-primary { color: var(--nw-accent) !important; }
.btn-outline-danger { color: #eb5757 !important; } .btn-outline-success { color: #4cb782 !important; }
td .btn-outline-secondary { box-shadow: none !important; color: var(--nw-label-2) !important; }
td .btn-outline-secondary:hover { color: var(--nw-label) !important; }
.btn-pill { border-radius: 6px !important; }

/* --- campi 30px -------------------------------------------------------------------------------------- */
.form-control, .form-select { min-height: 30px; font-size: 13px; border-radius: 6px; box-shadow: none; border-color: var(--nw-sep-strong);
  background-color: transparent; padding-top: 4px; padding-bottom: 4px; }
.form-control-sm, .form-select-sm { min-height: 28px; font-size: 12.5px; }
.form-control:focus, .form-select:focus { box-shadow: 0 0 0 3px var(--nw-accent-tint); border-color: var(--nw-accent); background-color: transparent; }
html[data-theme="dark"] .form-select { background-color: var(--nw-surface); }
.form-label { font-size: 12px; font-weight: 500; }
.nw-search .form-control { background: var(--nw-fill-2); border-color: transparent; }

/* --- card, pannelli: fili, niente ombre ------------------------------------------------------------- */
.card, .kpi, .nw-stat, .board-col, .nw-list, .nw-metrics { border-radius: 8px; box-shadow: 0 0 0 1px var(--nw-border) !important; background: var(--nw-surface); }
.card-header { background: transparent !important; font-size: 13px; font-weight: 500; padding: 10px 14px; border-bottom: 1px solid var(--nw-sep); }
.card-body { padding: 14px; }
a.kpi:hover, a.nw-stat:hover { transform: none; background: var(--nw-surface-2); }
.kpi, .nw-stat { padding: 12px 14px; }
.kpi .label, .nw-stat .label { font-size: 12px; }
.kpi .value, .nw-stat .value { font-size: 22px; font-weight: 600; }
.nw-metric { padding: 12px 14px 10px; }
.nw-metric .value { font-size: 20px; font-weight: 600; }
.nw-h2 { font-size: 14px; font-weight: 600; margin: 22px 0 10px; letter-spacing: -.01em; }
.nw-h2 .hint { font-size: 12px; }
.alert { border-radius: 8px; font-size: 13px; padding: 10px 14px; box-shadow: none; }

/* --- tabelle: righe 36px ------------------------------------------------------------------------------ */
table.table { font-size: 13px; }
table.table thead th { font-size: 12px; font-weight: 500; color: var(--nw-label-3); padding: 8px 12px; background: var(--nw-band) !important; }
table.table td { padding: 7px 12px; border-color: var(--nw-sep); }
table.table tbody tr:hover { box-shadow: none; background: var(--nw-fill-2); }

/* --- segmenti, chip, pillole alla Linear -------------------------------------------------------------- */
.nw-seg { padding: 2px; border-radius: 7px; background: var(--nw-fill-2); box-shadow: inset 0 0 0 1px var(--nw-sep); gap: 0; }
.nw-seg > a, .nw-seg > button, .nw-seg > label { font-size: 12.5px; padding: 3px 10px; border-radius: 5px; font-weight: 500; color: var(--nw-label-2); }
.nw-seg > .active, .nw-seg > input:checked + label { background: var(--nw-surface); color: var(--nw-label);
  box-shadow: 0 0 0 1px var(--nw-sep-strong), 0 1px 1px rgba(0, 0, 0, .04); }
html[data-theme="dark"] .nw-seg > .active { background: #26272c; box-shadow: 0 0 0 1px rgba(255, 255, 255, .08); }
.nw-chip { font-size: 12.5px; padding: 3px 10px; border-radius: 999px; background: transparent; box-shadow: inset 0 0 0 1px var(--nw-sep-strong); font-weight: 500; }
.nw-chip.active { background: var(--nw-fill); color: var(--nw-label); box-shadow: inset 0 0 0 1px var(--nw-sep-strong); }
html[data-theme="dark"] .nw-chip.active { background: rgba(255, 255, 255, .09) !important; color: var(--nw-label) !important; }
.nw-chip.suggested, .nw-tag.suggested { box-shadow: none; border: 1px dashed var(--nw-sep-strong); }
.nw-tag { border-radius: 999px; font-size: 12px; padding: 2px 9px; background: transparent; box-shadow: inset 0 0 0 1px var(--nw-sep-strong); color: var(--nw-label-2); }
.badge { font-size: 11px; font-weight: 500; padding: 3px 8px; box-shadow: none; }
.pill { font-size: 12px; padding: 2px 8px; background: transparent; box-shadow: inset 0 0 0 1px var(--nw-sep-strong); color: var(--nw-label-2); }

/* codici: tabellari, grigi, spaziati (ENG-2459) */
.mono, .nw-row .id, .nw-code { font-family: var(--nw-font); font-variant-numeric: tabular-nums; letter-spacing: .02em; color: var(--nw-label-3); font-size: 12.5px; font-weight: 500; }
.nw-row .title .mono { color: var(--nw-label-3); }

/* avatar a sfumatura (persone) */
.nw-avatar { width: 20px; height: 20px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-size: 9.5px; font-weight: 600; color: #fff; background: linear-gradient(135deg, var(--a1, #8ec5fc), var(--a2, #a78bfa));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18); flex: 0 0 auto; }

/* --- liste raggruppate: fascia di gruppo + righe 36px ------------------------------------------------- */
.nw-group-head { background: var(--nw-band); font-size: 13px; font-weight: 500; padding: 7px 16px; border-color: var(--nw-sep); }
.nw-group-head .n { color: var(--nw-label-3); }
.nw-row { min-height: 36px; padding: 6px 16px; font-size: 13px; border-color: var(--nw-sep); gap: 10px; }
.nw-row .title { font-weight: 500; color: var(--nw-label); }
.nw-row .title .muted { font-weight: 400; color: var(--nw-label-3); }
.nw-row .date { font-size: 12px; }
.nw-statbox { border-radius: 8px; background: transparent; box-shadow: inset 0 0 0 1px var(--nw-sep); padding: 10px 14px; }
.nw-statbox .v { font-size: 18px; font-weight: 600; }

/* --- righe proprietà alla Linear (etichetta grigia a sinistra, valore a destra) --------------------- */
.nw-props { display: grid; grid-template-columns: 120px 1fr; row-gap: 4px; column-gap: 12px; align-items: center; font-size: 13px; }
.nw-props > dt { font-weight: 400; color: var(--nw-label-3); margin: 0; padding: 4px 0; }
.nw-props > dd { margin: 0; padding: 3px 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; color: var(--nw-label); }

/* --- barra laterale alla Linear ----------------------------------------------------------------------- */
.nw-side-head { padding: 12px 2px 8px; }
.nw-logo { width: 22px; height: 22px; border-radius: 6px; font-size: 12px; }
.nw-ws-name { font-size: 13.5px; font-weight: 600; }
.nw-side-new { display: flex; gap: 6px; margin: 0 2px 10px; }
.nw-side-new a { height: 28px; border-radius: 6px; display: inline-flex; align-items: center; color: var(--nw-label); font-size: 13px; font-weight: 500;
  box-shadow: inset 0 0 0 1px var(--nw-sep-strong); background: var(--nw-surface); }
html[data-theme="dark"] .nw-side-new a { background: #18191c; }
.nw-side-new a:hover { background: var(--nw-surface-2); color: var(--nw-label); }
.nw-side-new .new { flex: 1; gap: 8px; padding: 0 9px; }
.nw-side-new .new i { color: var(--nw-label-2); }
.nw-side-new .find { width: 28px; justify-content: center; color: var(--nw-label-2); }
.nw-side-compose, .nw-side-icon { display: none; }
.nav-item { padding: 4px 8px; margin: 1px 0; font-size: 13px; font-weight: 450; border-radius: 6px; min-height: 28px; gap: 9px; }
.nav-item.active, html[data-theme="dark"] .nav-item.active { background: var(--nw-fill); box-shadow: none; font-weight: 500; }
.sidebar .nav-item .ico { width: 16px; height: 16px; flex-basis: 16px; }
.sidebar .nav-item .ico i { font-size: 14.5px; }
.nw-nav-toggle { padding: 14px 8px 4px; font-size: 11.5px; }
.nw-count { height: 18px; min-width: 20px; font-size: 11px; border-radius: 5px; font-weight: 500; }

/* planning */
.board-list { background: transparent; }
.dcard { border-radius: 7px; padding: 8px 10px; box-shadow: 0 0 0 1px var(--nw-sep-strong), inset 2px 0 0 var(--nw-accent); }
.dcard:hover { transform: none; box-shadow: 0 0 0 1px var(--nw-label-3), inset 2px 0 0 var(--nw-accent); }
.dcard .t { font-size: 13px; font-weight: 500; }

@media (max-width: 992px) { .content { margin: 0; border-radius: 0; height: auto; padding: 0 14px 30px; } .topbar { margin: 0 -14px 14px; border-radius: 0; } }

/* filtri in barra: i campi non vanno a tutta larghezza (date, select) */
.nw-toolbar .form-control, .nw-toolbar .form-select, .nw-filterbar .form-control, .nw-filterbar .form-select { width: auto; flex: 0 0 auto; }
.nw-toolbar .nw-search .form-control { width: 100%; }
.nw-toolbar form { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
