/* ═══════════════════════════════════════════════════════════════
   Data Lake Project Console — Design System
   Editorial-industrial: Fraunces + Inter + JetBrains Mono
   ML TWO palette (navy + gold) on warm paper
   ═══════════════════════════════════════════════════════════════ */

:root {
  /* Palette — ML TWO editorial on warm paper */
  --paper: #FAF7F1;
  --paper-warm: #F4EFE4;
  --paper-tint: #EFE8D8;
  --ink: #1A1815;
  --ink-soft: #3D3833;
  --ink-mute: #6B655D;
  --rule: #D8CFBF;
  --rule-soft: #E8E0D0;

  --navy: #1B3A5C;
  --navy-deep: #0F2540;
  --navy-soft: #2B4E75;
  --gold: #C4944A;
  --gold-light: #D4AD6B;
  --gold-deep: #8E682D;

  /* Status colors — muted, editorial */
  --status-todo: #A69885;
  --status-progress: #B8852E;      /* amber, in corso */
  --status-done: #5B7A4F;          /* sage green */
  --status-blocked: #A8443A;       /* clay red */

  /* Type */
  --ff-display: 'Fraunces', Georgia, serif;
  --ff-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --ff-mono: 'JetBrains Mono', 'SF Mono', Menlo, monospace;

  /* Spacing scale */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 64px;

  --radius-sm: 2px;
  --radius: 3px;

  /* Layout */
  --max-w: 1280px;
  --header-h: 68px;
  --strip-h: 96px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  /* min-height, non height: con height:100% il contenitore della testata resta
     alto quanto la finestra e lo `position: sticky` smette di reggere dopo la
     prima schermata, facendo sparire la barra durante lo scorrimento */
  min-height: 100%;
  font-family: var(--ff-body);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Subtle paper texture */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    radial-gradient(circle at 1px 1px, rgba(27, 58, 92, 0.02) 1px, transparent 0);
  background-size: 32px 32px;
}

a { color: var(--navy); text-decoration: none; }
a:hover { color: var(--gold-deep); }

button { font-family: inherit; }

/* ═══════════ HEADER ═══════════ */
.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(250, 247, 241, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
  height: var(--header-h);
}
.app-header-inner {
  max-width: var(--max-w);
  height: 100%;
  margin: 0 auto;
  padding: 0 var(--s-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-5);
}
.brand {
  display: flex;
  align-items: center;
  gap: var(--s-3);
}
/* Marchio ML TWO: il monogramma è l'immagine, "TWO" resta testo accanto */
.brand-logo {
  height: 34px;
  width: auto;
  display: block;
}
.brand-mark {
  font-family: var(--ff-body);
  font-weight: 300;
  font-size: 19px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--navy);
  padding-left: 2px;
}
.brand-sub {
  font-family: var(--ff-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-mute);
  padding-left: var(--s-4);
  margin-left: var(--s-1);
  border-left: 1px solid var(--rule);
}
.header-nav {
  display: flex;
  gap: var(--s-5);
  align-items: center;
  font-size: 13px;
}
.header-nav a {
  color: var(--ink-soft);
  padding: var(--s-2) 0;
  position: relative;
  transition: color 0.15s;
}
.header-nav a:hover { color: var(--navy); }
.header-nav a.active {
  color: var(--navy);
}
.header-nav a.active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -22px;
  height: 2px;
  background: var(--gold);
}

/* ═══════════ MAIN CONTAINER ═══════════ */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: var(--s-7) var(--s-6);
  position: relative;
  z-index: 1;
}
.container-narrow {
  max-width: 900px;
  margin: 0 auto;
  padding: var(--s-7) var(--s-6);
  position: relative;
  z-index: 1;
}

/* ═══════════ TYPOGRAPHY ═══════════ */
.eyebrow {
  font-family: var(--ff-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold-deep);
  display: flex;
  align-items: center;
  gap: var(--s-3);
}
.eyebrow::before {
  content: "";
  display: inline-block;
  width: 24px;
  height: 1px;
  background: var(--gold);
}

.page-title {
  font-family: var(--ff-display);
  font-weight: 300;
  font-size: clamp(42px, 5vw, 68px);
  line-height: 0.98;
  letter-spacing: -0.03em;
  color: var(--navy);
  margin: var(--s-4) 0 var(--s-5) 0;
}
.page-title em {
  font-style: italic;
  color: var(--gold);
  font-weight: 500;
}
.page-lead {
  font-family: var(--ff-display);
  font-weight: 400;
  font-size: 20px;
  line-height: 1.5;
  color: var(--ink-soft);
  max-width: 620px;
}

.section-title {
  font-family: var(--ff-display);
  font-weight: 400;
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: -0.015em;
  color: var(--navy);
  margin: var(--s-7) 0 var(--s-5) 0;
  padding-bottom: var(--s-3);
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: baseline;
  gap: var(--s-4);
}
.section-title em {
  font-style: italic;
  color: var(--gold);
}
.section-num {
  font-family: var(--ff-mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  color: var(--ink-mute);
  font-weight: 500;
}

.label {
  font-family: var(--ff-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

/* ═══════════ BUTTONS ═══════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: 10px 18px;
  border: 1px solid var(--navy);
  background: var(--navy);
  color: var(--paper);
  font-family: var(--ff-body);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  cursor: pointer;
  border-radius: var(--radius);
  transition: all 0.15s ease;
}
.btn:hover {
  background: var(--navy-deep);
  border-color: var(--navy-deep);
  color: var(--paper);
}
.btn-secondary {
  background: transparent;
  color: var(--navy);
}
.btn-secondary:hover {
  background: var(--paper-warm);
  color: var(--navy-deep);
}
.btn-danger {
  background: transparent;
  color: var(--status-blocked);
  border-color: var(--status-blocked);
}
.btn-danger:hover {
  background: var(--status-blocked);
  color: var(--paper);
}
.btn-small {
  padding: 6px 12px;
  font-size: 11px;
}
.btn-icon {
  padding: 6px 10px;
  font-family: var(--ff-mono);
}

/* ═══════════ CARDS ═══════════ */
.card {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: var(--s-5);
  transition: all 0.2s ease;
}
.card:hover {
  border-color: var(--navy);
  box-shadow: 0 4px 20px rgba(27, 58, 92, 0.06);
}

/* ═══════════ PROJECT CARDS (home) ═══════════ */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: var(--s-5);
  margin-top: var(--s-5);
}
.project-card {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: var(--s-5) var(--s-5) var(--s-4);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}
.project-card:hover {
  border-color: var(--navy);
  box-shadow: 0 8px 24px rgba(27, 58, 92, 0.08);
  transform: translateY(-2px);
}
.project-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--gold);
  opacity: 0;
  transition: opacity 0.2s;
}
.project-card:hover::before { opacity: 1; }
.project-card-delete {
  position: absolute;
  top: var(--s-3);
  right: var(--s-3);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink-mute);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: all 0.15s ease;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
}
.project-card:hover .project-card-delete { opacity: 1; }
.project-card-delete:hover {
  background: var(--status-blocked);
  border-color: var(--status-blocked);
  color: var(--paper);
}
.project-card-edit {
  position: absolute;
  top: var(--s-3);
  right: calc(var(--s-3) + 34px);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink-mute);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: all 0.15s ease;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
}
.project-card:hover .project-card-edit { opacity: 1; }
.project-card-edit:hover {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--paper);
}
.project-card-client {
  font-family: var(--ff-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-deep);
  margin-bottom: var(--s-2);
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: 26px;      /* la riga non balla fra chi ha il logo e chi no */
}

/* Il marchio del cliente accanto al suo nome, sulle card e nelle testate.
   Riquadro bianco a proporzioni fisse: i loghi arrivano quadrati, larghi o
   altissimi, e senza un contenitore che li contenga la riga si deformerebbe a
   seconda del file caricato. */
/* Riga che spiega dove finisce l'attività dell'agenda a seconda di cosa si è
   scelto: le tre tendine da sole non dicono che si possono lasciare vuote. */
.assoc-hint { font-size: 12px; color: var(--ink-mute); line-height: 1.4; }
.assoc-hint-cell { display: flex; align-items: flex-end; padding-bottom: 9px; }

.card-logo {
  height: 26px; max-width: 74px; object-fit: contain; flex: none;
  background: #fff; border: 1px solid var(--rule-soft); border-radius: 3px;
  padding: 2px 3px;
}
.eyebrow .card-logo { height: 30px; max-width: 90px; }
.project-card-name {
  font-family: var(--ff-display);
  font-weight: 500;
  font-size: 22px;
  line-height: 1.2;
  color: var(--navy);
  margin-bottom: var(--s-3);
  letter-spacing: -0.01em;
}
.project-card-desc {
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.5;
  margin-bottom: var(--s-4);
  min-height: 40px;
}
.project-card-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--s-3);
  padding-top: var(--s-4);
  border-top: 1px solid var(--rule);
}
.metric {
  font-family: var(--ff-mono);
}
.metric-value {
  font-size: 20px;
  font-weight: 500;
  color: var(--navy);
  line-height: 1;
}
.metric-value em {
  color: var(--gold);
  font-style: normal;
}
.metric-label {
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-top: 4px;
}

/* ═══════════ PHASE STRIP (signature element) ═══════════ */
.phase-strip {
  background: var(--paper-warm);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: var(--s-4) 0;
  overflow-x: auto;
  scrollbar-width: thin;
}
.phase-strip-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--s-6);
  display: flex;
  gap: 0;
  min-height: 74px;
}
.phase-cell {
  flex: 1;
  min-width: 78px;
  padding: var(--s-3) var(--s-3);
  border-right: 1px solid var(--rule);
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.phase-cell:first-child { border-left: 1px solid var(--rule); }
.phase-cell:hover {
  background: var(--paper);
}
.phase-cell.active {
  background: var(--navy);
  color: var(--paper);
}
.phase-cell.active .phase-cell-num { color: var(--gold-light); }
.phase-cell.active .phase-cell-name { color: var(--paper); }
.phase-cell.active .phase-cell-progress { background: rgba(196, 148, 74, 0.3); }
.phase-cell.active .phase-cell-progress::after { background: var(--gold); }

.phase-cell-num {
  font-family: var(--ff-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--ink-mute);
  font-weight: 500;
}
.phase-cell-name {
  font-family: var(--ff-display);
  font-weight: 500;
  font-size: 12px;
  line-height: 1.15;
  color: var(--navy);
  margin: 4px 0;
  letter-spacing: -0.005em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.phase-cell-progress {
  height: 3px;
  background: var(--rule);
  position: relative;
  border-radius: 2px;
  overflow: hidden;
}
.phase-cell-progress::after {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: var(--pct, 0%);
  background: var(--gold);
  transition: width 0.4s ease;
}
.phase-cell-status {
  font-family: var(--ff-mono);
  font-size: 8px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: 3px;
  color: var(--ink-mute);
}
.phase-cell[data-status="In corso"] .phase-cell-status { color: var(--status-progress); }
.phase-cell[data-status="Completata"] .phase-cell-status { color: var(--status-done); }
.phase-cell[data-status="Bloccata"] .phase-cell-status { color: var(--status-blocked); }

/* ═══════════ STATUS PILLS ═══════════ */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 20px;
  font-family: var(--ff-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  font-weight: 500;
  text-transform: uppercase;
  border: 1px solid transparent;
}
.pill-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}
/* Completato: al posto del pallino, una spunta. È il segno che si legge senza
   dover distinguere le sfumature di colore, e vale ovunque compaia la pill —
   progetti, fasi, clienti, portale. Il verde c'era già. */
.pill-done .pill-dot { display: none; }
.pill-done::before { content: "✓"; font-size: 11px; line-height: 1; font-weight: 700; }

.pill-todo    { background: rgba(166, 152, 133, 0.14); color: var(--status-todo); border-color: rgba(166, 152, 133, 0.35); }
.pill-progress{ background: rgba(184, 133, 46, 0.12); color: var(--status-progress); border-color: rgba(184, 133, 46, 0.35); }
.pill-done    { background: rgba(91, 122, 79, 0.12); color: var(--status-done); border-color: rgba(91, 122, 79, 0.35); }
.pill-blocked { background: rgba(168, 68, 58, 0.12); color: var(--status-blocked); border-color: rgba(168, 68, 58, 0.35); }

/* ═══════════ TABLES ═══════════ */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.data-table thead th {
  background: var(--paper-warm);
  font-family: var(--ff-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute);
  padding: var(--s-3) var(--s-4);
  text-align: left;
  border-bottom: 1px solid var(--rule);
  font-weight: 500;
}
.data-table thead th.num,
.data-table td.num {
  text-align: right;
  font-family: var(--ff-mono);
}
.data-table tbody td {
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--rule-soft);
  vertical-align: middle;
}
.data-table tbody tr:hover td {
  background: var(--paper-warm);
}
.data-table tbody tr:last-child td { border-bottom: none; }
/* Riga che si apre: il puntatore lo dice prima del click, e il nome si accende
   come un link — su una tabella tutta uguale non si scopre che è cliccabile. */
.data-table tbody tr.is-clickable { cursor: pointer; }
.data-table tbody tr.is-clickable:hover strong { color: var(--gold-deep) !important; }

/* ══ Dettaglio dei costi imputati ═══════════════════════════════════════════
   Un aggregato che non si può aprire lascia chi legge senza strada per risalire
   alle ragioni delle ore: qui la riga del fornitore porta alle imputazioni che
   la compongono, e in fondo alla tabella si apre il dettaglio di tutte. */
.cost-detail-all td { background: var(--paper-warm); text-align: right; }
.modal.cdet-wide { width: min(1020px, calc(100% - 40px)); }
.cdet-tot { display: flex; gap: var(--s-6); flex-wrap: wrap; padding: var(--s-4) var(--s-5);
  background: var(--paper-warm); border: 1px solid var(--rule); border-radius: var(--radius); }
.cdet-tot > div { display: flex; flex-direction: column; gap: 2px; }
.cdet-tot span { font-family: var(--ff-mono); font-size: 9.5px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--ink-mute); }
.cdet-tot strong { font-family: var(--ff-display); font-size: 21px; font-weight: 500;
  color: var(--navy); }
/* Perché delle ore non diventano costo: si dice in testa, non si lascia dedurre. */
.cdet-avvisi { margin: var(--s-4) 0 0; padding: var(--s-3) var(--s-5); list-style: disc;
  background: #FBF6EC; border-left: 3px solid var(--gold); border-radius: 0 8px 8px 0;
  font-size: 12.5px; color: var(--ink-soft); }
.cdet-avvisi li { margin: 4px 0; }
.cdet-avvisi strong { color: var(--navy); font-weight: 500; }
.cdet-att { margin-top: var(--s-5); border: 1px solid var(--rule); border-radius: var(--radius);
  overflow: hidden; }
.cdet-att-h { display: flex; justify-content: space-between; align-items: baseline;
  gap: var(--s-4); flex-wrap: wrap; padding: var(--s-3) var(--s-4); background: var(--paper); }
.cdet-att-n { font-size: 14.5px; font-weight: 500; color: var(--navy); }
.cdet-att-m { font-size: 11.5px; color: var(--ink-mute); margin-top: 2px; }
.cdet-att-v { display: flex; gap: var(--s-3); align-items: baseline; font-family: var(--ff-mono);
  font-size: 12px; color: var(--ink-mute); white-space: nowrap; }
.cdet-att-v strong { font-size: 14px; color: var(--navy); }
.cdet-tags { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 var(--s-4) var(--s-3); }
.cdet-tag { font-family: var(--ff-mono); font-size: 9.5px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink-mute); border: 1px solid var(--rule);
  border-radius: var(--radius-sm); padding: 1px 6px; }
.cdet-tag-warn { color: var(--status-blocked); border-color: var(--status-blocked); }
.cdet-tag-cli { color: var(--gold-deep); border-color: var(--gold); }
.cdet-tab { border-top: 1px solid var(--rule); }
.cdet-tab tbody tr.is-cliente td { background: #FCFAF4; }
.cdet-g { font-family: var(--ff-mono); font-size: 12px; white-space: nowrap; }
.cdet-ruolo { font-size: 11.5px; color: var(--ink-mute); }
.cdet-nota { font-size: 12px; color: var(--ink-soft); }
.cdet-nulla { color: var(--ink-mute); }

/* Activity table specific */
.activities-table {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow-x: auto;   /* la checklist è larga: scorri in orizzontale invece di tagliare */
}
/* Mantieni le larghezze di colonna: non far collassare Ore/Costo/date
   (+ colonna Utente assegnato) */
.activities-table > table {
  min-width: 1290px;
}
/* La descrizione dell'attività prende tutto lo spazio che avanza: è la colonna
   che si legge davvero, le altre hanno larghezze fisse dichiarate nel markup */
.activities-table .activity-desc {
  min-width: 340px;
  line-height: 1.45;
}
.activities-table thead th.act-desc-head { min-width: 340px; }
/* Input Ore: larghezza fissa e leggibile, con spazio per gli spinner numerici */
.activities-table .inline-input-num {
  width: 64px;
  padding-right: 4px;
}
/* Input data nella checklist: compatti ma leggibili */
.activities-table input[type="date"].inline-input {
  width: 100%;
  min-width: 118px;
}

/* Execution type: internal vs external distinction */
.activity-row.exec-external {
  box-shadow: inset 3px 0 0 var(--gold);
}
.activity-row.exec-internal {
  box-shadow: inset 3px 0 0 var(--navy-soft);
}
.exec-select {
  font-family: var(--ff-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
}
.activity-row.exec-external .exec-select { color: var(--gold-deep); font-weight: 500; }
.activity-row.exec-internal .exec-select { color: var(--navy); }
.activity-row.exec-internal .vendor-select { color: var(--ink-mute); }
.activity-row.exec-external .vendor-select { color: var(--gold-deep); font-weight: 500; }
.activity-desc {
  font-size: 14px;
  color: var(--ink);
  line-height: 1.4;
}
/* Attività completata nella checklist: spunta verde e testo verde. Prima era
   grigio barrato — diceva «fatto» ma lo diceva come si dice «scaduto», e a
   colpo d'occhio spariva invece di risultare compiuto. */
.activity-row.done .activity-desc,
.activity-row.done .act-open {
  color: var(--status-done);
}
.activity-row.done .activity-desc::before {
  content: "✓";
  color: var(--status-done);
  font-weight: 700;
  margin-right: 6px;
}
.activity-row.done { background: rgba(91, 122, 79, 0.05); }

/* Campo di sola lettura dentro un form: stessa riga degli altri, ma senza cornice
   — si vede che è un dato del progetto, non qualcosa da compilare. */
/* Campo importo: allineato a destra come i numeri delle tabelle, così le cifre
   si confrontano incolonnate invece che a partire dal simbolo. */
input[data-money] { text-align: right; font-variant-numeric: tabular-nums; }

/* Azione dentro un testo di aiuto: si comporta da link ma è un pulsante, perché
   non porta da nessuna parte — fa qualcosa qui. */
.link-btn { border: none; background: none; padding: 0; font: inherit; cursor: pointer;
  color: var(--gold-deep); text-decoration: underline; text-underline-offset: 2px; }
.link-btn:hover { color: var(--navy); }

.form-static { font-size: 14px; color: var(--navy); padding: 9px 0; font-weight: 500; }
.form-static a { color: var(--navy); text-decoration: none; border-bottom: 1px solid var(--rule); }
.form-static a:hover { color: var(--gold-deep); border-bottom-color: var(--gold); }

/* Inline editable fields */
.inline-select,
.inline-input {
  font-family: inherit;
  font-size: 13px;
  padding: 5px 8px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: var(--radius-sm);
  color: var(--ink);
  transition: all 0.15s;
  width: 100%;
}
.inline-select:hover,
.inline-input:hover {
  border-color: var(--rule);
  background: var(--paper);
}
.inline-select:focus,
.inline-input:focus {
  outline: none;
  border-color: var(--navy);
  background: var(--paper);
}
.inline-input-num {
  text-align: right;
  font-family: var(--ff-mono);
  font-size: 13px;
}

/* ═══════════ SUMMARY GRID (dashboard) ═══════════ */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  margin-top: var(--s-5);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper);
  overflow: hidden;
}
.summary-cell {
  padding: var(--s-5);
  border-right: 1px solid var(--rule);
  position: relative;
}
.summary-cell:last-child { border-right: none; }
.summary-label {
  font-family: var(--ff-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: var(--s-3);
}
.summary-value {
  font-family: var(--ff-display);
  font-weight: 300;
  font-size: 42px;
  line-height: 1;
  color: var(--navy);
  letter-spacing: -0.02em;
}
.summary-value em {
  font-style: italic;
  color: var(--gold);
}
.summary-unit {
  font-family: var(--ff-mono);
  font-size: 11px;
  color: var(--ink-mute);
  margin-left: 6px;
  font-weight: normal;
}
.summary-sub {
  font-size: 12px;
  color: var(--ink-mute);
  margin-top: var(--s-2);
}

/* Progress bar */
.progress-bar {
  height: 8px;
  background: var(--paper-warm);
  border: 1px solid var(--rule);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}
/* ── Barre di Charts.hbars ───────────────────────────────────────
   Stavano dentro keplero.html, sotto .bi-page: usandole anche nella chat una
   seconda copia sarebbe divergita dalla prima al primo ritocco. Chi disegna
   mette .chart-scope sul contenitore. */
.chart-scope .bars { display: flex; flex-direction: column; gap: 9px; }
.chart-scope .bar-row { display: grid; grid-template-columns: 120px 1fr auto;
  align-items: center; gap: 10px; font-size: 12.5px; }
.chart-scope .bar-row .lab { color: var(--ink-soft); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.chart-scope .track { height: 10px; background: var(--paper-tint, var(--paper-warm));
  border-radius: 100px; overflow: hidden; }
.chart-scope .fill { height: 100%; border-radius: 100px;
  background: var(--navy-soft, var(--navy)); }
.chart-scope .fill.gold { background: var(--gold); }
.chart-scope .fill.pos { background: var(--pos, var(--status-done)); }
.chart-scope .fill.warn { background: var(--warn, var(--status-blocked)); }
.chart-scope .val { font-variant-numeric: tabular-nums; color: var(--navy);
  font-weight: 600; font-size: 12px; min-width: 52px; text-align: right; }

/* La stessa barra, in miniatura, dentro il riquadro di un KPI sulla card di un
   progetto: il numero dice quanto, la barra lo fa vedere. */
.metric-bar { height: 4px; margin-top: 7px; border-radius: 3px; }

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--navy) 0%, var(--gold) 100%);
  transition: width 0.5s ease;
}

/* ═══════════ MODAL ═══════════ */
/* Dialog aperta: la pagina sotto si blocca (la classe la mette common.js).
   `scrollbar-gutter` tiene lo spazio della barra di scorrimento anche mentre è
   bloccata, altrimenti alla sua comparsa il contenuto salta di lato. */
html { scrollbar-gutter: stable; }
body.has-modal { overflow: hidden; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(26, 24, 21, 0.5);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}
.modal {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  width: min(560px, calc(100% - 40px));
  max-height: calc(100vh - 80px);
  /* Colonna flessibile: header e footer fissi, solo il corpo scorre → i pulsanti
     restano sempre visibili senza dover scrollare l'intera dialog. */
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(20px);
  transition: transform 0.25s ease;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}
.modal-backdrop.open .modal { transform: translateY(0); }
.modal-header {
  padding: var(--s-5) var(--s-5) var(--s-4);
  border-bottom: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-shrink: 0;
}
.modal-title {
  font-family: var(--ff-display);
  font-weight: 500;
  font-size: 22px;
  color: var(--navy);
  letter-spacing: -0.01em;
}
.modal-close {
  background: none;
  border: none;
  color: var(--ink-mute);
  cursor: pointer;
  font-size: 20px;
  padding: 4px 8px;
  line-height: 1;
}
.modal-close:hover { color: var(--navy); }
/* `contain`: arrivato in fondo, il corpo della dialog NON passa lo scorrimento
   alla pagina sotto. Senza, continuando a girare la rotellina si scorreva la
   pagina e si perdeva il punto in cui si stava leggendo. */
.modal-body { padding: var(--s-5); overflow-y: auto; overscroll-behavior: contain; flex: 1 1 auto; }
.modal-footer {
  padding: var(--s-4) var(--s-5);
  border-top: 1px solid var(--rule);
  display: flex;
  justify-content: flex-end;
  gap: var(--s-3);
  background: var(--paper-warm);
  flex-shrink: 0;
}

/* Forms */
.form-group {
  margin-bottom: var(--s-4);
}
.form-label {
  display: block;
  font-family: var(--ff-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 6px;
  font-weight: 500;
}
.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  border: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink);
  border-radius: var(--radius);
  transition: all 0.15s;
}
.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(27, 58, 92, 0.1);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-4);
}

/* Checklist a caselle (es. voci dell'oggetto del contratto, modale «Genera documento») */
.doc-gen-check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--rule-soft, #efe9dd);
  cursor: pointer;
}
.doc-gen-check-item:last-child { border-bottom: none; }
.doc-gen-check-item input[type="checkbox"] {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  accent-color: var(--navy);
}
.doc-gen-check-tag {
  font-family: var(--ff-mono);
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-mute);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 1px 7px;
  margin-left: auto;
  flex-shrink: 0;
}

/* Link "Gestisci archivio" accanto al titolo della checklist «Oggetto» (contratti/LOI) */
.objcat-manage-link {
  background: none;
  border: none;
  padding: 0;
  font-family: var(--ff-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--navy);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.objcat-manage-link:hover { color: var(--gold-deep); }

/* Pannello «Gestisci archivio»: righe editabili con testo, tag sorgente e toggle
   attiva/disattiva (static/js/object-catalog.js, riusato da contratti e fornitori) */
.objcat-item {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  padding: 9px 0;
  border-bottom: 1px solid var(--rule-soft, #efe9dd);
}
.objcat-item:last-child { border-bottom: none; }
/* Testo su textarea a piena larghezza che va a capo: si legge/edita tutto senza scroll. */
.objcat-item-text {
  width: 100%;
  resize: vertical;
  line-height: 1.4;
  min-height: 2.6em;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.objcat-item-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.objcat-item--off .objcat-item-text { color: var(--ink-mute); opacity: 0.7; }
.objcat-item--off .doc-gen-check-tag { opacity: 0.6; }

/* Form su due colonne (dialog attività): meno scroll verticale. Condiviso da
   scheda azienda e calendario. Il layout complessivo della dialog (più larga,
   con gli allegati affiancati) è in agenda.css (.modal-event-wide/.event-dialog-grid). */
.event-form { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3) var(--s-4); }
.event-form .form-group { margin-bottom: 0; }
.event-form .span2 { grid-column: 1 / -1; }

/* ═══════════ EMPTY / STATES ═══════════ */
.empty-state {
  text-align: center;
  padding: var(--s-8) var(--s-5);
  color: var(--ink-mute);
}
.empty-state h3 {
  font-family: var(--ff-display);
  font-weight: 400;
  font-size: 24px;
  color: var(--ink-soft);
  margin-bottom: var(--s-3);
}
.empty-state p {
  font-size: 15px;
  margin-bottom: var(--s-5);
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}

/* ═══════════ BREADCRUMB ═══════════ */
/* Ritorno al livello superiore: un percorso si legge, un pulsante si clicca.
   Sta sopra il breadcrumb, con il nome di dove si torna scritto per esteso —
   «←» e basta non dice dove porta. */
.crumb-back {
  display: inline-flex; align-items: center; gap: 7px;
  margin-bottom: var(--s-3); padding: 5px 12px 5px 9px;
  border: 1px solid var(--rule); border-radius: 999px;
  background: var(--paper); color: var(--ink-soft);
  font-family: var(--ff-body); font-size: 12.5px; text-decoration: none;
  transition: color .12s, border-color .12s, background .12s;
  max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.crumb-back:hover { color: var(--navy); border-color: var(--navy); background: var(--paper-warm); }
.crumb-back span { font-size: 14px; line-height: 1; }

.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-size: 12px;
  color: var(--ink-mute);
  margin-bottom: var(--s-5);
  font-family: var(--ff-mono);
  letter-spacing: 0.04em;
}
.breadcrumb a { color: var(--ink-mute); }
.breadcrumb a:hover { color: var(--navy); }
.breadcrumb-sep { color: var(--rule); }
.breadcrumb-current { color: var(--navy); font-weight: 500; }

/* ═══════════ TOAST ═══════════ */
.toast {
  position: fixed;
  bottom: var(--s-5);
  right: var(--s-5);
  background: var(--navy);
  color: var(--paper);
  padding: var(--s-3) var(--s-5);
  border-radius: var(--radius);
  font-size: 13px;
  z-index: 200;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  transform: translateY(20px);
  opacity: 0;
  transition: all 0.25s ease;
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  transform: translateY(0);
}
/* Toast "azionabile" (con link, es. download del documento appena generato):
   resta cliccabile, a differenza del toast informativo semplice. */
.toast-action { pointer-events: auto; }
.toast-action a { color: var(--gold-light); text-decoration: underline; margin-left: 6px; font-weight: 500; }
.toast-action a:hover { color: var(--paper); }

/* ═══════════ COST TABLE ═══════════ */
.cost-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-5);
  margin: var(--s-5) 0;
}
.cost-block {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
}
.cost-block-header {
  padding: var(--s-4) var(--s-5);
  background: var(--navy);
  color: var(--paper);
  font-family: var(--ff-display);
  font-weight: 500;
  font-size: 16px;
  letter-spacing: -0.005em;
}
.cost-total-block {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-deep) 100%);
  color: var(--paper);
  padding: var(--s-5) var(--s-6);
  border-radius: var(--radius);
  border-left: 4px solid var(--gold);
  margin-top: var(--s-5);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-5);
}
.cost-total-label {
  font-family: var(--ff-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-light);
}
.cost-total-value {
  font-family: var(--ff-display);
  font-weight: 300;
  font-size: 52px;
  color: var(--paper);
  letter-spacing: -0.02em;
  line-height: 1;
}
.cost-total-value em {
  color: var(--gold);
  font-style: italic;
  font-weight: 400;
}

/* ═══════════ EXECUTION SPLIT (internal vs external) ═══════════ */
.exec-split-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-4);
  margin-top: var(--s-5);
}
.exec-split-card {
  padding: var(--s-5);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper);
}
.exec-split-internal { border-left: 4px solid var(--navy); }
.exec-split-external { border-left: 4px solid var(--gold); }
.exec-split-tag {
  font-family: var(--ff-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: var(--s-3);
}
.exec-split-value {
  font-family: var(--ff-display);
  font-weight: 300;
  font-size: 40px;
  color: var(--navy);
  line-height: 1;
  letter-spacing: -0.02em;
}
.exec-split-unit {
  font-family: var(--ff-mono);
  font-size: 11px;
  color: var(--ink-mute);
  margin-left: 8px;
  font-weight: normal;
}
.exec-split-detail {
  display: flex;
  justify-content: space-between;
  margin-top: var(--s-3);
  padding-top: var(--s-3);
  border-top: 1px solid var(--rule-soft);
  font-family: var(--ff-mono);
  font-size: 13px;
  color: var(--ink-soft);
}
.exec-split-bar {
  display: flex;
  height: 40px;
  margin-top: var(--s-4);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--rule);
}
.exec-split-bar-internal, .exec-split-bar-external {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--ff-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--paper);
  transition: width 0.5s ease;
  white-space: nowrap;
}
.exec-split-bar-internal { background: var(--navy); }
.exec-split-bar-external { background: var(--gold); }

@media (max-width: 900px) {
  .exec-split-grid { grid-template-columns: 1fr; }
}

/* ═══════════ PHASE LIST (project page) ═══════════ */
.phase-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: var(--s-5);
}
.phase-list-item {
  display: grid;
  grid-template-columns: 60px 1fr 140px 100px 120px 140px;
  gap: var(--s-4);
  padding: var(--s-4) var(--s-5);
  background: var(--paper);
  align-items: center;
  cursor: pointer;
  transition: background 0.15s;
  text-decoration: none;
  color: var(--ink);
}
.phase-list-item:hover {
  background: var(--paper-warm);
}
.phase-list-num {
  font-family: var(--ff-mono);
  font-size: 20px;
  color: var(--gold);
  font-weight: 500;
}
.phase-list-name {
  font-family: var(--ff-display);
  font-weight: 500;
  font-size: 16px;
  color: var(--navy);
  letter-spacing: -0.005em;
}
.phase-list-duration {
  font-family: var(--ff-mono);
  font-size: 11px;
  color: var(--ink-mute);
  letter-spacing: 0.06em;
}
.phase-list-progress {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.phase-list-progress-num {
  font-family: var(--ff-mono);
  font-size: 12px;
  color: var(--ink-mute);
}
.phase-list-metrics {
  font-family: var(--ff-mono);
  font-size: 12px;
  text-align: right;
  color: var(--ink-mute);
}
.phase-list-metrics strong {
  color: var(--navy);
  font-weight: 500;
  font-size: 13px;
}

/* Layout helpers */
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-s { gap: var(--s-3); }
.gap-m { gap: var(--s-4); }
.gap-l { gap: var(--s-5); }
.mt-l { margin-top: var(--s-5); }
.mt-xl { margin-top: var(--s-7); }
.mb-l { margin-bottom: var(--s-5); }
.hidden { display: none !important; }

/* Testo per i soli lettori di schermo (label di campi che hanno già un contesto visivo) */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}


/* Responsive */
@media (max-width: 900px) {
  .container, .container-narrow { padding: var(--s-5) var(--s-4); }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .summary-cell:nth-child(2) { border-right: none; }
  .summary-cell:nth-child(1), .summary-cell:nth-child(2) { border-bottom: 1px solid var(--rule); }
  .phase-list-item { grid-template-columns: 40px 1fr auto; gap: var(--s-3); }
  .phase-list-duration, .phase-list-progress, .phase-list-metrics { display: none; }
  .cost-summary { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .header-nav { display: none; }
  .brand-sub { display: none; }   /* su schermi stretti resta solo il marchio */
}

/* Scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--paper-warm); }
::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-mute); }

/* ═══════════════════════════════════════════════════════════════
   Gantt / Timeline (shared by /timeline and project dashboard)
   ═══════════════════════════════════════════════════════════════ */
.gantt-controls { display: flex; align-items: center; gap: var(--s-4); flex-wrap: wrap; margin-bottom: var(--s-5); }
.seg-control { display: inline-flex; border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; }
.seg-btn { font-family: var(--ff-mono); font-size: 12px; letter-spacing: 0.04em; padding: 9px 16px; background: var(--paper); color: var(--ink-soft); border: none; cursor: pointer; border-right: 1px solid var(--rule); }
.seg-btn:last-child { border-right: none; }
.seg-btn:hover { background: var(--paper-warm); }
.seg-btn.active { background: var(--navy); color: var(--paper); }
.gantt-picker-label { font-family: var(--ff-mono); font-size: 12px; color: var(--ink-mute); margin-right: var(--s-2); }
.gantt-select { display: inline-block; width: auto; min-width: 260px; }

.gantt { border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper); overflow-x: auto; }
.gantt-head-row, .gantt-row { display: flex; align-items: stretch; min-width: 720px; }
.gantt-head-row { border-bottom: 2px solid var(--rule); background: var(--paper-warm); }
.gantt-label { width: 240px; flex-shrink: 0; padding: 10px var(--s-4); border-right: 1px solid var(--rule); display: flex; flex-direction: column; justify-content: center; gap: 2px; }
.gantt-head-corner { font-family: var(--ff-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-mute); justify-content: center; }
.gantt-label-client { font-family: var(--ff-mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold-deep); }
.gantt-label-name { font-weight: 500; color: var(--navy); font-size: 14px; line-height: 1.2; }
.gantt-act-name { font-weight: 400; font-size: 13px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 210px; }
.gantt-label-meta { font-size: 11px; color: var(--ink-mute); }
a.gantt-label:hover .gantt-label-name { color: var(--gold-deep); }

.gantt-months { display: flex; flex: 1; }
.gantt-month { font-family: var(--ff-mono); font-size: 11px; color: var(--ink-mute); padding: 10px 6px; border-right: 1px solid var(--rule-soft); text-align: center; white-space: nowrap; overflow: hidden; }
.gantt-year { color: var(--gold-deep); }

.gantt-body .gantt-row { border-bottom: 1px solid var(--rule-soft); }
.gantt-body .gantt-row:last-child { border-bottom: none; }
.gantt-row-phase { background: rgba(27,58,92,0.04); }
.gantt-label-phase .gantt-label-client { color: var(--navy); }
.gantt-row-act .gantt-label-act { padding-left: var(--s-5); }

.gantt-track { flex: 1; position: relative; min-height: 40px; display: flex; align-items: center; background-image: repeating-linear-gradient(90deg, transparent, transparent calc(100% / 12 - 1px), var(--rule-soft) calc(100% / 12 - 1px), var(--rule-soft) calc(100% / 12)); }
.gantt-bar { position: absolute; height: 22px; border-radius: 4px; background: var(--fill); display: flex; align-items: center; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.12); min-width: 6px; }
.gantt-bar-slim { height: 14px; border-radius: 3px; opacity: 0.85; }
/* ── I passi dentro la linea dell'attività ──────────────────────────────────
   Una striscia sottile subito sotto la barra: i tratti stanno DENTRO il periodo
   dell'attività e dicono cosa succede in mezzo, che la barra da sola non dice.
   Sotto e non sopra, così la barra resta leggibile per quello che è. */
.gantt-steps { position: absolute; left: 0; right: 0; top: calc(50% + 7px); height: 11px; }
.gantt-step { position: absolute; top: 0; height: 11px; border-radius: 2px;
  background: var(--ink-mute); opacity: .9; display: flex; align-items: center;
  justify-content: center; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(255,255,255,.35); }
.gantt-step.st-In-corso { background: var(--navy); }
.gantt-step.st-Fatto { background: var(--status-done); }
/* Periodo DEDOTTO (la fetta del periodo dell'attività), non scelto da nessuno:
   tratteggiato, perché una data dedotta non deve spacciarsi per una decisa. */
.gantt-step.is-auto { opacity: .72; background-image: repeating-linear-gradient(
    115deg, rgba(255,255,255,.18) 0 3px, transparent 3px 7px); }
.gantt-step-chi { display: flex; gap: 3px; }
/* Le iniziali stanno SOPRA il tratteggio: senza l'ombra si confondevano con le
   righe diagonali, e due lettere illeggibili valgono meno di nessuna lettera. */
.gantt-step-chi i { font-family: var(--ff-mono); font-style: normal; font-size: 8px;
  letter-spacing: .04em; color: #fff; line-height: 1; white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0,0,0,.55); }
/* Barra con avanzamento: traccia chiara + quota fatta PIENA. Prima era il
   contrario (barra piena, velo bianco sulla parte fatta) e il completato sembrava
   il mancante. `color-mix` schiarisce il colore di stato senza doverne passare due. */
.gantt-bar-track { background: color-mix(in srgb, var(--fill) 18%, transparent);
  border: 1px solid var(--fill); box-shadow: none; }
.gantt-bar-progress { position: absolute; left: 0; top: 0; bottom: 0; background: var(--fill); }
.gantt-bar:not(.gantt-bar-track) .gantt-bar-progress { background: rgba(255,255,255,0.28); }
.gantt-bar-label { position: relative; font-family: var(--ff-mono); font-size: 10px; color: #fff; padding: 0 6px; white-space: nowrap; font-weight: 500; }
/* La percentuale sta FUORI dalla barra: dentro finirebbe sopra il pieno o sopra il
   vuoto a seconda del valore, illeggibile in uno dei due casi. */
.gantt-bar-side { position: absolute; font-family: var(--ff-mono); font-size: 10px;
  color: var(--ink-soft); white-space: nowrap; pointer-events: none; }

/* Barre modificabili: si trascinano dal corpo e si allungano dalle maniglie ai
   due estremi. Le maniglie restano invisibili finché non ci si passa sopra —
   una barra costellata di appigli è rumore, e il cursore basta a dire cosa fa. */
.gantt-bar.is-editable { cursor: grab; }
.gantt-bar.is-editable.is-dragging { cursor: grabbing; box-shadow: 0 2px 10px rgba(15,37,64,.30); }
.gantt-grip { position: absolute; top: 0; bottom: 0; width: 9px; cursor: ew-resize;
  opacity: 0; transition: opacity .12s; }
.gantt-grip::after { content: ''; position: absolute; top: 3px; bottom: 3px; left: 3px;
  width: 3px; border-radius: 2px; background: var(--paper); box-shadow: 0 0 0 1px rgba(0,0,0,.25); }
.gantt-grip-l { left: 0; }
.gantt-grip-r { right: 0; }
.gantt-bar.is-editable:hover .gantt-grip, .gantt-bar.is-dragging .gantt-grip { opacity: 1; }
/* Durante il trascinamento il cursore non deve cambiare passando sopra altro */
body.gantt-grabbing, body.gantt-grabbing * { cursor: grabbing !important; user-select: none; }
body.gantt-resizing, body.gantt-resizing * { cursor: ew-resize !important; user-select: none; }
.gantt-nodate { font-size: 11px; color: var(--ink-mute); font-style: italic; padding-left: var(--s-4); }
.gantt-project-head { margin-bottom: var(--s-3); }

/* Nota di aiuto sotto un campo form */
.form-hint { font-size: 11.5px; color: var(--ink-mute); margin-top: 4px; line-height: 1.4; }

/* PF5 — stima durata con AI: pulsantino accanto ai campi durata */
.hours-cell { display: flex; align-items: center; gap: 4px; }
.ai-estimate-btn {
  flex: none; border: 1px solid var(--rule); background: var(--paper);
  border-radius: 6px; cursor: pointer; font-size: 12px; line-height: 1;
  padding: 3px 5px; color: var(--navy);
}
.ai-estimate-btn:hover { background: var(--paper-warm); border-color: var(--gold); }
.ai-estimate-btn:disabled { opacity: 0.5; cursor: default; }

/* PF3 — modale «Genera documento» (contratto/LOI): Parte 1 e Parte 2 in due box
   affiancati sulla stessa riga, con logo della controparte; sotto, a piena
   larghezza, i termini dell'accordo. Riusato da contracts.html e vendors.html. */
/* Modale «Genera documento»: più largo, così Fonte|Controparte stanno affiancati in
   testa e le due Parti stanno comode una accanto all'altra (uguale per LOI e Contratto). */
.modal.docgen-wide { width: min(1000px, calc(100% - 40px)); }
.docgen-parties { display: flex; gap: var(--s-4); flex-wrap: wrap; margin-bottom: var(--s-4); }
.docgen-party-box {
  flex: 1 1 260px;
  min-width: 240px;
  padding: var(--s-4);
  background: var(--paper-warm);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}
.docgen-party-box .form-group:last-child { margin-bottom: 0; }
.docgen-party-head { display: flex; align-items: center; gap: var(--s-3); margin-bottom: var(--s-3); }
.docgen-party-title {
  font-family: var(--ff-mono);
  font-size: 14px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-deep);
  font-weight: 600;
}
/* Label dei termini su una sola riga (niente wrap che disallinea i campi affiancati). */
.docgen-terms-row .form-label { white-space: nowrap; }
.docgen-party-logo {
  height: 30px;
  max-width: 110px;
  object-fit: contain;
  flex: none;
}
/* Spese (PF7): checkbox in linea + badge stato riga */
.form-check { display: inline-flex; align-items: center; gap: var(--s-2); font-size: 14px; color: var(--ink); cursor: pointer; }
/* Segmento a due rami (es. imputazione spesa: Overhead | Riaddebitabile) */
.seg-radio { display: flex; gap: var(--s-2); flex-wrap: wrap; }
.seg-opt { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer;
  padding: 8px 12px; border: 1px solid var(--rule); border-radius: 8px; background: var(--paper); }
.seg-opt:has(input:checked) { border-color: var(--navy); background: var(--paper-warm); font-weight: 500; }
.exp-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.exp-badge { font-family: var(--ff-mono); font-size: 9px; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 1px 6px; border-radius: 999px; background: var(--paper-warm); border: 1px solid var(--rule); color: var(--ink-mute); }
.exp-badge-src { background: rgba(196,148,74,0.12); border-color: var(--gold); color: var(--gold-deep); }
.docgen-terms-label {
  font-family: var(--ff-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin: var(--s-2) 0 var(--s-3);
  padding-top: var(--s-3);
  border-top: 1px solid var(--rule-soft);
}
@media (max-width: 640px) {
  .docgen-party-box { flex: 1 1 100%; }
}

/* ── PF8 Backlog: board Kanban ─────────────────────────────────── */
.bk-board { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s-3); align-items: start; }
.bk-col { background: var(--paper-warm); border: 1px solid var(--rule); border-radius: var(--radius);
  min-height: 120px; display: flex; flex-direction: column; transition: background .12s, box-shadow .12s; }
.bk-col.bk-over { background: rgba(196,148,74,0.10); box-shadow: inset 0 0 0 2px var(--gold); }
.bk-col-head { display: flex; align-items: center; gap: 6px; font-family: var(--ff-mono);
  font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-soft);
  padding: 10px var(--s-3); border-bottom: 1px solid var(--rule-soft); }
.bk-col-count { margin-left: auto; background: var(--paper); border: 1px solid var(--rule);
  border-radius: 999px; padding: 0 7px; font-size: 10.5px; color: var(--ink-mute); }
.bk-col-body { padding: var(--s-3); display: flex; flex-direction: column; gap: var(--s-3); flex: 1; }
.bk-col-empty { color: var(--ink-mute); font-size: 12px; text-align: center; padding: var(--s-4) 0; }
/* Colonna «Fatto»: gruppi per mese e per anno, apribili */
.bk-group { border: 1px solid var(--rule-soft); border-radius: var(--radius); background: var(--paper); }
.bk-group + .bk-group { margin-top: var(--s-2); }
.bk-group-head { width: 100%; display: flex; align-items: center; gap: 7px; padding: 7px 9px;
  background: none; border: none; cursor: pointer; text-align: left; font-family: var(--ff-mono);
  font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); }
.bk-group-head:hover { color: var(--navy); }
.bk-group-head:focus-visible { outline: 2px solid var(--navy); outline-offset: -2px; }
.bk-group-caret { display: inline-block; width: 10px; font-size: 9px; color: var(--ink-mute);
  transition: transform .15s ease; }
.bk-group.is-open > .bk-group-head .bk-group-caret { transform: rotate(90deg); }
.bk-group-label { flex: 1; min-width: 0; }
.bk-group-count { background: var(--paper-warm); border: 1px solid var(--rule); border-radius: 999px;
  padding: 0 7px; font-size: 10px; color: var(--ink-mute); }
.bk-group-body { display: none; padding: 0 9px 9px; flex-direction: column; gap: var(--s-3); }
.bk-group.is-open > .bk-group-body { display: flex; }
/* Il mese in corso è il gruppo «vivo»: filo d'oro a sinistra */
.bk-group-current { border-left: 2px solid var(--gold); }
/* Gruppo che nasconde scadenze superate: stesso segno delle card in attenzione */
.bk-group-warn { box-shadow: inset 3px 0 0 var(--gold); background: rgba(196,148,74,0.10); }
.bk-group-warn > .bk-group-head { color: var(--gold-deep); }
.bk-group-warn-dot { color: var(--gold-deep); font-size: 8px; line-height: 1; }
/* Aperto, il segno resta sull'intestazione: le card mostrano già le proprie */
.bk-group-warn.is-open { background: none; }
/* Dentro un anno i mesi non ripetono la cornice */
.bk-group-year > .bk-group-body > .bk-group { border: none; }
.bk-group-year > .bk-group-body > .bk-group > .bk-group-head { padding-left: 0; }
.bk-group-year > .bk-group-body > .bk-group > .bk-group-body { padding-left: 0; padding-right: 0; }

.bk-card { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 10px 12px; cursor: grab; box-shadow: 0 1px 2px rgba(15,37,64,0.05);
  transition: box-shadow .12s, transform .06s; }
.bk-card:hover { box-shadow: 0 3px 10px rgba(15,37,64,0.12); border-color: var(--gold); }
.bk-card.bk-dragging { opacity: .5; }
.bk-card-top { display: flex; align-items: center; gap: 6px; margin-bottom: 5px; }
.bk-card-title { font-size: 13.5px; font-weight: 500; color: var(--navy); line-height: 1.35; }
.bk-card-meta { font-size: 11.5px; color: var(--ink-soft); margin-top: 4px; }
.bk-amt { font-family: var(--ff-mono); color: var(--gold-deep); }
.bk-card-foot { display: flex; align-items: center; gap: 8px; margin-top: 7px;
  font-size: 10.5px; color: var(--ink-mute); }
.bk-due { margin-left: auto; }
.bk-src { font-family: var(--ff-mono); font-size: 9.5px; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 1px 6px; border-radius: 999px; background: var(--paper-warm); border: 1px solid var(--rule); color: var(--ink-mute); }
.bk-src-free { background: rgba(27,58,92,0.08); border-color: var(--navy); color: var(--navy); }
.bk-src-activity { background: rgba(196,148,74,0.12); border-color: var(--gold); color: var(--gold-deep); }
.bk-prio { margin-left: auto; font-family: var(--ff-mono); font-size: 9.5px; font-weight: 600;
  padding: 1px 6px; border-radius: 3px; }
.bk-prio-P1 { background: #F6DADA; color: #9B2C2C; }
.bk-prio-P2 { background: #F7E6CF; color: #A15C1B; }
.bk-prio-P3 { background: var(--paper-warm); color: var(--ink-soft); }
.bk-prio-P4 { background: var(--paper-tint); color: var(--ink-mute); }
@media (max-width: 900px) {
  .bk-board { grid-template-columns: repeat(2, 1fr); }
}

/* Azione di rimozione riga (chiara: testo + icona, danger all'hover) */
.row-del{border:none;background:none;color:var(--ink-mute);font-size:12.5px;cursor:pointer;
  padding:4px 9px;border-radius:7px;display:inline-flex;align-items:center;gap:6px;white-space:nowrap}
.row-del svg{width:14px;height:14px}
.row-del:hover{background:#F6DADA;color:#9B2C2C}
/* Variante distruttiva (elimina anche dal server): rossa già a riposo */
.row-del-srv{color:#9B2C2C}
.row-del-srv:hover{background:#9B2C2C;color:#fff}

/* PF7: overlay con spinner centrale durante l'analisi AI dello scontrino */
.scan-overlay{position:fixed;inset:0;background:rgba(15,37,64,.42);display:none;place-items:center;z-index:600}
.scan-overlay.open{display:grid}
.scan-box{background:var(--paper);border:1px solid var(--rule);border-radius:16px;
  padding:32px 40px;display:flex;flex-direction:column;align-items:center;gap:18px;text-align:center;
  max-width:min(90vw,420px);box-shadow:0 24px 60px rgba(15,37,64,.30)}
.scan-spin{width:52px;height:52px;border-radius:50%;border:4px solid var(--rule);
  border-top-color:var(--gold);animation:scanspin .8s linear infinite}
@keyframes scanspin{to{transform:rotate(360deg)}}
.scan-err-ico{width:52px;height:52px;border-radius:50%;background:#F6DADA;color:#9B2C2C;
  display:none;place-items:center;font-size:26px;font-weight:700;font-family:var(--ff-display,serif)}
.scan-msg{font-size:14.5px;color:var(--ink-soft);line-height:1.45}
.scan-box.err .scan-spin{display:none}
.scan-box.err .scan-err-ico{display:grid}
.scan-box.err .scan-msg{color:#9B2C2C}

/* PF4: gli utenti del portale (guest) che aprono la Guida non vedono la sidebar gestionale */
body.is-guest .sidebar { display: none; }
body.is-guest { padding-left: 0; }

/* ── PF4 Guida: manuale ────────────────────────────────────────── */
.guide-layout { display: grid; grid-template-columns: 240px 1fr; gap: var(--s-6); align-items: start; }
.guide-toc { position: sticky; top: var(--s-5); display: flex; flex-direction: column; gap: 2px;
  border-right: 1px solid var(--rule-soft); padding-right: var(--s-4); }
.guide-toc-item { display: block; padding: 7px 10px; border-radius: var(--radius); font-size: 13.5px;
  color: var(--ink-soft); text-decoration: none; border-left: 2px solid transparent; }
.guide-toc-item:hover { background: var(--paper-warm); color: var(--navy); }
.guide-toc-item.active { background: var(--paper-warm); color: var(--navy); font-weight: 600;
  border-left-color: var(--gold); }
.guide-body { max-width: 760px; font-size: 15px; line-height: 1.7; color: var(--ink-soft); }
.guide-body h1 { font-size: 30px; color: var(--navy); margin: 0 0 var(--s-4); }
.guide-body h2 { font-size: 21px; color: var(--navy); margin: var(--s-6) 0 var(--s-3);
  padding-top: var(--s-4); border-top: 1px solid var(--rule-soft); }
.guide-body h3 { font-size: 16px; color: var(--navy-deep); margin: var(--s-5) 0 var(--s-2); }
.guide-body h4 { font-size: 14px; color: var(--ink); margin: var(--s-4) 0 var(--s-2); }
.guide-body p { margin: 0 0 var(--s-3); }
.guide-body ul, .guide-body ol { margin: 0 0 var(--s-3); padding-left: 1.4em; }
.guide-body li { margin: 3px 0; }
.guide-body code { font-family: var(--ff-mono); font-size: 0.88em; background: var(--paper-warm);
  border: 1px solid var(--rule-soft); border-radius: 3px; padding: 1px 5px; }
.guide-body a { color: var(--gold-deep); }
.guide-body blockquote { margin: var(--s-4) 0; padding: 10px var(--s-4); background: var(--paper-warm);
  border-left: 3px solid var(--gold); border-radius: 0 var(--radius) var(--radius) 0; color: var(--ink); }
.guide-body hr { border: none; border-top: 1px solid var(--rule); margin: var(--s-5) 0; }
@media (max-width: 720px) {
  .guide-layout { grid-template-columns: 1fr; }
  .guide-toc { position: static; flex-direction: row; flex-wrap: wrap; border-right: none;
    border-bottom: 1px solid var(--rule-soft); padding: 0 0 var(--s-3); }
}

/* ── Pagina Programma: iniziative raggruppate e filtrabili ────── */
.pg-toolbar { display: flex; align-items: flex-end; gap: var(--s-3); flex-wrap: wrap;
  margin-bottom: var(--s-4); }
.pg-field { display: flex; flex-direction: column; gap: 4px; }
.pg-field-grow { flex: 1; min-width: 180px; }
.pg-field-label { font-family: var(--ff-mono); font-size: 10px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--ink-mute); }
.pg-field .form-select, .pg-field .form-input { padding: 8px 12px; font-size: 13px; }

.pg-group { margin-bottom: var(--s-5); }
/* Stesso rientro delle schede sotto (--s-4, il loro padding): così il titolo del
   gruppo si allinea ai nomi delle iniziative e i totali ai numeri delle schede.
   Senza, i totali stavano ~17px più a destra dei valori che riassumono. */
.pg-group-head { display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--s-4); flex-wrap: wrap; padding: 0 var(--s-4) var(--s-2);
  border-bottom: 1px solid var(--rule); margin-bottom: var(--s-3); }
.pg-group-title { font-family: var(--ff-display); font-size: 19px; font-weight: 500;
  color: var(--navy); margin: 0; }
.pg-group-nums { display: flex; gap: var(--s-4); font-family: var(--ff-mono); font-size: 11px;
  color: var(--ink-mute); flex-wrap: wrap; }

.pg-list { display: flex; flex-direction: column; gap: var(--s-2); }
/* La terza colonna ospita referente, budget e speso: dev'essere abbastanza larga
   da contenerli, altrimenti il contenuto sborda dalla scheda mangiandosi il
   padding — un `min-width` sull'elemento non allarga la colonna che lo contiene. */
.pg-init { display: grid; grid-template-columns: 1fr 180px 200px; gap: var(--s-4);
  align-items: center; padding: var(--s-3) var(--s-4); background: var(--paper);
  border: 1px solid var(--rule); border-radius: var(--radius); text-decoration: none;
  transition: border-color .12s, box-shadow .12s; }
.pg-init:hover { border-color: var(--gold); box-shadow: 0 3px 10px rgba(15,37,64,0.10); }
.pg-init.is-clickable { cursor: pointer; }
.pg-init-name { font-size: 15px; font-weight: 500; color: var(--navy); line-height: 1.3;
  text-decoration: none; display: block; }
.pg-init:hover .pg-init-name { color: var(--gold-deep); }
/* Il referente porta alla sua scheda, non all'iniziativa: si deve vedere che è
   un link a sé, dentro una riga che è tutta cliccabile. */
.pg-money-row.is-text strong a { color: var(--navy); text-decoration: none;
  border-bottom: 1px solid var(--rule); }
.pg-money-row.is-text strong a:hover { color: var(--gold-deep); border-bottom-color: var(--gold); }
.pg-init-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 5px; }
.pg-chip { font-family: var(--ff-mono); font-size: 9.5px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink-mute); border: 1px solid var(--rule);
  border-radius: var(--radius-sm); padding: 1px 6px; }
.pg-chip-prio { color: var(--gold-deep); border-color: var(--gold); }
/* ══ Dove siamo con un'azienda ══════════════════════════════════════════════
   Non e un campo che qualcuno aggiorna: lo dicono i contratti. Cliente = ne ha
   uno attivo (e dell'ERP); potenziale = non ne ha mai avuti (e del CRM); ex
   cliente sta in mezzo, ed e l'occasione commerciale piu concreta che ci sia. */
.cl-stato { display: inline-block; font-family: var(--ff-mono); font-size: 10px;
  letter-spacing: .08em; text-transform: uppercase; padding: 3px 9px;
  border-radius: 999px; border: 1px solid; }
.cl-stato--cliente { color: var(--status-done, #3c8250); background: rgba(60,130,80,.10);
  border-color: rgba(60,130,80,.40); }
.cl-stato--ex_cliente { color: var(--gold-deep, #a87b33); background: rgba(196,148,74,.12);
  border-color: rgba(196,148,74,.45); }
.cl-stato--potenziale { color: var(--navy); background: rgba(27,58,92,.08);
  border-color: rgba(27,58,92,.30); }
/* A che punto e il discorso: si legge solo per chi cliente non e ancora. */
.cl-stage { display: inline-block; margin-left: 6px; font-size: 11px;
  color: var(--ink-mute); font-style: italic; }
.cl-filtri { display: flex; gap: var(--s-2); flex-wrap: wrap; margin-bottom: var(--s-4); }
.cl-filtro { font-size: 12px; padding: 6px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--rule); background: var(--paper); color: var(--ink-soft); }
.cl-filtro b { font-family: var(--ff-mono); margin-left: 4px; }
.cl-filtro:hover { border-color: var(--navy); }
.cl-filtro.is-on { background: var(--navy); border-color: var(--navy); color: #fff; }
/* Le trasversali (challenge) stanno FUORI dalla scala delle ondate e delle
   priorità: un colore che non è né l'uno né l'altro — lo stesso viola della
   presentazione, così l'iniziativa si riconosce passando dal documento allo
   schermo. */
.pg-chip-sfida { color: #6B4E8F; border-color: rgba(107,78,143,.5);
  background: rgba(107,78,143,.08); }
/* La matita che cambia la collocazione: sta in fila con le chip perche' e' li
   che la collocazione si legge, ma si comporta da pulsante. */
.pg-chip-edit { cursor: pointer; background: transparent; line-height: 1.35;
  color: var(--ink-mute); font-family: inherit; font-size: 11px; padding: 0 6px; }
.pg-chip-edit:hover { color: var(--gold-deep); border-color: var(--gold); }
.pg-init.is-sfida { border-left: 3px solid #6B4E8F; }
.pg-group.is-sfida .pg-group-title { color: #6B4E8F; }
.pg-init-meta { font-size: 12px; color: var(--ink-soft); margin-top: 5px;
  display: flex; gap: 5px; flex-wrap: wrap; }

.pg-init-progress { display: flex; align-items: center; gap: var(--s-2); }
.pg-bar { flex: 1; height: 6px; background: var(--paper-tint); border-radius: 3px; overflow: hidden; }
.pg-bar-fill { height: 100%; background: var(--gold); }
.pg-init-pct { font-family: var(--ff-mono); font-size: 12px; color: var(--navy); min-width: 34px;
  text-align: right; }

/* `min-width: 0`: la larghezza la decide la colonna della griglia, e il contenuto
   si adatta invece di spingere. Senza, i valori uscivano dal bordo destro. */
.pg-init-money { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pg-money-row { display: flex; justify-content: space-between; align-items: baseline;
  gap: var(--s-3); font-family: var(--ff-mono); font-size: 11px; color: var(--ink-mute); }
/* L'etichetta non si accorcia e il valore non spinge: così le tre righe restano
   incolonnate fra loro e dentro la scheda, qualunque sia il nome del referente. */
.pg-money-row > span { flex: 0 0 auto; }
.pg-money-row > strong { flex: 0 1 auto; text-align: right; min-width: 0; }
.pg-money-row strong { color: var(--navy); font-weight: 500; }
/* Il referente non è un numero: niente mono (gli importi restano incolonnati) e
   si tronca invece di allargare la colonna quando il nome è lungo. */
.pg-money-row.is-text strong { font-family: var(--ff-body);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Speso oltre il budget: è l'unico numero che deve saltare all'occhio */
.pg-money-row.is-over strong { color: var(--status-blocked); }

@media (max-width: 900px) {
  .pg-init { grid-template-columns: 1fr; gap: var(--s-3); }
}

/* ══ Contratti nella scheda cliente: ELENCO, non editor ═════════════════════
   Il contratto si apre nella dialog — la stessa di Contratti e Fatture — e qui
   resta quello che serve a riconoscerlo e a vedere se c'è qualcosa da
   presidiare. Prima questa scheda aveva una seconda gestione completa, e le due
   copie divergevano. */
.contract-row { display: flex; align-items: center; gap: var(--s-4);
  padding: 10px var(--s-4); background: var(--paper); border: 1px solid var(--rule);
  border-radius: var(--radius); margin-bottom: var(--s-2); }
.contract-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column;
  gap: 4px; background: none; border: 0; padding: 0; text-align: left; cursor: pointer; }
.contract-row-main:hover .ck-title { color: var(--gold-deep); }
.ck-title { font-size: 15px; font-weight: 500; color: var(--navy); line-height: 1.3; }
.ck-meta { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap;
  font-family: var(--ff-mono); font-size: 10.5px; color: var(--ink-mute); }
.ck-status { text-transform: uppercase; letter-spacing: .08em; }
.ck-attesa { color: var(--ink-mute); font-style: italic; }
.ck-overdue { color: var(--status-blocked); }
.ck-soon { color: var(--gold-deep); }
.ck-figures { display: flex; flex-direction: column; align-items: flex-end; gap: 2px;
  white-space: nowrap; }
.ck-amount { font-family: var(--ff-mono); font-size: 14px; color: var(--navy); }
.ck-sub { font-family: var(--ff-mono); font-size: 10.5px; color: var(--ink-mute); }
@media (max-width: 720px) {
  .contract-row { flex-wrap: wrap; }
  .ck-figures { align-items: flex-start; }
}

/* Riorganizzazione appena fatta: la via di uscita resta in vista finché la
   pagina è aperta, invece di essere un messaggio che sparisce da solo. */
.riorg-undo { display: flex; align-items: center; gap: var(--s-4); flex-wrap: wrap;
  margin: var(--s-4) 0 0; padding: 10px var(--s-4); font-size: 13px;
  background: var(--paper-tint); border: 1px solid var(--gold);
  border-radius: var(--radius); }
.riorg-undo strong { color: var(--navy); font-weight: 600; }
.riorg-undo .btn { margin-left: auto; }
/* `display: flex` di una classe batte la regola [hidden] del browser: senza
   questa riga la barra si vede anche quando è nascosta, vuota e con il pulsante
   per annullare una riorganizzazione che non è mai avvenuta. */
.riorg-undo[hidden] { display: none; }

/* ══ Cosa mettere nel report per il board ═══════════════════════════════════
   Un elenco di caselle, non una tabella: si scorre con gli occhi e si toglie
   quello che a questo consiglio non serve. La casella della wave comanda le sue
   iniziative e si mette «a metà» quando ne resta fuori qualcuna. */
.rep-head { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap;
  margin: var(--s-5) 0 var(--s-2); }
.rep-conta { font-family: var(--ff-mono); font-size: 11px; color: var(--ink-mute); }
.rep-azioni { margin-left: auto; display: flex; gap: var(--s-2); }
.rep-list { max-height: 44vh; overflow-y: auto; overscroll-behavior: contain;
  border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper); }
.rep-wave + .rep-wave { border-top: 1px solid var(--rule); }
.rep-w-head { display: flex; align-items: center; gap: var(--s-2);
  padding: 8px var(--s-4); background: var(--paper-tint); cursor: pointer;
  font-family: var(--ff-mono); font-size: 10px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--navy); }
.rep-w-n { margin-left: auto; color: var(--ink-mute); }
.rep-i { display: flex; align-items: baseline; gap: var(--s-2);
  padding: 6px var(--s-4); cursor: pointer; font-size: 13px; }
.rep-i:hover { background: var(--paper-tint); }
.rep-i-n { flex: 1; color: var(--navy); }
.rep-i-s { font-family: var(--ff-mono); font-size: 10.5px; color: var(--ink-mute); }
.rep-vuoto { margin: 0; padding: var(--s-4); color: var(--ink-mute); font-size: 13px; }
.rep-opts { display: flex; gap: var(--s-5); flex-wrap: wrap;
  margin: var(--s-4) 0 var(--s-2); }
.rep-opt { display: flex; align-items: flex-start; gap: var(--s-2); cursor: pointer;
  font-size: 13px; }
.rep-opt strong { display: block; color: var(--navy); font-weight: 500; }
.rep-opt em { display: block; font-style: normal; font-size: 11.5px; color: var(--ink-mute); }
.rep-dim { margin: var(--s-4) 0 0; font-size: 12px; color: var(--ink-mute); }
.rep-dim strong { color: var(--navy); font-weight: 500; }

/* ══ Importi nascosti ══════════════════════════════════════════════════════
   Il default è non leggerli, per chiunque — amministratori compresi. A sostituire
   le cifre con «**» ci pensano i formattatori (un solo punto di passaggio); qui
   si copre quello che i formattatori non toccano: il contenuto dei CAMPI in cui
   un importo si scrive. Il campo resta nel documento col suo valore — così
   salvando un'altra parte della stessa scheda l'importo non si perde — ma è
   bloccato e non si legge. È uno schermo, non una serratura. */
html.econ-nascosti input[data-econ-bloccato] {
  -webkit-text-security: disc;          /* Chrome, Edge, Safari, Firefox ≥118 */
  text-security: disc;
  cursor: not-allowed;
}
/* Dove il mascheramento del testo non è supportato, il campo resta comunque
   illeggibile invece di mostrare il numero in chiaro. */
@supports not (-webkit-text-security: disc) {
  html.econ-nascosti input[data-econ-bloccato] { color: transparent;
    text-shadow: 0 0 7px rgba(0, 0, 0, .55); }
}
/* L'avviso in barra: «**» dappertutto senza una spiegazione sembra un guasto. */
.econ-badge { display: none; align-items: center; gap: 6px; font-family: var(--ff-mono);
  font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--gold-deep); background: var(--gwash); border: 1px solid var(--gold);
  border-radius: 999px; padding: 3px 10px; cursor: pointer; text-decoration: none; }
html.econ-nascosti .econ-badge { display: inline-flex; }
.econ-badge:hover { background: var(--gold); color: #fff; }

/* ══ Note lunghe ═══════════════════════════════════════════════════════════
   Nella scheda madre si legge l'inizio della nota; il testo intero si scrive in
   una dialog sua. Una nota di venti righe dentro una casella alta due è scomoda
   da scrivere e impossibile da rileggere. */
.nota-box { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.nota-anteprima { width: 100%; border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--paper); padding: 10px 12px; font-size: 13.5px; line-height: 1.55;
  color: var(--ink); white-space: pre-wrap; cursor: pointer;
  /* Tre righe e poi sfuma: si capisce di che parla senza rubare mezza scheda. */
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.nota-anteprima:hover { border-color: var(--gold); }
.nota-anteprima.is-vuota { color: var(--ink-mute); font-style: italic; }

.notadlg-backdrop { position: fixed; inset: 0; background: rgba(20, 24, 33, .55);
  display: none; align-items: center; justify-content: center; z-index: 1300; padding: 24px; }
.notadlg-backdrop.is-open { display: flex; }
.notadlg { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius);
  width: min(920px, 100%); max-height: calc(100vh - 48px); display: flex; flex-direction: column;
  box-shadow: 0 24px 60px rgba(20, 24, 33, .28); }
.notadlg-head { display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--s-3); padding: var(--s-4) var(--s-5); border-bottom: 1px solid var(--rule); }
.notadlg-head h3 { margin: 2px 0 0; font-family: var(--ff-display, Fraunces), serif;
  font-size: 22px; color: var(--navy); font-weight: 400; }
.notadlg-eyebrow { font-family: var(--ff-mono); font-size: 10px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--gold-deep); }
.notadlg-x { background: none; border: none; font-size: 24px; line-height: 1; cursor: pointer;
  color: var(--ink-mute); padding: 0 4px; }
.notadlg-x:hover { color: var(--ink); }
.notadlg-body { padding: var(--s-4) var(--s-5); overflow: auto; flex: 1; }
/* Il punto di tutta la modifica: qui si scrive davvero. */
.notadlg-body textarea { width: 100%; min-height: min(58vh, 460px); resize: vertical;
  font-size: 14.5px; line-height: 1.65; padding: 14px 16px; }
.notadlg-foot { display: flex; align-items: center; justify-content: space-between;
  gap: var(--s-3); padding: var(--s-3) var(--s-5) var(--s-4); border-top: 1px solid var(--rule); }
.notadlg-foot .btn + .btn { margin-left: 8px; }
.notadlg-hint { font-family: var(--ff-mono); font-size: 11px; color: var(--ink-mute); }

/* ══ Risorse del cliente ═══════════════════════════════════════════════════
   Il team del cliente lavora ai progetti con gli stessi ruoli A/B/C. Le sue ore
   si contano nell'impegno ma non nei costi: non è lavoro che paghiamo noi. */
.ris-table td { vertical-align: middle; }
.ris-table .ris-mute { color: var(--ink-mute); }
.ris-table .ris-livello { width: 76px; padding: 4px 6px; font-size: 13px; }
.ris-add { display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  margin-top: var(--s-3); }
.ris-add .form-select { width: auto; min-width: 150px; }
/* Una riga ore del cliente si riconosce a colpo d'occhio: il costo è zero, e
   scoprirlo solo dai totali che non tornano sarebbe un cattivo scherzo. */
.ad-row.is-cliente { border-left: 3px solid var(--gold); padding-left: 8px; }
.ad-tag-cliente { font-family: var(--ff-mono); font-size: 10px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--gold-deep); background: var(--gwash);
  border-radius: 999px; padding: 2px 7px; margin-left: 6px; white-space: nowrap; }
/* Le ore del cliente accanto alle nostre: si vedono, ma si vede anche che sono
   un'altra cosa — altrimenti un totale di 10 ore farebbe cercare un costo che
   non esiste. */
.cond-ore-cliente { font-family: var(--ff-mono); font-size: 10.5px; color: var(--gold-deep);
  background: var(--gwash); border-radius: 999px; padding: 1px 7px; margin-left: 6px;
  white-space: nowrap; }

/* ══ Passi di un'attività ══════════════════════════════════════════════════
   Stanno in sequenza: il numero dice l'ordine, il primo non ancora fatto è il
   punto a cui si è arrivati, e la barra in cima dice quanto manca. */
.ad-steps-bar { height: 6px; background: var(--rule-soft, #efe9dd); border-radius: 3px;
  overflow: hidden; margin-bottom: var(--s-3); }
.ad-steps-bar span { display: block; height: 100%; background: var(--gold);
  transition: width .2s; }
.ad-steps { display: flex; flex-direction: column; gap: 4px; }
.ad-step { display: flex; align-items: center; gap: 8px; padding: 6px 8px;
  border: 1px solid var(--rule-soft, #efe9dd); border-radius: var(--radius);
  background: var(--paper); }
.ad-step.is-corrente { border-color: var(--gold); background: var(--gwash); }
.ad-step.is-fatto .ad-step-desc { text-decoration: line-through; color: var(--ink-mute); }
.ad-step-n { font-family: var(--ff-mono); font-size: 11px; color: var(--ink-mute);
  width: 18px; text-align: right; flex: 0 0 auto; }
.ad-step-stato { font-family: var(--ff-mono); font-size: 10px; letter-spacing: .05em;
  text-transform: uppercase; border: 1px solid var(--rule); border-radius: 999px;
  padding: 2px 8px; cursor: pointer; background: var(--card, #fff); color: var(--ink-soft);
  white-space: nowrap; flex: 0 0 auto; }
.ad-step-stato.st-In-corso { border-color: var(--gold); color: var(--gold-deep);
  background: var(--gwash); }
.ad-step-stato.st-Fatto { border-color: var(--status-done, #3c8250);
  color: var(--status-done, #3c8250); }
.ad-step-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.ad-step-desc { font-size: 13.5px; color: var(--ink); }
.ad-step-meta { font-size: 11px; color: var(--ink-mute); }
.ad-step-fuori { color: var(--status-blocked, #a8443a); }
/* Chi fa il passo: iniziali in pastiglia, il nome nel tooltip. Un passo puo
   toccare a piu persone, e tre nomi per esteso accanto a ogni riga raddoppiano
   l'altezza dell'elenco e fanno sparire cosa il passo dice di fare. */
.ad-chi { display: inline-flex; gap: 3px; vertical-align: middle; border: none;
  background: none; padding: 0; cursor: pointer; }
.ad-chi i { font-family: var(--ff-mono); font-style: normal; font-size: 9px;
  line-height: 1; color: #fff; background: var(--navy); border-radius: 999px;
  padding: 3px 4px; min-width: 18px; text-align: center; }
.ad-chi i.is-cliente { background: var(--gold-deep, #a87b33); }
.ad-chi:hover i { filter: brightness(1.15); }
.ad-chi-vuoto { font-style: italic; color: var(--ink-mute); }
/* Il pulsante «a chi tocca» della riga di aggiunta: si comporta come un campo,
   perche' li' accanto ce ne sono altri tre. */
.ad-chi-nuovo { border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--paper); padding: 8px 10px; min-height: 36px; align-items: center;
  font-size: 13px; }
.ad-chi-nuovo:hover { border-color: var(--navy); }
/* Data DEDOTTA (la fetta del periodo dell'attivita), non scelta da nessuno. */
.ad-step-auto { font-style: italic; opacity: .8; }
/* La scelta di chi fa il passo: caselle, non un menu — con un menu a scelta
   singola il secondo nome non si poteva dire. */
.ad-chi-pop { border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--paper); padding: var(--s-3); margin-top: var(--s-2); }
.ad-chi-pop__t { font-size: 12px; font-weight: 600; color: var(--navy); margin-bottom: 6px;
  display: flex; gap: var(--s-3); align-items: baseline; flex-wrap: wrap; }
/* La legenda dell'asterisco sta nel titolo: spiegarlo altrove vorrebbe dire
   cercarlo, e un segno che va cercato non spiega niente. */
.ad-chi-pop__t em { font-style: normal; font-weight: 400; font-size: 11px; color: var(--ink-mute); }
.ad-chi-pop__l b { color: var(--navy); font-weight: 600; }
.ad-chi-pop__l { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 2px 12px; max-height: 190px; overflow-y: auto; }
.ad-chi-pop__l label { display: flex; align-items: center; gap: 7px; font-size: 13px;
  padding: 3px 0; cursor: pointer; }
.ad-chi-pop__l em { font-style: normal; font-size: 11px; color: var(--ink-mute); }
.ad-chi-pop__b { display: flex; gap: var(--s-2); justify-content: flex-end; margin-top: var(--s-3); }
.ad-step-ord { display: flex; gap: 2px; flex: 0 0 auto; }
.ad-step-ord button { border: 1px solid var(--rule); background: var(--card, #fff);
  border-radius: 4px; width: 22px; height: 22px; cursor: pointer; line-height: 1;
  color: var(--ink-mute); font-size: 12px; }
.ad-step-ord button:disabled { opacity: .35; cursor: default; }
.ad-step-ord button:hover:not(:disabled) { border-color: var(--gold); color: var(--gold-deep); }
.ad-step-add { display: grid; grid-template-columns: 1fr 160px 130px 130px auto; gap: 6px;
  margin-top: var(--s-3); }
.ad-step-add .form-input, .ad-step-add .form-select { font-size: 13px; padding: 5px 7px; }
@media (max-width: 760px) { .ad-step-add { grid-template-columns: 1fr; } }
