/* ============ Young Ventures - Network + Back Office ============ */

:root {
  /* Brand - canvas nero puro + accenti brand (coerente col sito pubblico YV) */
  --bg:        #000000;          /* nero puro (richiesta Davide, per ora) */
  --bg-deep:   #000000;          /* globo su nero puro */
  --bg-elev:   #121214;          /* elevato, grigio scuro neutro */
  --bg-card:   #161619;          /* card / panel bg */
  --bg-hover:  #1F1F23;          /* hover row / item */
  --line:      #262629;          /* border neutro */
  --line-2:    #34343B;          /* border più marcato */
  --text:      #F5F6F8;
  --text-mute: #9A9AA6;
  --text-dim:  #5E5E68;

  /* Accenti brand: hot-pink + cyan + mint (dal marchio geometrico) */
  --magenta: #FF1A78;            /* hot-pink primario */
  --cyan:    #22E6E6;            /* cyan brand */
  --mint:    #6BC34A;            /* verde brand di Davide (grass) - accento terziario */
  --lime:    #6BC34A;            /* alias legacy → green */
  --green:   #6BC34A;            /* alias esplicito (label) */
  --orange:  #FF6A2B;            /* accento arancio (icone stat) */
  --red:     #FF3B3B;            /* Lost (kanban LP) */
  --grad-brand: linear-gradient(135deg, var(--cyan) 0%, var(--magenta) 100%);

  --display: 'Archivo', 'Helvetica Neue', Arial, sans-serif;
  --serif:   'Archivo', 'Helvetica Neue', Arial, sans-serif; /* repoint: grotesque pesante, niente serif */
  --sans:    'Barlow Condensed', 'Helvetica Neue', Arial, sans-serif;
  --mono:    'JetBrains Mono', ui-monospace, Menlo, monospace;

  --sb-w: 248px;
  --intro-side-w: 380px;
  --pad: 32px;
  --radius: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-weight: 500;
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: 0.005em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'kern', 'liga', 'tnum';
}

body { overflow: hidden; }

button { font-family: inherit; cursor: pointer; }
::selection { background: var(--cyan); color: var(--bg); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 0; }
::-webkit-scrollbar-thumb:hover { background: var(--line-2); }

.screen { display: none; }
.screen.active { display: block; }

.logo-mark { width: 28px; height: 28px; color: var(--text); flex-shrink: 0; }

/* ====================================================================== */
/* ==========================  INTRO  ================================== */
/* ====================================================================== */

#intro.active {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100vh;
  background: var(--bg-deep);
  position: relative;
  overflow: hidden;
}

#intro::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(900px 600px at 75% 40%, rgba(34, 230, 230,0.06), transparent 60%),
    radial-gradient(700px 500px at 20% 70%, rgba(255, 26, 120,0.04), transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* === Laboratory dot grid background (sotto al globo) === */
.intro-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.045) 1px, transparent 1.2px);
  background-size: 22px 22px;
  background-position: 0 0;
  pointer-events: none;
  z-index: 0;
  mask-image: radial-gradient(ellipse at center, rgba(0,0,0,1) 30%, rgba(0,0,0,0.4) 70%, transparent 95%);
  -webkit-mask-image: radial-gradient(ellipse at center, rgba(0,0,0,1) 30%, rgba(0,0,0,0.4) 70%, transparent 95%);
}

/* === Globe HTML pin - single bright cyan dot === */
.globe-pin {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #22E6E6;
  box-shadow:
    0 0 6px rgba(34, 230, 230,0.9),
    0 0 14px rgba(34, 230, 230,0.55),
    0 0 24px rgba(34, 230, 230,0.25);
  transform: translate(-50%, -50%);
  cursor: pointer;
  transition: transform .15s ease;
  pointer-events: auto;
}
.globe-pin:hover {
  transform: translate(-50%, -50%) scale(1.35);
}
.globe-pin.selected {
  background: #FFFFFF;
  box-shadow:
    0 0 8px rgba(255,255,255,0.95),
    0 0 18px rgba(34, 230, 230,0.7),
    0 0 32px rgba(34, 230, 230,0.35);
}

/* ===== Top bar ===== */

.intro-top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 14px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(13, 13, 15,0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: relative;
  z-index: 5;
}

/* ===== AUM display in top bar ===== */
.aum-display {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  justify-self: center;
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: rgba(13, 13, 15,0.55);
  cursor: pointer;
  position: relative;
  transition: border-color .15s ease;
}
.aum-display:hover { border-color: var(--line-2); }
.aum-display.open  { border-color: var(--cyan); }

/* Dropdown - appare sotto al click, no indicatori visibili */
.aum-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 240px;
  background: var(--bg-elev);
  border: 1px solid var(--line-2);
  border-radius: 0;
  padding: 10px 14px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.65);
  z-index: 100;
  cursor: default;
}
.aum-dropdown[hidden] { display: none; }
.aum-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 6px 0;
  font-family: var(--mono);
  font-size: 11px;
  border-bottom: 1px solid var(--line);
  gap: 12px;
}
.aum-row:last-child { border-bottom: none; }
.aum-row-label {
  color: var(--text-mute);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.aum-row-value {
  color: var(--text);
  font-weight: 600;
  font-size: 12px;
}
.aum-row-count {
  color: var(--text-dim);
  font-size: 10px;
  margin-left: 6px;
}
.aum-row-total {
  border-top: 1px solid var(--line-2);
  border-bottom: none;
  margin-top: 4px;
  padding-top: 8px;
}
.aum-row-total .aum-row-label { color: var(--cyan); }
.aum-row-total .aum-row-value { font-family: var(--serif); font-size: 16px; font-weight: 500; }
.aum-label {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.22em;
  color: var(--green);
}
.aum-value {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1;
}
.live-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--lime);
  background: rgba(107, 195, 74,0.10);
  border: 1px solid rgba(107, 195, 74,0.45);
  padding: 3px 8px;
  border-radius: 0;
  text-transform: uppercase;
  line-height: 1;
}
.live-tag::before {
  content: "";
  display: inline-block;
  width: 6px; height: 6px;
  background: var(--lime);
  border-radius: 0;
  box-shadow: 0 0 6px var(--lime);
  animation: pulse 1.6s ease-in-out infinite;
}

.intro-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  text-decoration: none;
  justify-self: start;
}

.brand-mark {
  display: inline-flex;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
}
.brand-mark svg { width: 100%; height: 100%; display: block; }

.intro-brand-text {
  font-family: var(--serif);
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.14em;
  padding-left: 0;
}

.intro-nav {
  display: inline-flex;
  gap: 28px;
}

.intro-nav a {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-mute);
  text-decoration: none;
  position: relative;
  padding: 4px 0;
  transition: color .15s ease;
}

.intro-nav a:hover { color: var(--text); }

.intro-nav a.active {
  color: var(--text);
}

.intro-nav a.active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -6px;
  height: 1px;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
}

.intro-top-right {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  justify-self: end;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid rgba(107, 195, 74,0.3);
  background: rgba(107, 195, 74,0.06);
  border-radius: 0;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--lime);
  letter-spacing: 0.16em;
}

.live-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 10px var(--lime);
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.85); }
}

.btn-arrow {
  background: transparent;
  border: none;
  color: var(--text);
  padding: 8px 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform .25s ease, color .2s ease;
  line-height: 0;
}
.btn-arrow svg { display: block; transition: transform .25s ease; }
.btn-arrow:hover { color: var(--cyan); }
.btn-arrow:hover svg { transform: translateX(4px); }

/* ===== Stage (side + globe) ===== */

.intro-stage {
  position: relative;
  min-height: 0;
  z-index: 1;
  overflow: hidden;
}

/* ===== Floating glass panels (left + right stack) ===== */

.intro-side,
.intro-panel {
  position: absolute;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line-2);
  border-radius: 0;
  background: rgba(13, 13, 15,0.72);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow:
    0 24px 60px rgba(0,0,0,0.55),
    0 2px 0 rgba(255,255,255,0.03) inset,
    0 0 0 1px rgba(255,255,255,0.02);
  overflow: hidden;
  z-index: 4;
}

.intro-side {
  top: 14px;
  left: 22px;
  bottom: 22px;
  width: 324px;
}

.right-stack {
  position: absolute;
  top: 14px;
  right: 22px;
  bottom: 22px;
  width: 324px;
  display: grid;
  grid-template-rows: auto 1fr;   /* news = 3 voci (content), allocation = resto */
  gap: 12px;
  z-index: 4;
}

.intro-panel {
  position: relative;
  top: auto; left: auto; right: auto; bottom: auto;
  width: 100%;
  min-height: 0;
}

/* Panel header (right panels) */
.panel-h {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--line);
}
.panel-h-left { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.panel-h-title {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 22px;
  margin: 0;
  color: var(--text);
  line-height: 1;
  letter-spacing: -0.02em;
}
.panel-h-act {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-mute);
  font-size: 13px;
  width: 26px; height: 26px;
  border-radius: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all .15s ease;
}
.panel-h-act:hover { color: var(--cyan); border-color: var(--cyan); }

.panel-tabs {
  display: inline-flex;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 2px;
  flex-shrink: 0;
}
.ptab {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-family: var(--sans);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.08em;
  padding: 5px 10px;
  border-radius: 0;
  text-transform: uppercase;
  transition: all .15s ease;
}
.ptab:hover { color: var(--text); }
.ptab.active { background: var(--text); color: var(--bg); }

/* News feed */
.news-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0 8px;
  min-height: 0;
  max-height: 234px;        /* 3 voci visibili (6px pad + 3×76px); la 4ª si vede solo scrollando */
}
.news-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  transition: background .12s ease;
  cursor: pointer;
  height: 76px;            /* righe uniformi → 3 visibili pulite, niente "pezzettino" */
  align-content: start;
}
.news-item:hover { background: rgba(255,255,255,0.02); }
.news-item:last-child { border-bottom: none; }
.news-time {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  padding-top: 2px;
  width: 38px;
}
.news-body { min-width: 0; }
.news-tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.18em;
  padding: 2px 6px;
  border-radius: 0;
  border: 1px solid;
  margin-bottom: 4px;
}
.news-tag.t-eu     { color: var(--cyan);    border-color: rgba(34, 230, 230,0.4);  background: rgba(34, 230, 230,0.06); }
.news-tag.t-us     { color: var(--lime);    border-color: rgba(107, 195, 74,0.4);  background: rgba(107, 195, 74,0.06); }
.news-tag.t-asia   { color: var(--magenta); border-color: rgba(255, 26, 120,0.4);  background: rgba(255, 26, 120,0.06); }
.news-tag.t-global { color: var(--text-mute); border-color: var(--line-2); background: rgba(255,255,255,0.02); }
.news-text {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--text);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.news-source {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  color: var(--text-dim);
  text-transform: uppercase;
}

.news-item.clickable { cursor: pointer; }
.news-item.clickable:hover .news-text { color: var(--cyan); }
.news-item.clickable:hover .news-source { color: var(--cyan); }

/* ============ Modal (LP add) ============ */

.modal {
  border: none;
  padding: 0;
  background: transparent;
  color: var(--text);
  max-width: 92vw;
}
.modal::backdrop {
  background: rgba(5, 8, 18, 0.78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.modal-form {
  width: 540px;
  max-width: 92vw;
  background: var(--bg-elev);
  border: 1px solid var(--line-2);
  border-radius: 0;
  box-shadow: 0 30px 80px rgba(0,0,0,0.7);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-h {
  padding: 22px 26px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.modal-h h3 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 26px;
  margin: 0;
  letter-spacing: -0.01em;
}

.modal-body {
  padding: 22px 26px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 18px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field.full { grid-column: 1 / -1; }
.field label {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.field input,
.field select {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 0;
  color: var(--text);
  padding: 9px 12px;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus,
.field select:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(34, 230, 230,0.12);
}
.field input::placeholder { color: var(--text-dim); }

.modal-foot {
  padding: 16px 26px 20px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ============ Stage pills (Fundraising table) ============ */

.stage-pill {
  display: inline-block;
  padding: 3px 9px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-radius: 0;
  border: 1px solid;
}
.stage-pill.stage-in-conversation { color: var(--cyan);     border-color: rgba(34, 230, 230,0.4);  background: rgba(34, 230, 230,0.08); }
.stage-pill.stage-soft            { color: var(--magenta);  border-color: rgba(255, 26, 120,0.4);  background: rgba(255, 26, 120,0.08); }
.stage-pill.stage-hard            { color: var(--lime);     border-color: rgba(107, 195, 74,0.4);  background: rgba(107, 195, 74,0.08); }
.stage-pill.stage-closed          { color: var(--lime);     border-color: rgba(107, 195, 74,0.5);  background: rgba(107, 195, 74,0.12); }
.stage-pill.stage-passed          { color: var(--text-dim); border-color: var(--line-2);         background: rgba(255,255,255,0.02); }

.row-date {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
}
.row-del {
  margin-left: 10px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-dim);
  width: 22px;
  height: 22px;
  border-radius: 0;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: all .15s ease;
  vertical-align: middle;
}
.row-del:hover { color: var(--magenta); border-color: var(--magenta); }

/* Pie / donut - sharp neon */
.pie-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 18px 22px 22px;
  flex: 1;
  min-height: 0;
}
.pie-svg-wrap {
  position: relative;
  width: 130px;
  height: 130px;
  flex-shrink: 0;
}
.pie-svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
  filter: drop-shadow(0 0 10px rgba(34, 230, 230,0.10));
}
.pie-svg circle {
  transition: stroke-dasharray .55s cubic-bezier(.5,0,.2,1),
              stroke-dashoffset .55s cubic-bezier(.5,0,.2,1);
}
.pie-center {
  font-family: var(--serif);
}
.pie-center-num {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 700;
  fill: var(--text);
  letter-spacing: -0.015em;
}
.pie-center-sub {
  font-family: var(--mono);
  font-size: 5.5px;
  font-weight: 700;
  fill: var(--text-dim);
  letter-spacing: 0.32em;
}
.pie-legend {
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.pie-legend-item {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  gap: 10px;
  align-items: center;
}
.pie-dot {
  width: 10px;
  height: 10px;
  border-radius: 0;
  box-shadow: 0 0 8px currentColor;
}
.pie-label {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}
.pie-val {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.panel-h-center { align-items: center; }

.side-head {
  padding: 18px 26px 16px;
  border-bottom: 1px solid var(--line);
}

.clock-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 20px;
}

.clock {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: rgba(13, 13, 15,0.5);
}
.clock-zone {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--text-dim);
}
.clock-time {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

.mono-tag {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.16em;
  color: var(--green);
  padding: 3px 8px;
  border: 1px solid rgba(107, 195, 74, 0.22);
  border-radius: 0;
  background: rgba(107, 195, 74, 0.06);
  text-transform: uppercase;
}

.mono-tag.accent-cyan {
  color: var(--cyan);
  border-color: rgba(34, 230, 230,0.3);
  background: rgba(34, 230, 230,0.05);
}

.side-title {
  font-family: var(--serif);
  font-weight: 800;
  font-size: 30px;
  line-height: 1.04;
  margin: 0 0 10px;
  letter-spacing: -0.015em;
  text-transform: uppercase;
  color: var(--text);
}
.side-title em {
  font-style: normal;
  font-weight: 800;
  background: var(--grad-brand);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.side-sub {
  margin: 0;
  font-size: 13px;
  color: var(--text-mute);
  line-height: 1.5;
}

.side-filters {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-bottom: 1px solid var(--line);
}

.seg {
  background: transparent;
  border: none;
  border-right: 1px solid var(--line);
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--text-mute);
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 600;
  transition: all .15s ease;
  position: relative;
}
.seg:last-child { border-right: none; }
.seg:hover { color: var(--text); background: rgba(255,255,255,0.02); }

.seg.active {
  color: var(--text);
  background: var(--bg-card);
}
.seg.active::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
}

.seg-count {
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0;
}

.seg-dot { display: none; }

.side-filter {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
}

.fchip {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-mute);
  font-family: var(--sans);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: 0;
  transition: all .15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.fchip:hover { color: var(--text); border-color: var(--line-2); }
.fchip.active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}
.fchip-count {
  font-family: var(--mono);
  font-size: 10px;
  opacity: 0.7;
}

.side-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px 18px;
  min-height: 0;
}

.side-item {
  display: grid;
  grid-template-columns: 16px 1fr auto;
  gap: 12px;
  padding: 12px 12px;
  border-radius: 0;
  cursor: pointer;
  transition: background .12s ease;
  align-items: center;
  border: 1px solid transparent;
}

.side-item:hover { background: var(--bg-hover); }

.side-item.selected {
  background: var(--bg-hover);
  border-color: rgba(34, 230, 230,0.35);
}

.side-item-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  margin: 0 auto;
}

.side-item-main { min-width: 0; }

.side-item-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  /* Niente truncation: nomi lunghi (es. "Gianfranco Manco") si vedono per intero */
  word-break: break-word;
  line-height: 1.25;
}

.side-item-loc {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
}

.side-item-tag {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 0;
  border: 1px solid;
  align-self: center;
}

.side-item-tag.r-eu  { color: var(--cyan);    border-color: rgba(34, 230, 230,0.4);  background: rgba(34, 230, 230,0.06); }
.side-item-tag.r-us  { color: var(--lime);    border-color: rgba(107, 195, 74,0.4);  background: rgba(107, 195, 74,0.06); }
.side-item-tag.r-sea { color: var(--magenta); border-color: rgba(255, 26, 120,0.4);  background: rgba(255, 26, 120,0.06); }

/* side-item-loc wrap behavior: all in line (no break) o tutti a capo */
.side-item-loc {
  display: flex;
  flex-wrap: wrap;
  gap: 0 6px;
  align-items: baseline;
}
.side-item-loc .si-sep { color: var(--text-dim); }
.side-item-loc .si-time { color: var(--text-mute); font-variant-numeric: tabular-nums; }

/* === Detail panel (sostituisce news+chart al click su un nodo) === */

.detail-panel {
  position: absolute;
  top: 14px;
  right: 22px;
  bottom: 22px;
  width: 324px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line-2);
  border-radius: 0;
  background: rgba(13, 13, 15,0.78);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow:
    0 24px 60px rgba(0,0,0,0.6),
    0 2px 0 rgba(255,255,255,0.03) inset;
  overflow: hidden;
  z-index: 5;
  animation: panelIn .25s ease;
}
.detail-panel[hidden] { display: none; }

@keyframes panelIn {
  from { opacity: 0; transform: translateX(8px); }
  to   { opacity: 1; transform: none; }
}

.detail-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  border-radius: 0;
  background: rgba(13, 13, 15,0.6);
  border: 1px solid var(--line);
  color: var(--text-mute);
  font-size: 18px;
  line-height: 1;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s ease;
}
.detail-close:hover { color: var(--magenta); border-color: rgba(255, 26, 120,0.5); }

.detail-photo {
  height: 138px;
  background:
    linear-gradient(135deg, #131318, #0c0c10 60%, #08080a);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
  overflow: hidden;
  background-size: cover;
  background-position: center;
}
.detail-photo::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(0deg, transparent 0 3px, rgba(34, 230, 230,0.025) 3px 4px),
    radial-gradient(ellipse at 50% 100%, rgba(34, 230, 230,0.18), transparent 70%);
  pointer-events: none;
}
/* Color tint stile intel/Palantir - uniformare tutte le foto */
.detail-photo.has-photo {
  filter: grayscale(1) sepia(0.55) hue-rotate(165deg) saturate(1.45) brightness(0.6) contrast(1.05);
}
.detail-photo.has-photo::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(13, 13, 15,0.05) 0%, rgba(13, 13, 15,0.85) 100%),
    linear-gradient(135deg, rgba(34, 230, 230,0.22), rgba(15,35,65,0.30));
  pointer-events: none;
}
.detail-photo-tag {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--text-dim);
  z-index: 2;
  position: relative;
}
.detail-photo.has-photo .detail-photo-tag { display: none; }

.detail-body {
  padding: 18px 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-bottom: 1px solid var(--line);
}

.detail-tag {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 0;
  border: 1px solid;
  align-self: flex-start;
}
.detail-tag.t-uni     { color: var(--lime);    border-color: rgba(107, 195, 74,0.4);  background: rgba(107, 195, 74,0.08); }
.detail-tag.t-partner { color: var(--magenta); border-color: rgba(255, 26, 120,0.4);  background: rgba(255, 26, 120,0.08); }

.detail-title {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 24px;
  margin: 4px 0 0;
  line-height: 1.12;
  letter-spacing: -0.02em;
  color: var(--text);
}

.detail-loc {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--text-dim);
  margin: 0 0 6px;
  text-transform: uppercase;
}
.detail-loc .dl-sep { color: var(--line-2); margin: 0 4px; }
.detail-loc .dl-country { color: var(--text-mute); }

.detail-desc {
  font-size: 13px;
  color: var(--text-mute);
  margin: 0;
  line-height: 1.5;
}

.detail-meta-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}
.detail-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.detail-meta-label {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--green);
  text-transform: uppercase;
}
.detail-meta-val {
  font-family: var(--serif);
  font-size: 14px;
  color: var(--text);
}

.detail-person {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 16px 12px;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.detail-person::-webkit-scrollbar { display: none; width: 0; height: 0; }

/* Card singola Professor / Student - compatte */
.person-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: rgba(255,255,255,0.012);
  transition: border-color .2s ease;
}
.person-card:hover { border-color: var(--line-2); }

.person-tag-prof {
  color: var(--lime);
  border-color: rgba(107, 195, 74,0.38);
  background: rgba(107, 195, 74,0.06);
  align-self: flex-start;
}
.person-tag-stud {
  color: var(--magenta);
  border-color: rgba(255, 26, 120,0.38);
  background: rgba(255, 26, 120,0.06);
  align-self: flex-start;
}

.person-row {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 10px;
  align-items: center;
}
.person-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 28%, var(--bg-hover), var(--bg-card));
  border: 1px solid var(--line);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.person-avatar svg {
  width: 100%;
  height: 100%;
  display: block;
  color: var(--text-mute);
  filter: drop-shadow(0 0 4px rgba(34, 230, 230,0.18));
}
.person-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.person-name {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  line-height: 1.15;
}
.person-mail {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--cyan);
  text-decoration: none;
  word-break: break-all;
  letter-spacing: 0.04em;
}
.person-mail:hover { text-decoration: underline; }

/* ===== Globe wrap ===== */

.intro-globe-wrap {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: var(--bg-deep);
  z-index: 1;
}

#globe {
  width: 100%;
  height: 100%;
}

/* corner overlays */
.globe-overlay-tl { position: absolute; top: 18px; left: 22px; z-index: 3; }
.globe-overlay-tr { position: absolute; top: 18px; right: 22px; z-index: 3; }
.globe-overlay-bl { position: absolute; bottom: 18px; left: 22px; z-index: 3; }

.ovbtn {
  background: rgba(13, 13, 15,0.6);
  border: 1px solid var(--line);
  color: var(--text-mute);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  padding: 6px 10px;
  border-radius: 0;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: all .15s ease;
}
.ovbtn:hover { color: var(--cyan); border-color: rgba(34, 230, 230,0.4); }

.legend {
  display: inline-flex;
  align-items: center;
  gap: 18px;
  background: rgba(13, 13, 15,0.6);
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 8px 16px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-mute);
  letter-spacing: 0.06em;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.globe-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  pointer-events: none;
  transition: opacity .4s ease;
}
.globe-loading.hidden { opacity: 0; }

/* ===== Bottom strip ===== */

.intro-bottom {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 6px 22px;
  border-top: 1px solid var(--line);
  background: rgba(13, 13, 15,0.78);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: relative;
  z-index: 5;
  min-height: 32px;
}

.bot-label {
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.2em;
  color: var(--green);
  font-weight: 600;
}

.bot-val.mono {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--text);
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line-2);
  padding: 9px 16px;
  border-radius: 0;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  transition: all .15s ease;
}
.btn-ghost:hover { border-color: var(--cyan); color: var(--cyan); }

/* ====================================================================== */
/* =====================  APP - BRAIN / VALUE CHAIN  =================== */
/* ====================================================================== */

#app.active {
  display: flex;
  flex-direction: column;
  height: 100vh;            /* frame fisso, niente scroll quando si vede il brain */
  overflow: hidden;
  background: var(--bg-deep);
  position: relative;
}

/* Quando si apre uno stage (detail full-page) lo scroll riparte */
#app.active.in-stage {
  height: auto;
  min-height: 100vh;
  overflow: visible;
}

body:has(#app.active:not(.in-stage)) { overflow: hidden; }
body:has(#app.active.in-stage)       { overflow: auto; }

#app.active::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.045) 1px, transparent 1.2px);
  background-size: 22px 22px;
  pointer-events: none;
  z-index: 0;
  mask-image: radial-gradient(ellipse at center, rgba(0,0,0,1) 30%, rgba(0,0,0,0.35) 70%, transparent 95%);
  -webkit-mask-image: radial-gradient(ellipse at center, rgba(0,0,0,1) 30%, rgba(0,0,0,0.35) 70%, transparent 95%);
}
#app.active > * { position: relative; z-index: 1; }

/* === Top bar === */

.bb-top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 14px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(13, 13, 15,0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.bb-top-center {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  justify-self: center;
}

.bb-checkin {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(107, 195, 74,0.06);
  border: 1px solid rgba(107, 195, 74,0.45);
  color: var(--lime);
  padding: 6px 14px;
  border-radius: 0;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-decoration: none;
  transition: all .15s ease;
}
.bb-checkin:hover {
  background: rgba(107, 195, 74,0.14);
  color: var(--text);
  border-color: var(--lime);
  box-shadow: 0 0 0 3px rgba(107, 195, 74,0.08);
}
.bb-brand {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.32em;
  color: var(--text);
  text-decoration: none;
  justify-self: start;
}
.bb-back {
  background: transparent;
  border: none;
  color: var(--text);
  padding: 8px 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  justify-self: end;
  transition: transform .25s ease, color .2s ease;
  line-height: 0;
}
.bb-back svg { display: block; transition: transform .25s ease; }
.bb-back:hover { color: var(--cyan); }
.bb-back:hover svg { transform: translateX(-4px); }

/* === Brain stage === */

.bb-stage {
  padding: 32px 32px;
  position: relative;
  min-height: calc(100vh - 60px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.bb-graph {
  position: relative;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
}
#brainSvg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 560px;
  overflow: visible;
}

/* === Brain nodes (SVG) === */

/* === Brain - pillar cards on a flat single arc === */

.bb-stage {
  padding: 0;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.bb-graph {
  position: relative;
  width: 100%;
  max-width: none;
  margin: 0 auto;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 0;
  overflow: hidden;
}

/* Single arc - anchor al bordo top delle card (sta dentro a .brain-cards) */
.brain-arc {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translate(-50%, -50%);   /* center on top edge of cards row */
  width: 130vw;                       /* sborda dal viewport sui due lati */
  height: 30px;
  pointer-events: none;
  z-index: 0;
  overflow: visible;
}
.arc-line {
  fill: none;
  stroke: rgba(34, 230, 230,0.55);
  stroke-width: 1.2;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 0 6px rgba(34, 230, 230,0.35));
}

/* Pillar cards - sopra all'arco, dritte (no 3D) */
.brain-cards {
  display: flex;
  gap: 38px;
  position: relative;
  z-index: 2;
  padding: 0 24px;
}

.brain-card {
  width: 280px;
  height: 460px;
  background: linear-gradient(180deg,
    rgba(19,26,48,0.85) 0%,
    rgba(10,15,28,0.96) 100%);
  border: 1px solid rgba(34, 230, 230,0.32);
  border-radius: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  position: relative;
  overflow: hidden;
  transition:
    transform .35s cubic-bezier(.34,1.4,.64,1),
    border-color .25s ease,
    background .25s ease,
    box-shadow .25s ease;
}

/* Linea di luce sottile in cima alla card */
.brain-card::before {
  content: "";
  position: absolute;
  top: 0; left: 14%; right: 14%;
  height: 1px;
  background: linear-gradient(to right,
    transparent, rgba(34, 230, 230,0.7), transparent);
  opacity: 0.4;
  transition: opacity .25s ease;
}

/* Port "neural" sul bordo top: la card dialoga con la linea */
.brain-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow:
    0 0 0 3px var(--bg-deep),
    0 0 12px rgba(34, 230, 230,0.65);
  z-index: 3;
  transition: box-shadow .25s ease, transform .25s ease;
}
.brain-card:hover::after {
  box-shadow:
    0 0 0 3px var(--bg-deep),
    0 0 18px var(--cyan),
    0 0 28px rgba(34, 230, 230,0.5);
}

.brain-card:hover {
  transform: scale(1.05) translateY(-6px);
  border-color: var(--cyan);
  background: linear-gradient(180deg,
    rgba(26,37,64,0.92) 0%,
    rgba(10,15,28,0.98) 100%);
  box-shadow:
    0 0 0 1px rgba(34, 230, 230,0.4),
    0 16px 50px rgba(34, 230, 230,0.18);
}
.brain-card:hover::before { opacity: 1; }
.brain-card:focus { outline: none; }

.brain-card.selected {
  border-color: var(--cyan);
  box-shadow: 0 0 0 1px rgba(34, 230, 230,0.45);
}

.brain-card-title {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--text);
  text-align: center;
  padding: 0 12px;
}

/* === Utility cards: 25% size, orizzontali, stesso stile === */
.brain-utility {
  display: flex;
  gap: 14px;
  justify-content: center;
  margin-top: 40px;
  position: relative;
  z-index: 2;
}
.brain-util {
  width: 200px;
  height: 64px;
  background: linear-gradient(180deg,
    rgba(19,26,48,0.85) 0%,
    rgba(10,15,28,0.96) 100%);
  border: 1px solid rgba(34, 230, 230,0.32);
  border-radius: 0;
  cursor: pointer;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  transition:
    transform .25s cubic-bezier(.34,1.3,.64,1),
    border-color .25s ease,
    background .25s ease,
    box-shadow .25s ease;
}
.brain-util::before {
  content: "";
  position: absolute;
  top: 0; left: 18%; right: 18%;
  height: 1px;
  background: linear-gradient(to right,
    transparent, rgba(34, 230, 230,0.6), transparent);
  opacity: 0.3;
  transition: opacity .25s ease;
}
.brain-util:hover {
  transform: scale(1.06) translateY(-2px);
  border-color: var(--cyan);
  background: linear-gradient(180deg,
    rgba(26,37,64,0.92) 0%,
    rgba(10,15,28,0.98) 100%);
  box-shadow:
    0 0 0 1px rgba(34, 230, 230,0.4),
    0 8px 26px rgba(34, 230, 230,0.15);
}
.brain-util:hover::before { opacity: 1; }

/* Old SVG card classes (lasciate per compatibilità, non più usate) === */

.bb-card {
  cursor: pointer;
  transform-box: fill-box;
  transform-origin: center;
  transition: transform .35s cubic-bezier(.34,1.3,.64,1);
}
.bb-card:hover { transform: scale(1.07); }
.bb-card.selected { transform: scale(1.04); }

.bb-card-fill {
  fill: rgba(13, 13, 15,0.7);
  transition: fill .25s ease;
}
.bb-card-stroke {
  fill: none;
  stroke: rgba(34, 230, 230,0.30);
  stroke-width: 1;
  transition: stroke .25s ease, stroke-width .25s ease, filter .25s ease;
}
.bb-card-glow {
  fill: none;
  stroke: rgba(34, 230, 230,0);
  stroke-width: 6;
  transition: stroke .25s ease;
  pointer-events: none;
}

.bb-card:hover .bb-card-fill   { fill: rgba(15,22,42,0.85); }
.bb-card:hover .bb-card-stroke { stroke: var(--cyan); stroke-width: 1.6; }
.bb-card:hover .bb-card-glow   { stroke: rgba(34, 230, 230,0.20); }

.bb-card.selected .bb-card-stroke { stroke: var(--cyan); stroke-width: 1.8; }
.bb-card.selected .bb-card-fill   { fill: rgba(15,22,42,0.92); }

/* Card content */
.bb-card-step {
  fill: var(--cyan);
  font-family: var(--mono);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.32em;
  pointer-events: none;
}
.bb-card-divider {
  stroke: rgba(34, 230, 230,0.18);
  stroke-width: 0.8;
}
.bb-card-label {
  fill: var(--text);
  font-family: var(--sans);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  pointer-events: none;
}
.bb-card-count {
  fill: var(--text-dim);
  font-family: var(--mono);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.14em;
  pointer-events: none;
}

/* Orphan tiles slightly smaller */
.bb-orphan .bb-card-stroke { stroke: rgba(34, 230, 230,0.22); stroke-dasharray: 4 4; }
.bb-orphan:hover .bb-card-stroke { stroke-dasharray: 0; }
.bb-orphan .bb-card-label { font-size: 14px; letter-spacing: 0.22em; }

/* === Links between nodes === */

.bb-link-bg {
  stroke: var(--line);
  stroke-width: 0.8;
  fill: none;
}
.bb-link-anim {
  stroke: rgba(34, 230, 230,0.45);
  stroke-width: 0.9;
  fill: none;
  stroke-dasharray: 3 6;
  animation: bbDash 4.5s linear infinite;
}
@keyframes bbDash { to { stroke-dashoffset: -36; } }

.bb-arrow {
  fill: none;
  stroke: rgba(34, 230, 230,0.55);
  stroke-width: 0.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bb-particle {
  fill: var(--cyan);
  opacity: 0.7;
}

/* === Ambient background dots === */

.bb-ambient-dot {
  fill: rgba(255,255,255,0.13);
  animation: bbAmbientFlicker ease-in-out infinite;
}
@keyframes bbAmbientFlicker {
  0%, 100% { opacity: 0.04; }
  50%      { opacity: 0.30; }
}

/* === Detail panel - opens as a full new "page" === */

.bb-detail {
  background: var(--bg);
  animation: bbDetailIn .28s cubic-bezier(.5,0,.2,1);
  min-height: calc(100vh - 60px);
}
@keyframes bbDetailIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* In-stage mode: nascondi la brain quando si è dentro a una sezione */
#app.in-stage .bb-stage { display: none; }

.bb-detail-h {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  padding: 22px 32px 18px;
  border-bottom: 1px solid var(--line);
  gap: 24px;
}
.bb-detail-back {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-mute);
  padding: 7px 14px;
  border-radius: 0;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all .15s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.bb-detail-back:hover { border-color: var(--cyan); color: var(--cyan); }

.bb-detail-h-text {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  text-align: center;
  align-items: center;
}
.bb-detail-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(26px, 2.6vw, 34px);
  margin: 0;
  letter-spacing: -0.01em;
  color: var(--text);
  line-height: 1.1;
}

/* Spacer per simmetria grid */
.bb-detail-h-spacer { width: 80px; }

.bb-detail-body { padding: 28px 32px 48px; max-width: 1400px; margin: 0 auto; }
.bb-detail-body .view { display: none; }
.bb-detail-body .view.active { display: block; }
.bb-detail-body .view .topbar {
  position: static;
  margin-bottom: 22px;
  padding: 0;
  border-bottom: none;
  background: transparent;
}
.bb-detail-body .view .crumb { display: none; }
.bb-detail-body .view .view-head { margin-bottom: 24px; }
.bb-detail-body .view .view-head .view-title { display: none; }
.bb-detail-body .view .view-sub {
  text-align: center;
  margin: 0 auto;
}

/* === Palantir-style sub-tabs (per ogni sezione) === */
.view-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.vtab {
  background: transparent;
  border: none;
  color: var(--text-mute);
  padding: 12px 18px;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  border-bottom: 1.5px solid transparent;
  margin-bottom: -1px;
  transition: all .15s ease;
  cursor: pointer;
}
.vtab:hover { color: var(--text); }
.vtab.active {
  color: var(--text);
  border-bottom-color: var(--cyan);
}
.vtab-pane { display: none; }
.vtab-pane.active { display: block; }

/* Pane vuoto / coming soon */
.empty-pane {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 24px;
  border: 1px dashed var(--line);
  border-radius: 0;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-align: center;
  gap: 8px;
}
.empty-pane-big {
  font-family: var(--serif);
  font-size: 22px;
  letter-spacing: -0.01em;
  text-transform: none;
  color: var(--text-mute);
}

/* ===== Sidebar ===== */

.sidebar {
  background: var(--bg-elev);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 22px 16px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sb-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px 22px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}

.sb-brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.sb-brand-name {
  font-family: var(--serif);
  font-style: italic;
  font-size: 17px;
  font-weight: 500;
  color: var(--text);
}
.sb-brand-tag {
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-top: 4px;
}

.sb-back {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  margin-bottom: 14px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 0;
  color: var(--text-mute);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 600;
  text-align: left;
  width: 100%;
  transition: all .15s ease;
}
.sb-back:hover {
  border-color: var(--cyan);
  color: var(--cyan);
  background: rgba(34, 230, 230,0.04);
}
.sb-back .sb-icon { color: inherit; }

.sb-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }

.sb-label {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 0 10px;
  margin: 8px 0 10px;
}

.sb-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  width: 100%;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--text-mute);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  transition: background .15s ease, color .15s ease;
  position: relative;
}

.sb-item:hover { background: var(--bg-hover); color: var(--text); }
.sb-item.active { background: var(--bg-hover); color: var(--text); }

.sb-item.active::before {
  content: "";
  position: absolute;
  left: -16px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--cyan);
  border-radius: 0 2px 2px 0;
  box-shadow: 0 0 12px var(--cyan);
}

.sb-icon {
  font-family: var(--mono);
  font-size: 13px;
  width: 20px;
  text-align: center;
  color: var(--text-dim);
  flex-shrink: 0;
}
.sb-item.active .sb-icon { color: var(--cyan); }
.sb-item:hover .sb-icon { color: var(--text-mute); }
.sb-icon-accent { color: var(--lime) !important; }

.sb-text { flex: 1; }

.sb-count {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  background: var(--bg-card);
  padding: 2px 8px;
  border-radius: 0;
  border: 1px solid var(--line);
}
.sb-item.active .sb-count {
  color: var(--cyan);
  border-color: rgba(34, 230, 230,0.3);
}

.sb-bottom {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.sb-sources { margin-bottom: 10px; }

.sb-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
}

/* ===== Main ===== */

.main {
  min-width: 0;
  padding: 0 var(--pad) var(--pad);
  overflow-y: auto;
  height: 100vh;
}

.view { display: none; }
.view.active { display: block; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 28px;
  gap: 16px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 5;
}

.crumb {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.crumb-current { color: var(--text); font-weight: 600; }

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

.searchbar {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 0;
  color: var(--text);
  padding: 9px 14px;
  font-size: 13px;
  font-family: var(--sans);
  width: 280px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.searchbar::placeholder { color: var(--text-dim); }
.searchbar:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(34, 230, 230,0.1);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.06em;
  border-radius: 0;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all .15s ease;
  line-height: 1.2;
}

.btn-primary {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}
.btn-primary:hover { background: var(--cyan); border-color: var(--cyan); }

.view-head { margin-bottom: 28px; }

.view-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 38px;
  line-height: 1.1;
  margin: 0 0 8px;
  color: var(--text);
  letter-spacing: -0.01em;
}

.title-tag {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--lime);
  background: rgba(107, 195, 74,0.1);
  border: 1px solid rgba(107, 195, 74,0.3);
  padding: 3px 9px;
  border-radius: 0;
  vertical-align: middle;
  margin-left: 12px;
  font-weight: 600;
}

.view-sub { margin: 0; color: var(--text-mute); font-size: 14px; }

.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.kpi {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.kpi-label {
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 600;
}

.kpi-value {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.1;
}

.kpi-meta { font-size: 12px; }

.placeholder { color: var(--text-dim); font-family: var(--mono); }

.progress {
  margin-top: 6px;
  height: 4px;
  background: var(--line);
  border-radius: 0;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(to right, var(--cyan), var(--lime));
  border-radius: 0;
}

.panel {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 24px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.panel-title {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: 0;
  color: var(--text);
}

.panel-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.chip {
  background: transparent;
  border: 1px solid var(--line-2);
  color: var(--text-mute);
  padding: 6px 12px;
  border-radius: 0;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  transition: all .15s ease;
}
.chip:hover { color: var(--text); border-color: var(--text-dim); }
.chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }

.filter-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }

.table { width: 100%; border-collapse: collapse; font-size: 13px; }

.table thead th {
  text-align: left;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 12px 20px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--line);
}

.table tbody td { padding: 16px 20px; border-bottom: 1px solid var(--line); color: var(--text); }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--bg-hover); }

.row-placeholder td {
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 12px;
  text-align: center;
  padding: 28px 20px !important;
}

/* ===== Kanban ===== */

.kanban {
  display: grid;
  grid-template-columns: repeat(6, minmax(220px, 1fr));
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.kb-col {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  min-height: 360px;
}

.kb-col-muted { opacity: 0.7; }

.kb-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.kb-title {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text);
  flex: 1;
}

.kb-count {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  background: var(--bg-elev);
  padding: 2px 8px;
  border-radius: 0;
  border: 1px solid var(--line);
}

.kb-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.kb-body { padding: 14px; display: flex; flex-direction: column; gap: 10px; flex: 1; }

.kb-empty {
  border: 1px dashed var(--line-2);
  border-radius: 0;
  padding: 24px 12px;
  text-align: center;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 11px;
}

/* ===== Doc / Source cards ===== */

.grid { display: grid; gap: 16px; }
.grid-doc { grid-template-columns: repeat(3, 1fr); }
.grid-source { grid-template-columns: repeat(4, 1fr); }

.doc-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 200px;
  transition: border-color .15s ease, transform .15s ease;
}
.doc-card:hover { border-color: var(--line-2); transform: translateY(-1px); }

.doc-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.tag {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 0;
  border: 1px solid;
}
.tag-lime    { color: var(--lime);    border-color: rgba(107, 195, 74,0.4);  background: rgba(107, 195, 74,0.08); }
.tag-cyan    { color: var(--cyan);    border-color: rgba(34, 230, 230,0.4);  background: rgba(34, 230, 230,0.08); }
.tag-magenta { color: var(--magenta); border-color: rgba(255, 26, 120,0.4);  background: rgba(255, 26, 120,0.08); }

.doc-date { font-family: var(--mono); font-size: 11px; color: var(--text-dim); }

.doc-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 18px;
  margin: 0;
  line-height: 1.25;
  color: var(--text);
}

.doc-excerpt { margin: 0; font-size: 13px; color: var(--text-mute); flex: 1; }

.doc-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.doc-author { color: var(--text-dim); font-family: var(--mono); }
.doc-link { color: var(--cyan); font-weight: 600; letter-spacing: 0.04em; }

.add-card {
  background: transparent;
  border: 1px dashed var(--line-2);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 200px;
  color: var(--text-dim);
  font-family: var(--sans);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  transition: all .15s ease;
  cursor: pointer;
}
.add-card:hover { border-color: var(--cyan); color: var(--cyan); }
.add-plus { font-size: 32px; font-weight: 300; line-height: 1; }

.legal-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.tab {
  background: transparent;
  border: none;
  color: var(--text-mute);
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all .15s ease;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--cyan); font-weight: 600; }

.status-legend {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-mute);
  padding: 12px 4px;
}

.src-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 160px;
  transition: border-color .15s ease;
}
.src-card:hover { border-color: var(--line-2); }

.src-type {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--magenta);
}

.src-title {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 500;
  margin: 0;
  color: var(--text);
  line-height: 1.3;
}

.src-note { margin: 0; font-size: 12px; color: var(--text-mute); flex: 1; }

.src-foot {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.src-tag {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
  background: var(--bg-elev);
  padding: 2px 7px;
  border-radius: 0;
}

.dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-cyan    { background: var(--cyan);    box-shadow: 0 0 8px rgba(34, 230, 230,0.5); }
.dot-lime    { background: var(--lime);    box-shadow: 0 0 8px rgba(107, 195, 74,0.5); }
.dot-magenta { background: var(--magenta); box-shadow: 0 0 8px rgba(255, 26, 120,0.5); }
.dot-mute    { background: var(--text-dim); }

.muted { color: var(--text-mute); }
.accent-lime    { color: var(--lime); }
.accent-cyan    { color: var(--cyan); }
.accent-magenta { color: var(--magenta); }

.placeholder-card { opacity: 0.85; }

/* ====================================================================== */
/* ===========================  Responsive  ============================ */
/* ====================================================================== */

@media (max-width: 1100px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .grid-doc { grid-template-columns: repeat(2, 1fr); }
  .grid-source { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .intro-top { grid-template-columns: 1fr auto; }
  .aum-display { display: none; }
  .intro-side { width: auto; left: 14px; right: 14px; top: 14px; bottom: auto; max-height: 50%; }
}

@media (max-width: 820px) {
  #app.active { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
  .main { padding: 0 16px 16px; height: auto; }
  .topbar { flex-direction: column; align-items: flex-start; }
  .searchbar { width: 100%; }
  .topbar-actions { width: 100%; }
  .kpi-row { grid-template-columns: 1fr; }
}

/* ====================================================================== */
/* ===================  Back office (parte dietro)  ==================== */
/* ====================================================================== */

/* Bottone in top bar che porta al back office */
.bo-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-self: end;
  background: transparent;
  border: 1px solid var(--line-2);
  color: var(--text-mute);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 7px 14px;
  transition: all .15s ease;
}
.bo-btn:hover { color: var(--cyan); border-color: var(--cyan); }
.bo-btn svg { display: block; }

#backoffice.active {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
  position: relative;
}
#backoffice.active::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.04) 1px, transparent 1.2px);
  background-size: 22px 22px;
  pointer-events: none;
  z-index: 0;
  mask-image: radial-gradient(ellipse at center, #000 30%, rgba(0,0,0,0.35) 70%, transparent 95%);
  -webkit-mask-image: radial-gradient(ellipse at center, #000 30%, rgba(0,0,0,0.35) 70%, transparent 95%);
}
#backoffice.active > * { position: relative; z-index: 1; }

.bo-top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 14px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.bo-back {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  justify-self: start;
  background: transparent;
  border: 1px solid var(--line-2);
  color: var(--text-mute);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 7px 14px;
  transition: all .15s ease;
}
.bo-back:hover { color: var(--cyan); border-color: var(--cyan); }
.bo-back svg { display: block; }
.bo-title {
  justify-self: center;
  font-family: var(--serif);
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text);
}
.bo-spacer { justify-self: end; }

/* Shell: Notion-style nav (sinistra) + main (Palantir flow) */
.bo-shell {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 290px 1fr;
}
.bo-sidebar {
  border-right: 1px solid var(--line);
  background: rgba(0,0,0,0.45);
  overflow-y: auto;
  padding: 20px 16px 24px;
  display: flex;
  flex-direction: column;
}
.bo-side-head {
  padding: 0 0 14px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.bo-masterfile-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: transparent;
  border: 1px solid var(--line);
  padding: 10px 12px;
  cursor: pointer;
  text-align: left;
  color: var(--text);
  transition: background .15s ease, border-color .15s ease;
}
.bo-masterfile-btn:hover { background: var(--bg-hover); border-color: var(--line-2); }
.bo-masterfile-btn.active { background: var(--bg-hover); border-color: var(--cyan); }
.bo-mf-icon { font-size: 17px; line-height: 1; }
.bo-mf-name {
  font-family: var(--serif);
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.02em;
}

/* Spina-processo (consequenziale) cyan → verde → magenta */
.bo-nav {
  position: relative;
  padding-left: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.bo-nav::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 10px;
  bottom: 10px;
  width: 2px;
  background: linear-gradient(180deg, var(--cyan), var(--green) 50%, var(--magenta));
  opacity: 0.5;
}

.bo-section { display: flex; flex-direction: column; }
.bo-section-head {
  display: grid;
  grid-template-columns: 26px 1fr;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: none;
  padding: 10px 6px 8px;
  text-align: left;
}
.bo-sec-step {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  color: #000;
  background: var(--cyan);
  height: 18px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.bo-section:nth-of-type(2) .bo-sec-step { background: var(--green); }
.bo-section:nth-of-type(3) .bo-sec-step { background: var(--magenta); color: #fff; }
.bo-sec-name {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text);
}
.bo-sec-chev { color: var(--text-dim); transition: transform .2s ease; }
.bo-section.collapsed .bo-sec-chev { transform: rotate(-90deg); }

.bo-tools {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding-left: 18px;
}
.bo-section.collapsed .bo-tools { display: none; }
.bo-tool {
  display: grid;
  grid-template-columns: 14px 1fr;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: none;
  padding: 8px 10px;
  cursor: pointer;
  text-align: left;
  color: var(--text-mute);
  transition: background .12s ease, color .12s ease;
  position: relative;
}
.bo-tool-ic {
  width: 6px;
  height: 6px;
  background: var(--text-dim);
  justify-self: center;
  transition: background .12s ease, box-shadow .12s ease;
}
.bo-tool-name {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.02em;
}
.bo-tool:hover { background: var(--bg-hover); color: var(--text); }
/* Tool lights coloured by batch: Fundraising cyan, Investments green, Operations magenta */
.bo-section[data-section="fundraising"] .bo-tool-ic { background: var(--cyan); }
.bo-section[data-section="investments"] .bo-tool-ic { background: var(--green); }
.bo-section[data-section="operations"] .bo-tool-ic { background: var(--magenta); }
.bo-tool.active { background: var(--bg-hover); color: var(--text); }
.bo-section[data-section="fundraising"] .bo-tool.active .bo-tool-ic { box-shadow: 0 0 8px var(--cyan); }
.bo-section[data-section="investments"] .bo-tool.active .bo-tool-ic { box-shadow: 0 0 8px var(--green); }
.bo-section[data-section="operations"] .bo-tool.active .bo-tool-ic { box-shadow: 0 0 8px var(--magenta); }
.bo-tool.active::after {
  content: "";
  position: absolute;
  left: -18px;
  top: 6px;
  bottom: 6px;
  width: 2px;
}
.bo-section[data-section="fundraising"] .bo-tool.active::after { background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
.bo-section[data-section="investments"] .bo-tool.active::after { background: var(--green); box-shadow: 0 0 8px var(--green); }
.bo-section[data-section="operations"] .bo-tool.active::after { background: var(--magenta); box-shadow: 0 0 8px var(--magenta); }

/* Main */
.bo-main { min-height: 0; overflow: hidden; display: flex; flex-direction: column; padding: clamp(16px, 2.6vh, 30px) clamp(18px, 2.4vw, 34px); }
#boToolView:not([hidden]) { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#boMasterfile:not([hidden]) { flex: 1; min-height: 0; overflow-y: auto; }
.bo-tool-head {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 26px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.bo-tool-title {
  font-family: var(--serif);
  font-weight: 800;
  font-size: 30px;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--text);
}
.bo-tool-placeholder {
  border: 1px dashed var(--line-2);
  padding: 48px 32px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--text-mute);
  max-width: 640px;
}
.bo-tool-placeholder p { margin: 0; font-size: 14px; line-height: 1.55; }

/* Masterfile - pagina stile Notion (dark) editabile */
.bo-doc .doc-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 12px 0 120px;
}
.doc-icon { font-size: 54px; line-height: 1; margin-bottom: 12px; }
.doc-title {
  font-family: var(--serif);
  font-weight: 800;
  font-size: 40px;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 0 0 18px;
}
.doc-body {
  font-family: 'Archivo', -apple-system, 'Segoe UI', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: rgba(245,246,248,0.82);
  outline: none;
}
.doc-body h1 { font-size: 30px; font-weight: 700; color: var(--text); margin: 30px 0 6px; letter-spacing: -0.01em; }
.doc-body h2 { font-size: 23px; font-weight: 700; color: var(--text); margin: 26px 0 4px; letter-spacing: -0.01em; }
.doc-body h3 { font-size: 19px; font-weight: 600; color: var(--text); margin: 20px 0 4px; }
.doc-body p { margin: 6px 0; }
.doc-body ul, .doc-body ol { margin: 6px 0; padding-left: 24px; }
.doc-body li { margin: 3px 0; }
.doc-body hr { border: none; border-top: 1px solid var(--line-2); margin: 22px 0; }
.doc-body a { color: var(--cyan); }
.doc-callout {
  background: rgba(107,195,74,0.07);
  border: 1px solid rgba(107,195,74,0.25);
  border-left: 3px solid var(--green);
  padding: 14px 16px;
  margin: 8px 0 22px;
  font-size: 14.5px;
  color: var(--text-mute);
}
.bo-doc ::selection { background: rgba(34,230,230,0.28); }

/* LP Pipeline - kanban CRM (stile dark/squadrato/brand) */
.lp-board {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  overflow-x: auto;
  padding-bottom: 10px;
}
.lp-col {
  flex: 1 1 0;
  min-width: 0;
  max-width: 260px;
  display: flex;
  flex-direction: column;
}
.lp-col-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-bottom: none;
  background: var(--bg-elev);
}
.lp-dot { width: 8px; height: 8px; flex-shrink: 0; }
.lp-col-name {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text);
  flex: 1;
}
.lp-col-count {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-mute);
  white-space: nowrap;
  margin-left: auto;
  padding-left: 6px;
}
.lp-col-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,0.30);
  min-height: 56px;
  transition: background .12s ease, border-color .12s ease;
}
.lp-col-body.drag-over { border-color: var(--col-color, var(--cyan)); background: color-mix(in srgb, var(--col-color, var(--cyan)) 9%, transparent); }
.lp-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  background: var(--bg-card);
  cursor: grab;
  transition: border-color .12s ease, background .12s ease;
}
.lp-card:hover { border-color: var(--line-2); background: var(--bg-hover); }
.lp-card.dragging { opacity: 0.45; cursor: grabbing; }
.lp-card-ic { color: var(--text-dim); flex-shrink: 0; }
.lp-card-name {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 13px;
  color: var(--text);
  letter-spacing: 0.01em;
  min-width: 0;
  word-break: break-word;
}
.lp-card-del {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 15px;
  line-height: 1;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .12s ease, color .12s ease;
  flex-shrink: 0;
}
.lp-card:hover .lp-card-del { opacity: 1; }
.lp-card-del:hover { color: var(--magenta); }
.lp-add {
  background: transparent;
  border: 1px dashed var(--line-2);
  color: var(--text-dim);
  font-family: var(--sans);
  font-weight: 500;
  font-size: 12.5px;
  letter-spacing: 0.04em;
  padding: 8px 10px;
  text-align: left;
  cursor: pointer;
  transition: color .12s ease, border-color .12s ease;
}
.lp-add:hover { color: var(--cyan); border-color: var(--cyan); }
.lp-add-input {
  background: var(--bg-card);
  border: 1px solid var(--cyan);
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  padding: 8px 10px;
  outline: none;
  width: 100%;
}
.lp-add-input::placeholder { color: var(--text-dim); }

/* LP Pipeline v2 - board+detail / chart+pie, forecast, card detail */
.bo-tool-head-lp { flex-direction: row; align-items: flex-start; justify-content: space-between; }
.lp-chart-toggle {
  background: transparent; border: 1px solid var(--line-2); color: var(--text-mute);
  width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0; transition: all .15s ease;
}
.lp-chart-toggle:hover { color: var(--cyan); border-color: var(--cyan); }
.lp-chart-toggle.active { color: #000; background: var(--cyan); border-color: var(--cyan); }

.lp-layout { display: grid; grid-template-columns: minmax(0, 1fr) clamp(250px, 22vw, 300px); gap: 16px; align-items: stretch; flex: 1; min-height: 0; }
.lp-left, .lp-right { min-width: 0; }

/* App-shell fit-to-height: vista chart in pagina senza scroll (no barra a destra) */
.lp-mode-chart .lp-left { display: flex; flex-direction: column; min-height: 0; }
.lp-mode-chart .lp-metrics { flex-shrink: 0; }
.lp-mode-chart .lp-chartbox { flex: 1; min-height: 0; display: flex; flex-direction: column; margin-bottom: 0; }
.lp-mode-chart .lp-fcsvg { flex: 1; min-height: 0; }
.lp-mode-chart .lp-fclegend { flex-shrink: 0; }
.lp-mode-chart .lp-right { min-height: 0; overflow-y: auto; display: flex; flex-direction: column; }
.lp-mode-chart .lp-bub-wrap { flex: 1; min-height: 0; }
.lp-mode-chart .lp-bub-svg { flex: 1; min-height: 0; }
.lp-mode-chart .lp-modelinfo { flex-shrink: 0; }
.lp-mode-board .lp-left { min-height: 0; overflow: hidden; }
.lp-mode-board .lp-board { height: 100%; overflow: auto; }
.lp-mode-board .lp-right { min-height: 0; overflow-y: auto; }

@media (max-width: 1180px) {
  .lp-layout { grid-template-columns: 1fr; flex: none; min-height: 0; }
  .bo-main { overflow-y: auto; display: block; }
  .lp-mode-chart .lp-left, .lp-mode-board .lp-left { display: block; overflow: visible; }
  .lp-mode-chart .lp-chartbox { display: block; flex: none; margin-bottom: 10px; }
  .lp-mode-chart .lp-fcsvg { flex: none; }
  .lp-mode-board .lp-board { height: auto; }
  .lp-mode-chart .lp-right, .lp-mode-board .lp-right { overflow: visible; }
}

.lp-detail, .lp-detail-empty {
  border: 1px solid var(--line); background: rgba(0,0,0,0.30); padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
}
.lp-detail-empty { align-items: flex-start; color: var(--text-dim); }
.lp-detail-empty p { margin: 0; font-size: 13px; line-height: 1.5; }
.lp-d-status {
  align-self: flex-start; font-family: var(--mono); font-size: 10px; font-weight: 700;
  letter-spacing: 0.16em; text-transform: uppercase; border: 1px solid; padding: 3px 8px;
}
.lp-d-name { font-family: var(--serif); font-weight: 800; font-size: 22px; letter-spacing: -0.01em; margin: 0; color: var(--text); }
.lp-d-pill { display: flex; flex-direction: column; gap: 4px; }
.lp-d-label { font-family: var(--mono); font-size: 9px; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; color: var(--green); }
.lp-d-type, .lp-d-ticket, .lp-d-notes, .lp-d-owner, .lp-d-linker, .lp-d-city {
  background: var(--bg-card); border: 1px solid var(--line); color: var(--text);
  font-family: var(--sans); font-size: 14px; padding: 8px 10px; outline: none; width: 100%;
}
.lp-d-type:focus, .lp-d-ticket:focus, .lp-d-notes:focus, .lp-d-owner:focus, .lp-d-linker:focus, .lp-d-city:focus { border-color: var(--cyan); }
.lp-d-notes { resize: vertical; min-height: 68px; line-height: 1.45; }
.lp-d-closed { display: flex; align-items: center; justify-content: space-between; border: 1px solid var(--line); padding: 8px 10px; }
.lp-d-closed-v { font-family: var(--mono); font-size: 12px; color: var(--green); }

.lp-addform { display: flex; flex-direction: column; gap: 6px; border: 1px solid var(--cyan); background: var(--bg-card); padding: 8px; }
.lp-af-row { display: flex; gap: 6px; }
.lp-af-name, .lp-af-type, .lp-af-ticket {
  background: var(--bg-elev); border: 1px solid var(--line); color: var(--text);
  font-family: var(--sans); font-size: 13px; padding: 7px 8px; outline: none; width: 100%;
}
.lp-af-name:focus, .lp-af-type:focus, .lp-af-ticket:focus { border-color: var(--cyan); }
.lp-af-ok, .lp-af-cancel { flex: 1; border: 1px solid var(--line-2); background: transparent; color: var(--text-mute); font-family: var(--sans); font-weight: 600; font-size: 12px; padding: 7px; cursor: pointer; transition: all .12s ease; }
.lp-af-ok:hover { color: #000; background: var(--cyan); border-color: var(--cyan); }
.lp-af-cancel:hover { color: var(--text); }

.lp-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }
.lp-metric { border: 1px solid var(--line); background: var(--bg-card); padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.lp-metric-k { font-family: var(--mono); font-size: 9px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-dim); }
.lp-metric-v { font-family: var(--serif); font-weight: 800; font-size: 18px; color: var(--text); }
.lp-chartbox { border: 1px solid var(--line); background: rgba(0,0,0,0.30); padding: 10px; margin-bottom: 10px; }
.lp-fcsvg { width: 100%; height: auto; display: block; }
.lp-axt { font-family: var(--mono); font-size: 7px; fill: var(--text-dim); }
.lp-fclegend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 8px; padding-top: 9px; border-top: 1px solid var(--line); }
.lp-fcleg { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 10px; letter-spacing: 0.06em; color: var(--text-mute); text-transform: uppercase; }
.lp-fcleg svg { display: block; }

.lp-assume { border: 1px solid var(--line); background: rgba(0,0,0,0.30); padding: 12px; }
.fc-table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.fc-table th { font-family: var(--mono); font-size: 8px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-dim); text-align: left; padding: 3px 3px; border-bottom: 1px solid var(--line); }
.fc-table td { padding: 3px 3px; border-bottom: 1px solid var(--line); }
.fc-rl { font-family: var(--sans); font-size: 10px; color: var(--text-mute); white-space: nowrap; }
.fc-tc { display: flex; gap: 2px; }
.fc-in { background: var(--bg-card); border: 1px solid var(--line); color: var(--text); font-family: var(--mono); font-size: 9px; padding: 3px 2px; width: 22px; outline: none; text-align: center; }
.fc-cr { width: 28px; }
.fc-t { width: 20px; }
.fc-in:focus { border-color: var(--cyan); }

.lp-bub-wrap { border: 1px solid var(--line); background: rgba(0,0,0,0.30); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.lp-bub-svg { width: 100%; height: auto; display: block; }
.lp-bub-n { font-family: var(--serif); font-weight: 800; font-size: 14px; fill: #06110E; }

.lp-pie-wrap { border: 1px solid var(--line); background: rgba(0,0,0,0.30); padding: 16px; display: flex; flex-direction: column; gap: 14px; align-items: center; }
.lp-pie-wrap .mono-tag { align-self: flex-start; }
.lp-pie-svg { width: 150px; height: 150px; display: block; }
.lp-pie-num { font-family: var(--serif); font-weight: 800; font-size: 26px; fill: var(--text); }
.lp-pie-sub { font-family: var(--mono); font-size: 6px; letter-spacing: 0.2em; fill: var(--text-dim); }
.lp-pie-legend { width: 100%; display: flex; flex-direction: column; gap: 8px; }
.lp-pie-li { display: grid; grid-template-columns: 10px 1fr auto; gap: 10px; align-items: center; }
.lp-pie-dot { width: 10px; height: 10px; }
.lp-pie-lab { font-family: var(--sans); font-size: 13px; color: var(--text); }
.lp-pie-val { font-family: var(--mono); font-size: 12px; color: var(--text-mute); }

.lp-card.selected { border-color: var(--cyan); background: var(--bg-hover); }
.crm-card-body { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.crm-card-sub { font-family: var(--mono); font-size: 10px; letter-spacing: 0.03em; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* CRM funnel + toggle view/edit + valori read-only + info box modello */
.crm-funnel { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 12px; flex-shrink: 0; }
.crm-funnel-box { display: flex; flex-direction: column; gap: 2px; border: 1px solid var(--line); background: var(--bg-card); padding: 7px 14px; }
.crm-funnel-k { font-family: var(--mono); font-size: 8.5px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-dim); white-space: nowrap; }
.crm-funnel-v { font-family: var(--serif); font-weight: 800; font-size: 19px; color: var(--text); }
.crm-funnel-arrow { color: var(--text-dim); font-size: 14px; }
.crm-edit-toggle { background: transparent; border: 1px solid var(--line-2); color: var(--text-mute); width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; transition: all .15s ease; }
.crm-edit-toggle:hover { color: var(--cyan); border-color: var(--cyan); }
.crm-edit-toggle.active { color: #000; background: var(--cyan); border-color: var(--cyan); }
.crm-val { font-family: var(--sans); font-size: 14px; color: var(--text); word-break: break-word; }
.crm-val.empty { color: var(--text-dim); }
.crm-link { color: var(--cyan); text-decoration: none; font-size: 14px; word-break: break-all; }
.crm-link:hover { text-decoration: underline; }
.crm-notes-view { font-size: 13px; color: var(--text-mute); line-height: 1.5; white-space: pre-wrap; }
.lp-modelinfo { border: 1px solid var(--line); background: var(--bg-card); padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.lp-modelinfo p { margin: 0; font-size: 12px; line-height: 1.5; color: var(--text-mute); }
.lp-mi-hi { color: var(--text); }

/* Matita modifica DENTRO la card, in alto a destra (drag sempre attivo) */
.lp-detail, .lp-detail-empty { position: relative; }
.crm-edit-card { position: absolute; top: 12px; right: 12px; width: 30px; height: 30px; z-index: 3; }
.lp-detail > .lp-d-name { padding-right: 34px; }
.lp-detail-empty > .mono-tag { padding-right: 38px; }
/* Cestino sui Lost: accanto alla matita, senza quadrato intorno */
.lp-trash { position: absolute; top: 12px; right: 50px; width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; background: transparent; border: none; color: var(--text-mute); cursor: pointer; z-index: 3; transition: color .15s ease; }
.lp-trash:hover { color: var(--red); }
.lp-detail-lost > .lp-d-name { padding-right: 68px; }

/* Funnel: rettangoli di uguale grandezza + tasto info (apre Sankey snapshot) */
.crm-funnel-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-shrink: 0; }
.crm-funnel-row .crm-funnel { flex: 1; margin-bottom: 0; flex-wrap: nowrap; }
.crm-funnel-row .crm-funnel-box { flex: 1 1 0; min-width: 0; align-items: center; text-align: center; }
.crm-funnel-info { flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line-2); background: transparent; color: var(--text-mute); font-family: var(--serif); font-style: italic; font-weight: 700; font-size: 14px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: all .15s ease; }
.crm-funnel-info:hover { color: var(--cyan); border-color: var(--cyan); }

/* KPI strip (VC Partners) */
.crm-kpis { display: flex; gap: 10px; margin-bottom: 12px; flex-shrink: 0; }
.crm-kpi { flex: 1; border: 1px solid var(--line); background: var(--bg-card); padding: 10px 14px; display: flex; flex-direction: column; gap: 4px; }
.crm-kpi-v { font-family: var(--serif); font-weight: 800; font-size: 24px; }
.crm-kpi-k { font-family: var(--mono); font-size: 9px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-dim); }

/* Sankey snapshot overlay */
.crm-sankey-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.72); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 20px; }
.crm-sankey-modal { background: var(--bg-card); border: 1px solid var(--line-2); padding: 18px 20px 20px; width: min(640px, 94vw); }
.crm-sankey-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.crm-sankey-close { background: transparent; border: none; color: var(--text-mute); font-size: 22px; line-height: 1; cursor: pointer; padding: 0 4px; }
.crm-sankey-close:hover { color: var(--text); }
.crm-sankey-svg { width: 100%; height: auto; display: block; }
.crm-sank-main { font-family: var(--mono); font-size: 10px; letter-spacing: 0.02em; fill: var(--text); }
.crm-sank-drop { font-family: var(--mono); font-size: 11px; font-weight: 700; fill: var(--red); }
.crm-sank-l { font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em; fill: var(--text-dim); }
.crm-sankey-cap { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 12px; padding-top: 11px; border-top: 1px solid var(--line); }
.crm-sankey-leg { display: inline-flex; align-items: center; gap: 7px; font-family: var(--mono); font-size: 10px; letter-spacing: 0.04em; color: var(--text-mute); }
.crm-sankey-sw { width: 11px; height: 11px; border-radius: 2px; flex-shrink: 0; }

/* Pannello info modello - header allineato + legenda percentili */
.lp-mi-head { display: flex; align-items: center; gap: 8px; }
.lp-mi-badge { font-family: var(--mono); font-size: 9px; font-weight: 700; letter-spacing: 0.14em; color: #000; background: var(--cyan); padding: 2px 7px; }
.lp-mi-legend { display: flex; flex-direction: column; gap: 7px; margin: 2px 0; }
.lp-mi-row { display: grid; grid-template-columns: 10px 30px 1fr; align-items: center; gap: 10px; }
.lp-mi-dot { width: 10px; height: 10px; border-radius: 50%; }
.lp-mi-pk { font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--text); letter-spacing: 0.04em; }
.lp-mi-pd { font-family: var(--sans); font-size: 12.5px; color: var(--text-mute); }
.lp-mi-foot { font-size: 11px !important; color: var(--text-dim) !important; }

/* HR - tab università (stile fogli Excel) + classifica drag manuale */
.hr-tabs { display: flex; flex-wrap: wrap; gap: 2px; margin-bottom: 14px; border-bottom: 1px solid var(--line-2); flex-shrink: 0; }
.hr-tab { background: var(--bg-elev); border: 1px solid var(--line); border-bottom: none; color: var(--text-mute); font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em; padding: 7px 13px; cursor: pointer; transition: all .12s ease; position: relative; top: 1px; }
.hr-tab:hover { color: var(--text); }
.hr-tab.active { background: var(--bg-card); color: var(--cyan); border-color: var(--line-2); border-bottom: 1px solid var(--bg-card); }
.hr-grid { display: flex; flex-direction: column; gap: 6px; }
.hr-row { display: flex; align-items: center; gap: 11px; border: 1px solid var(--line); background: var(--bg-card); padding: 9px 12px; cursor: grab; transition: border-color .12s ease, background .12s ease; }
.hr-row:hover { background: var(--bg-hover); }
.hr-row.selected { border-color: var(--cyan); background: var(--bg-hover); }
.hr-row.dragging { opacity: 0.45; }
.hr-row.drop-before { box-shadow: inset 0 2px 0 0 var(--cyan); }
.hr-rank { font-family: var(--serif); font-weight: 800; font-size: 18px; color: var(--text-dim); min-width: 26px; text-align: center; flex-shrink: 0; }
.hr-row.selected .hr-rank { color: var(--cyan); }
.hr-row-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.hr-row-name { font-family: var(--sans); font-size: 14px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hr-row-sub { font-family: var(--mono); font-size: 10px; letter-spacing: 0.03em; color: var(--text-dim); }
.hr-stage-chip { font-family: var(--mono); font-size: 8.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; border: 1px solid; padding: 2px 7px; white-space: nowrap; flex-shrink: 0; }
.hr-del { flex-shrink: 0; }
.hr-empty { border: 1px dashed var(--line-2); padding: 20px; color: var(--text-dim); display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.hr-empty p { margin: 0; font-size: 13px; line-height: 1.5; }
.hr-add { margin-top: 4px; }
.hr-d-stage { background: var(--bg-card); border: 1px solid var(--line); color: var(--text); font-family: var(--sans); font-size: 14px; padding: 8px 10px; outline: none; width: 100%; }
.hr-d-stage:focus { border-color: var(--cyan); }
.us-snap-hint { font-family: var(--mono); font-size: 11px; color: var(--text-dim); }

/* Fogli università: body che riempie l'altezza + snapshot Markdown */
.us-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.us-snap { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
.us-snap-head { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.us-snap-back { display: inline-flex; align-items: center; gap: 6px; background: transparent; border: 1px solid var(--line-2); color: var(--text-mute); font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em; padding: 6px 11px; cursor: pointer; transition: all .12s ease; }
.us-snap-back:hover { color: var(--text); border-color: var(--text-mute); }
.us-snap-md-tag { font-family: var(--mono); font-size: 9px; font-weight: 700; letter-spacing: 0.16em; color: #000; background: var(--cyan); padding: 2px 7px; cursor: help; }
.us-snap-ta { flex: 1; min-height: 0; resize: none; background: rgba(0,0,0,0.30); border: 1px solid var(--line); color: var(--text); font-family: var(--mono); font-size: 13px; line-height: 1.6; padding: 16px 18px; outline: none; }
.us-snap-ta:focus { border-color: var(--cyan); }
/* Azioni di riga ✓/✗ (Potential outreach / opportunities) */
.us-row-acts { display: inline-flex; gap: 5px; flex-shrink: 0; }
.us-act { width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center; background: transparent; border: 1px solid var(--line-2); cursor: pointer; transition: all .12s ease; }
.us-act-ok { color: var(--green); }
.us-act-ok:hover { background: var(--green); color: #000; border-color: var(--green); }
.us-act-no { color: var(--red); }
.us-act-no:hover { background: var(--red); color: #000; border-color: var(--red); }
/* Toast undo (7s) */
.us-undo { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 1200; display: flex; align-items: center; gap: 16px; background: var(--bg-elev); border: 1px solid var(--line-2); padding: 11px 16px; box-shadow: 0 10px 30px rgba(0,0,0,0.55); overflow: hidden; }
.us-undo-msg { font-family: var(--sans); font-size: 13px; color: var(--text); }
.us-undo-btn { background: transparent; border: none; color: var(--cyan); font-family: var(--mono); font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; cursor: pointer; }
.us-undo-btn:hover { text-decoration: underline; }
.us-undo-bar { position: absolute; left: 0; bottom: 0; height: 2px; background: var(--cyan); width: 100%; animation: usUndoBar 7s linear forwards; }
@keyframes usUndoBar { from { width: 100%; } to { width: 0; } }

/* Commitments & AUM - neural network force-directed */
.cm-graph { position: relative; flex: 1; min-height: 0; background: rgba(0,0,0,0.30); overflow: hidden; }
.cm-svg { width: 100%; height: 100%; display: block; touch-action: none; }
.cm-edge { stroke: rgba(245,246,248,0.12); stroke-width: 1; }
.cm-node { cursor: grab; }
.cm-node:active { cursor: grabbing; }
.cm-node circle { transition: stroke .12s ease; }
.cm-team:hover circle { stroke: var(--magenta); stroke-width: 1.8; }
.cm-inv:hover circle, .cm-linker:hover circle { stroke: #FFFFFF; stroke-width: 1.4; }
.cm-label { font-family: var(--mono); pointer-events: none; }
.cm-label-team { font-size: 11.5px; font-weight: 600; fill: var(--text); letter-spacing: 0.02em; }
.cm-label-linker, .cm-label-inv { font-size: 8.5px; fill: var(--text-mute); opacity: 0; transition: opacity .12s ease; }
.cm-node.cm-inv:hover .cm-label-inv, .cm-node.cm-linker:hover .cm-label-linker { opacity: 1; fill: var(--text); }
@keyframes cmBlink { 0%, 100% { opacity: 0.4; transform: scale(0.94); } 50% { opacity: 1; transform: scale(1.13); } }
.cm-blink-node circle { animation: cmBlink 2s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.cm-legend { position: absolute; left: 12px; bottom: 12px; display: flex; flex-wrap: wrap; gap: 6px 16px; max-width: calc(100% - 24px); pointer-events: none; }
.cm-leg { display: inline-flex; align-items: center; gap: 7px; font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.03em; color: var(--text-mute); }
.cm-leg-sw { width: 11px; height: 11px; border-radius: 50%; background: var(--cyan); flex-shrink: 0; }
.cm-leg-blink { animation: cmBlink 2s ease-in-out infinite; transform-origin: center; }
.cm-leg-dash { background: transparent; border: 1.5px dashed rgba(245,246,248,0.7); }
.cm-leg-note { color: var(--text-dim); }

/* Viewport bassi: compatta la vista chart così sta in pagina senza scroll */
@media (max-height: 770px) {
  .lp-metric { padding: 7px 10px; }
  .lp-metric-v { font-size: 16px; }
  .lp-metrics, .lp-chartbox { margin-bottom: 8px; }
  .lp-bub-wrap { padding: 10px; gap: 6px; }
  .lp-bub-svg { max-height: 116px; }
  .lp-assume { padding: 10px; }
  .fc-table td, .fc-table th { padding: 2px 3px; }
}

/* ===== Responsive tablet/mobile - stack che evita rotture/sovrapposizioni ===== */
@media (max-width: 820px) {
  /* Back office: sidebar sopra (capped), contenuto sotto a tutta larghezza */
  .bo-shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .bo-sidebar { border-right: none; border-bottom: 1px solid var(--line); max-height: 34vh; }
  /* Front: globo in alto + pannelli impilati, niente overlap tra side e right-stack */
  .intro-stage { display: flex; flex-direction: column; overflow-y: auto; }
  .intro-globe-wrap { position: relative; inset: auto; height: 40vh; flex-shrink: 0; order: -1; }
  .intro-side, .right-stack, .detail-panel {
    position: static; inset: auto; width: auto; height: auto; max-height: none; margin: 12px 12px 0; flex-shrink: 0;
  }
  .right-stack { display: grid; grid-template-rows: auto auto; gap: 12px; }
  .detail-panel[hidden] { display: none; }
  .side-list, .detail-person { flex: none; min-height: auto; overflow: visible; }
}

/* ====================================================================== */
/* ==========================  LOGIN  ================================== */
/* ====================================================================== */
.login-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
  overflow: hidden;
}
/* same brand glow + laboratory dot-grid as the war-room, for continuity */
.login-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(900px 600px at 72% 32%, rgba(34, 230, 230, 0.07), transparent 60%),
    radial-gradient(700px 520px at 22% 78%, rgba(255, 26, 120, 0.05), transparent 60%);
  pointer-events: none;
  z-index: 0;
}
.login-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1.2px);
  background-size: 22px 22px;
  pointer-events: none;
  z-index: 0;
  mask-image: radial-gradient(ellipse at center, #000 25%, rgba(0,0,0,0.35) 65%, transparent 95%);
  -webkit-mask-image: radial-gradient(ellipse at center, #000 25%, rgba(0,0,0,0.35) 65%, transparent 95%);
}
.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 384px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  padding: 38px 34px 30px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
/* top hairline = brand gradient (cyan -> magenta) */
.login-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--grad-brand);
}
.login-brand { display: flex; align-items: center; gap: 12px; }
.login-mark {
  position: relative;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  background: var(--grad-brand);
}
.login-mark::after {
  content: "";
  position: absolute;
  inset: 7px;
  background: var(--bg-card);
}
.login-brand-text { display: flex; flex-direction: column; gap: 3px; }
.login-wordmark {
  font-family: var(--display);
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.14em;
  color: var(--text);
  line-height: 1;
}
.login-kicker {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.login-head { display: flex; flex-direction: column; gap: 7px; }
.login-title {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: 23px;
  letter-spacing: -0.01em;
  color: var(--text);
}
.login-sub {
  margin: 0;
  font-family: var(--sans);
  font-size: 13.5px;
  color: var(--text-mute);
  line-height: 1.45;
}
.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-field { display: flex; flex-direction: column; gap: 8px; }
.login-field label {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.login-field input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 0;
  color: var(--text);
  padding: 12px 14px;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 500;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.login-field input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(34, 230, 230, 0.12);
}
.login-field input::placeholder { color: var(--text-dim); }
.login-error {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.03em;
  color: var(--red);
  min-height: 13px;
  margin-top: -4px;
}
.login-btn {
  margin-top: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  background: var(--grad-brand);
  border: none;
  border-radius: 0;
  color: #000;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 13px 16px;
  transition: filter .15s ease, transform .05s ease;
}
.login-btn:hover { filter: brightness(1.08); }
.login-btn:active { transform: translateY(1px); }
.login-btn:disabled { opacity: 0.5; cursor: default; filter: none; transform: none; }
.login-btn svg { display: block; }
.login-foot {
  text-align: center;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-dim);
}
@media (max-width: 480px) {
  .login-card { padding: 30px 22px 26px; }
  .login-title { font-size: 21px; }
}
