/* ==========================================================================
   NIWA — 庭 — Il Giardino Zen del Director
   Estetica: nero zen, sabbia rastrellata, accenti muschio + lavanda, pixel-art.
   ========================================================================== */

:root {
  /* Notte / sabbia */
  --bg-0: #0a0c09;          /* fondo più profondo */
  --bg-1: #0e110d;          /* stage */
  --bg-2: #12150f;          /* pannelli */
  --bg-3: #171b14;          /* pannelli sollevati */
  --bg-4: #1d2219;          /* hover */
  --line: #232a1f;          /* bordi sottili */
  --line-2: #2c3426;        /* bordi marcati */
  --sand: #2a311f;          /* linee di sabbia rastrellata */

  /* Inchiostro / testo */
  --ink: #e7e2d2;           /* testo principale (sabbia chiara) */
  --ink-soft: #b7b8a6;      /* secondario */
  --ink-dim: #7c8174;       /* terziario */
  --ink-faint: #565c4d;     /* quasi nascosto */

  /* Accenti */
  --moss: #7f9a6f;          /* muschio */
  --moss-2: #9fb98c;
  --lav: #9b8ec4;           /* lavanda */
  --lav-2: #c3bce0;
  --koi: #cf7f3a;           /* vermiglio koi */
  --water: #6f97a4;
  --sakura: #c98fa6;
  --gold: #e7cf86;

  --accent: var(--lav);
  --accent-soft: rgba(155, 142, 196, 0.16);

  /* Forme */
  --r-s: 4px;
  --r-m: 8px;
  --r-l: 12px;
  --shadow: 0 8px 30px rgba(0,0,0,0.45), 0 1px 0 rgba(255,255,255,0.02) inset;
  --shadow-soft: 0 2px 14px rgba(0,0,0,0.35);

  --topbar-h: 46px;
  --toolbar-w: 54px;
  --sidebar-w: 232px;
  --inspector-w: 268px;

  --font-pixel: "Press Start 2P", "Courier New", monospace;
  --font-mono: "VT323", "DejaVu Sans Mono", "Courier New", monospace;
  --font-ui: "Segoe UI", system-ui, -apple-system, sans-serif;

  --t-fast: 120ms cubic-bezier(.2,.7,.3,1);
  --t-med: 240ms cubic-bezier(.2,.7,.3,1);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }

body {
  background: var(--bg-0);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 14px;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

::selection { background: var(--accent-soft); color: var(--ink); }

/* Scrollbars zen */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #3a4431; }

button { font-family: inherit; color: inherit; }
.hidden { display: none !important; }

/* ===== Layout shell ====================================================== */
#app {
  display: grid;
  grid-template-columns: var(--toolbar-w) var(--sidebar-w) 1fr var(--inspector-w);
  grid-template-rows: var(--topbar-h) 1fr;
  grid-template-areas:
    "top top top top"
    "tool side stage inspect";
  height: 100vh;
  width: 100vw;
  transition: grid-template-columns .26s ease; /* collasso animato dei pannelli */
}
#app.no-side { grid-template-columns: var(--toolbar-w) 0 1fr var(--inspector-w); }
#app.no-inspect { grid-template-columns: var(--toolbar-w) var(--sidebar-w) 1fr 0; }
#app.no-side.no-inspect { grid-template-columns: var(--toolbar-w) 0 1fr 0; }
/* linguetta di riapertura ai bordi (compare quando il pannello è nascosto) */
.edge-reveal { position: fixed; top: 50%; transform: translateY(-50%); z-index: 60; width: 20px; height: 72px; display: none; align-items: center; justify-content: center; background: var(--bg-2); border: 1px solid var(--line-2); color: var(--ink-dim); cursor: pointer; opacity: .55; transition: opacity var(--t-fast), width var(--t-fast), background var(--t-fast); }
.edge-reveal:hover { opacity: 1; width: 26px; background: var(--accent-soft); border-color: var(--accent); color: var(--ink); }
.edge-reveal svg { width: 16px; height: 16px; }
#sideReveal { left: var(--toolbar-w); border-left: none; border-radius: 0 8px 8px 0; }
#inspReveal { right: 0; border-right: none; border-radius: 8px 0 0 8px; }
#app.no-side #sideReveal { display: flex; }
#app.no-inspect #inspReveal { display: flex; }
/* linguetta "nascondi ispettore" al suo bordo sinistro */
#inspCollapseBtn { position: fixed; top: calc(var(--topbar-h) + 10px); right: var(--inspector-w); transform: translateX(50%); z-index: 25; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; background: var(--bg-2); border: 1px solid var(--line-2); color: var(--ink-dim); border-radius: 7px; cursor: pointer; opacity: .5; transition: opacity var(--t-fast), border-color var(--t-fast), right .26s ease; }
#inspCollapseBtn:hover { opacity: 1; border-color: var(--accent); color: var(--ink); }
#inspCollapseBtn svg { width: 17px; height: 17px; }
#app.no-inspect #inspCollapseBtn, #app.focus #inspCollapseBtn { display: none; }

/* ===== Top bar =========================================================== */
#topbar {
  grid-area: top;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 12px;
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  border-bottom: 1px solid var(--line);
  z-index: 30;
}
.brand { display: flex; align-items: center; gap: 9px; padding-right: 6px; }
.brand .kanji {
  font-family: var(--font-pixel);
  font-size: 16px;
  color: var(--lav-2);
  text-shadow: 0 0 12px rgba(155,142,196,.4);
}
.brand .wordmark {
  font-family: var(--font-pixel);
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--ink-soft);
}
.brand .tagline { font-size: 11px; color: var(--ink-faint); margin-left: 2px; }

.topbar-spacer { flex: 1; }

.board-switch {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: var(--r-m);
  padding: 3px 4px 3px 10px;
}
.board-switch select {
  background: transparent; border: none; color: var(--ink);
  font-family: var(--font-mono); font-size: 17px; outline: none;
  max-width: 180px; cursor: pointer;
}
.board-switch select option { background: var(--bg-3); color: var(--ink); font-size: 14px; }

.tb-btn {
  height: 30px; min-width: 30px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 0 9px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: var(--r-m);
  color: var(--ink-soft);
  cursor: pointer;
  transition: var(--t-fast);
  font-size: 12.5px;
}
.tb-btn:hover { background: var(--bg-4); color: var(--ink); border-color: var(--line-2); }
.tb-btn:active { transform: translateY(1px); }
.tb-btn.active, .tb-btn.on {
  background: var(--accent-soft); color: var(--lav-2);
  border-color: rgba(155,142,196,.5); box-shadow: 0 0 0 1px rgba(155,142,196,.18), 0 0 12px rgba(155,142,196,.12);
}
.tb-btn.icon { padding: 0; width: 30px; }
.tb-btn svg { width: 15px; height: 15px; }

.zoom-pill {
  display: flex; align-items: center;
  background: var(--bg-3); border: 1px solid var(--line); border-radius: var(--r-m);
  overflow: hidden;
}
.zoom-pill button { background: transparent; border: none; color: var(--ink-soft); width: 28px; height: 30px; cursor: pointer; font-size: 16px; }
.zoom-pill button:hover { background: var(--bg-4); color: var(--ink); }
.zoom-pill .zoom-val {
  font-family: var(--font-mono); font-size: 16px; color: var(--ink-soft);
  width: 50px; text-align: center; cursor: pointer; user-select: none;
}

/* ===== Left toolbar ====================================================== */
#toolbar {
  grid-area: tool;
  display: flex; flex-direction: column; align-items: center;
  gap: 6px; padding: 10px 0;
  background: var(--bg-2);
  border-right: 1px solid var(--line);
  z-index: 25;
}
.tool {
  position: relative;
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-m);
  color: var(--ink-dim);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--t-fast);
}
.tool:hover { background: var(--bg-3); color: var(--ink); }
.tool.tool-create { cursor: grab; touch-action: none; }
.tool.tool-create:active { cursor: grabbing; }
/* mentre trascini uno strumento nel canvas */
body.tool-dragging, body.tool-dragging * { cursor: grabbing !important; }
#placeGhost { pointer-events: none; }
.tool.active {
  background: var(--accent-soft);
  color: var(--lav-2);
  border-color: rgba(155,142,196,.35);
  box-shadow: 0 0 0 1px rgba(155,142,196,.12), 0 0 16px rgba(155,142,196,.14);
}
.tool svg { width: 20px; height: 20px; }
.tool .kbd { display: none; } /* la scorciatoia è nel tooltip: niente più sigle sovrapposte */
.tool-sep { width: 20px; height: 1px; background: var(--line); margin: 5px 0; }

/* tooltip */
.tool[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute; left: 46px; top: 50%; transform: translateY(-50%);
  background: var(--bg-4); color: var(--ink); border: 1px solid var(--line-2);
  padding: 4px 8px; border-radius: var(--r-s); white-space: nowrap;
  font-size: 12px; z-index: 60; box-shadow: var(--shadow-soft);
  font-family: var(--font-ui);
}

/* ===== Sidebar =========================================================== */
#sidebar {
  grid-area: side;
  background: var(--bg-2);
  border-right: 1px solid var(--line);
  overflow: hidden;
  display: flex; flex-direction: column;
  z-index: 20;
}
#app.no-side #sidebar { pointer-events: none; } /* clip via griglia (overflow:hidden) → animazione di collasso */
.side-section { padding: 12px 12px 6px; flex: 0 0 auto; }
/* l'ALBERO PROGETTI scorre internamente: Cerca, Tag e footer restano FERMI (non si spostano quando l'albero cresce) */
.side-projects-sec { flex: 1 1 auto; min-height: 60px; overflow-y: auto; }
/* riga Cerca con pulsanti (toggle Tag + collassa) */
.side-search-row { display: flex; align-items: center; gap: 6px; }
.side-search-row .side-search { flex: 1; min-width: 0; margin: 0; }
.side-icon-btn { flex: none; width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; background: var(--bg-0); border: 1px solid var(--line); color: var(--ink-soft); border-radius: var(--r-s); cursor: pointer; line-height: 1; }
.side-icon-btn svg { width: 19px; height: 19px; }
.side-icon-btn:hover { border-color: var(--accent); color: var(--ink); }
.side-icon-btn.on { background: var(--accent-soft); border-color: var(--accent); color: var(--lav-2); }
#app.no-tagpanel .side-tags-sec { display: none; }
.side-head {
  display: flex; align-items: center; justify-content: space-between;
  font-family: var(--font-pixel); font-size: 8px; letter-spacing: 1.5px;
  color: var(--ink-dim); text-transform: uppercase; margin-bottom: 9px;
}
.side-head .add {
  cursor: pointer; color: var(--ink-dim); font-size: 16px; line-height: 1;
  font-family: var(--font-ui); transition: var(--t-fast);
}
.side-head .add:hover { color: var(--lav-2); }

.board-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 9px; border-radius: var(--r-m); cursor: pointer;
  color: var(--ink-soft); margin-bottom: 2px; transition: var(--t-fast);
  border: 1px solid transparent;
}
.board-item:hover { background: var(--bg-3); }
.board-item.active { background: var(--bg-3); color: var(--ink); border-color: var(--line-2); }
.board-item .dot { width: 8px; height: 8px; border-radius: 2px; background: var(--moss); flex: none; }
.board-item .nm { flex: 1; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-item .cnt { font-family: var(--font-mono); font-size: 14px; color: var(--ink-faint); }
.board-item input {
  flex: 1; background: var(--bg-0); border: 1px solid var(--line-2);
  color: var(--ink); border-radius: var(--r-s); padding: 2px 6px; font-size: 13px; outline: none;
}

/* ===== Albero progetti (hub) ========================================== */
.side-head-actions { display: flex; gap: 10px; }
.tree-row {
  display: flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: var(--r-s);
  cursor: pointer; color: var(--ink-soft); font-size: 13px; user-select: none; border: 1px solid transparent;
}
.tree-row:hover { background: var(--bg-3); }
.tree-row.board.active { background: var(--bg-3); color: var(--ink); border-color: var(--line-2); }
.tree-row.tw-dragging { opacity: .4; }
.tree-row.tw-drop { background: var(--accent-soft); border-color: var(--accent); }
/* icone uniformi: stessa scatola 16-17px per caret/icona/azioni */
.tree-row .tw-caret { width: 16px; height: 16px; flex: none; display: flex; align-items: center; justify-content: center; color: var(--ink-dim); cursor: pointer; transition: transform .12s ease; }
.tree-row .tw-caret.open { transform: rotate(90deg); }
.tree-row .tw-caret svg { width: 13px; height: 13px; }
.tree-row .tw-icon { width: 17px; height: 17px; flex: none; display: flex; align-items: center; justify-content: center; color: var(--ink-dim); }
.tree-row .tw-icon svg { width: 15px; height: 15px; }
.tree-row.folder .tw-icon { color: var(--moss); }
.tree-row .tw-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; margin: 0 4px; box-shadow: 0 0 0 2px color-mix(in srgb, currentColor 10%, transparent); }
.tree-row .tw-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-row.folder .tw-name { font-weight: 600; color: var(--ink); }
.tree-row .tw-cnt { font-family: var(--font-mono); font-size: 12px; color: var(--ink-faint); }
.tree-row .tw-edit { flex: 1; background: var(--bg-0); border: 1px solid var(--line-2); color: var(--ink); border-radius: 4px; padding: 1px 6px; font-size: 13px; outline: none; }
/* azioni SEMPRE presenti nel layout (opacity 0→1) così l'hover non fa crescere la riga = niente shift verso il basso */
.tree-row .tw-actions { display: flex; align-items: center; gap: 2px; opacity: 0; pointer-events: none; transition: opacity var(--t-fast); }
.tree-row:hover .tw-actions { opacity: 1; pointer-events: auto; }
.tw-act { width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; border-radius: 5px; color: var(--ink-dim); cursor: pointer; }
.tw-act svg { width: 14px; height: 14px; }
.tw-act:hover { background: var(--bg-4); color: var(--ink); }
.tw-act.tw-del:hover { color: var(--koi); }
.side-head .add svg { width: 15px; height: 15px; }
.side-head .add { display: inline-flex; align-items: center; justify-content: center; }

/* menu contestuale (nuovo documento) */
.ctx-menu {
  position: fixed; z-index: 210; min-width: 178px; background: var(--bg-2);
  border: 1px solid var(--line-2); border-radius: var(--r-m); box-shadow: var(--shadow); padding: 5px; animation: pop var(--t-fast);
}
.ctx-item { padding: 8px 10px; border-radius: var(--r-s); cursor: pointer; color: var(--ink-soft); font-size: 13px; display: flex; align-items: center; gap: 9px; }
.ctx-item:hover { background: var(--accent-soft); color: var(--ink); }
.ctx-ic { display: inline-flex; align-items: center; justify-content: center; width: 17px; height: 17px; flex: none; color: var(--ink-dim); }
.ctx-ic svg { width: 17px; height: 17px; }
.ctx-item:hover .ctx-ic { color: var(--lav-2); }
/* icona SVG inline nei pulsanti (coerenza icone) */
.bic { display: inline-flex; align-items: center; flex: none; }
.bic svg { width: 14px; height: 14px; }
button .bic + *, button .bic { vertical-align: middle; }
button .bic { margin-right: 5px; }
button.icon-only .bic { margin-right: 0; }
.ctx-sep { height: 1px; background: var(--line); margin: 4px 6px; }
/* ---- menu contestuale del nodo (sostituisce l'ispettore) ---- */
.node-menu { min-width: 212px; max-width: 248px; max-height: 86vh; overflow: auto; }
.ctx-head { display: flex; align-items: center; gap: 8px; padding: 4px 8px 7px; margin-bottom: 3px; border-bottom: 1px solid var(--line); }
.ctx-head .ctx-ic { color: var(--lav-2); }
.ctx-head-name { font-size: 12.5px; font-weight: 600; color: var(--ink); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ctx-item.danger { color: var(--rose, #e0808a); }
.ctx-item.danger:hover { background: color-mix(in srgb, var(--rose, #e0808a) 16%, transparent); color: var(--rose, #e0808a); }
.ctx-item.danger .ctx-ic { color: currentColor; }
.ctx-colors { display: flex; flex-wrap: wrap; gap: 5px; padding: 3px 9px 7px; }
.ctx-sw { width: 17px; height: 17px; border-radius: 5px; border: 1px solid rgba(255,255,255,.18); cursor: pointer; padding: 0; outline: none; transition: transform var(--t-fast); }
.ctx-sw:hover { transform: scale(1.14); }
.ctx-sw.on { box-shadow: 0 0 0 2px var(--bg-2), 0 0 0 3.5px var(--ink-soft); }
.ctx-chips { display: flex; flex-wrap: wrap; gap: 5px; padding: 3px 9px 7px; }
.ctx-chip { font-size: 11.5px; color: var(--ink-dim); background: var(--bg-1); border: 1px solid var(--line-2); border-radius: 999px; padding: 3px 10px; cursor: pointer; transition: all var(--t-fast); }
.ctx-chip:hover { color: var(--ink); border-color: var(--lav-2); }
.ctx-chip.on { color: var(--ink); background: var(--accent-soft); border-color: var(--lav-2); }
.ctx-sub { font-size: 10px; color: var(--ink-faint); padding: 6px 10px 2px; text-transform: uppercase; letter-spacing: .05em; }
.ctx-chip.facet.on { color: #0a0c09; background: var(--fc); border-color: var(--fc); font-weight: 700; }
/* riga delle facce (scadenza, stato, priorità…) sotto il titolo del nodo: è un task quando ne ha */
.node .nprops { display: flex; flex-wrap: wrap; gap: 4px; padding: 5px 8px 0; align-items: center; }
/* toggle d'aspetto a icone nel menu (i tasti "belli") */
.ctx-itogs { display: flex; flex-wrap: wrap; gap: 5px; padding: 6px 9px 7px; }
.ctx-itog { width: 31px; height: 28px; display: inline-flex; align-items: center; justify-content: center; border-radius: 7px; cursor: pointer; background: var(--bg-1); border: 1px solid var(--line-2); color: var(--ink-dim); transition: color var(--t-fast), background var(--t-fast), border-color var(--t-fast); }
.ctx-itog svg { width: 16px; height: 16px; }
.ctx-itog:hover { color: var(--ink); border-color: var(--lav-2); }
.ctx-itog.on { color: var(--lav-2); background: var(--accent-soft); border-color: var(--lav-2); }
/* picker dei tag del progetto (popover) */
.tags-pop { min-width: 224px; max-width: 290px; }
.tags-pop-list { display: flex; flex-wrap: wrap; gap: 5px; padding: 4px 8px 8px; max-height: 210px; overflow: auto; }
.tags-pop .tp-input { width: calc(100% - 16px); margin: 2px 8px 6px; }
.tags-pop .ctx-empty { padding: 4px 10px 8px; color: var(--ink-faint); font-size: 12px; }
/* icona/emoji del titolo + picker */
.emoji-ic { font-size: 14px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }
.node .nhead .nicon.nicon-pick { cursor: pointer; border-radius: 5px; transition: background .12s; }
.node .nhead .nicon.nicon-pick:hover { background: var(--accent-soft); }
.icon-pop { width: 286px; }
.icon-pop .ctx-head-row { display: flex; align-items: center; padding: 2px 8px 2px; }
.icon-pop .icon-clear { margin-left: auto; background: transparent; border: none; color: var(--ink-dim); cursor: pointer; font-size: 11px; }
.icon-pop .icon-clear:hover { color: var(--koi); }
.icon-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 3px; padding: 4px 6px 6px; max-height: 220px; overflow: auto; }
.icon-cell { aspect-ratio: 1; border: none; background: transparent; border-radius: 6px; cursor: pointer; font-size: 17px; line-height: 1; display: flex; align-items: center; justify-content: center; transition: background .1s; }
.icon-cell:hover { background: var(--accent-soft); }
.icon-cell.on { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--lav-2); }
/* menu "⋯ Altro": righe con icona allineata + stato on */
.more-menu { min-width: 224px; }
.more-menu .ctx-item { display: flex; align-items: center; gap: 10px; }
.more-menu .ci-ic { width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; text-align: center; flex: none; color: var(--ink-dim); font-size: 13px; }
.more-menu .ci-ic svg { width: 16px; height: 16px; display: block; }
.more-menu .ctx-item.on { color: var(--ink); }
.more-menu .ctx-item.on .ci-ic { color: var(--lav-2); }
.more-menu .ci-on { margin-left: auto; font-size: 9px; text-transform: uppercase; letter-spacing: .05em; color: var(--lav-2); background: var(--accent-soft); border-radius: 7px; padding: 1px 6px; }

/* visualizzatore / editor documenti */
.doc-modal { position: fixed; inset: 0; z-index: 150; display: flex; align-items: center; justify-content: center; background: rgba(5,7,5,.55); backdrop-filter: blur(3px); }
.doc-panel { width: min(780px, 92vw); max-height: 86vh; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--r-l); box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; animation: pop var(--t-med); }
.doc-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.doc-name { flex: 1; background: transparent; border: none; color: var(--ink); font-size: 16px; font-weight: 600; outline: none; }
.doc-x { background: transparent; border: none; color: var(--ink-dim); font-size: 22px; cursor: pointer; line-height: 1; }
.doc-x:hover { color: var(--ink); }
.doc-body { flex: 1; overflow: auto; min-height: 220px; }
.doc-body.note { display: grid; grid-template-columns: 1fr 1fr; min-height: 340px; }
.doc-edit { border: none; border-right: 1px solid var(--line); background: var(--bg-1); color: var(--ink); padding: 14px; font-size: 14px; line-height: 1.55; resize: none; outline: none; font-family: var(--font-ui); }
.doc-prev { padding: 14px; overflow: auto; color: var(--ink-soft); }
.doc-body.img { display: flex; align-items: center; justify-content: center; padding: 14px; background: var(--bg-0); }
.doc-body.img img { max-width: 100%; max-height: 62vh; border-radius: var(--r-s); }
.doc-empty { color: var(--ink-faint); font-style: italic; padding: 40px; text-align: center; }
.doc-tools { display: flex; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); }
.doc-tools input { flex: 1; background: var(--bg-0); border: 1px solid var(--line); color: var(--ink); border-radius: var(--r-s); padding: 7px 9px; font-size: 13px; outline: none; }
.doc-tools button, .doc-del { background: var(--bg-3); border: 1px solid var(--line); color: var(--ink-soft); border-radius: var(--r-m); padding: 7px 12px; cursor: pointer; font-size: 13px; }
.doc-tools button:hover { background: var(--bg-4); color: var(--ink); }
.doc-foot { padding: 10px 14px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; }
.doc-del:hover { background: rgba(207,127,58,.14); color: var(--koi); border-color: rgba(207,127,58,.3); }

/* ===== Collaborazione P2P ============================================= */
#peerCursors { position: absolute; inset: 0; z-index: 12; pointer-events: none; overflow: hidden; }
.peer-cursor { position: absolute; transition: left .06s linear, top .06s linear; z-index: 13; }
.peer-cursor .pc-name { display: inline-block; margin-left: 10px; transform: translateY(-4px); color: #0a0c09; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 10px; white-space: nowrap; box-shadow: 0 1px 4px rgba(0,0,0,.35); }
/* ping di attenzione (meeting) */
.ping { position: absolute; pointer-events: none; z-index: 14; transform: translate(-50%, -50%); }
.ping .ping-ring { position: absolute; left: 0; top: 0; width: 18px; height: 18px; margin: -9px 0 0 -9px; border: 2.5px solid var(--pc, #ec7fb0); border-radius: 50%; animation: pingExpand 1.5s ease-out forwards; }
.ping .ping-ring.r2 { animation-delay: .35s; }
.ping .ping-name { position: absolute; left: 12px; top: -8px; background: var(--pc, #ec7fb0); color: #0a0c09; font: 700 10px/1 var(--font-ui); padding: 2px 6px; border-radius: 6px; white-space: nowrap; animation: pingFade 1.6s ease-out forwards; }
@keyframes pingExpand { 0% { transform: scale(.3); opacity: 0; } 12% { opacity: .9; } 100% { transform: scale(4.5); opacity: 0; } }
@keyframes pingFade { 0%,60% { opacity: 1; } 100% { opacity: 0; } }
.emoji-pop { position: absolute; font-size: 28px; pointer-events: none; transform: translate(-50%,-50%); animation: emojiUp 1.6s ease-out forwards; }
@keyframes emojiUp { 0% { opacity: 0; transform: translate(-50%,-50%) scale(.5); } 16% { opacity: 1; transform: translate(-50%,-90%) scale(1.2); } 100% { opacity: 0; transform: translate(-50%,-230%) scale(1); } }

/* caret colorato "I" del partner dentro un campo di testo condiviso */
.peer-caret { position: absolute; pointer-events: none; z-index: 60; width: 0; }
.peer-caret .peer-caret-bar { position: absolute; left: -1px; top: 0; width: 2px; height: 100%; background: var(--pcol, #ec7fb0); box-shadow: 0 0 6px var(--pcol, #ec7fb0); border-radius: 1px; animation: peerBlink 1.05s steps(2, start) infinite; }
.peer-caret .peer-caret-bar::before { content: ""; position: absolute; left: -2px; top: -2px; width: 6px; height: 3px; background: var(--pcol, #ec7fb0); border-radius: 1px; }
.peer-caret .peer-caret-bar::after { content: ""; position: absolute; left: -2px; bottom: -2px; width: 6px; height: 3px; background: var(--pcol, #ec7fb0); border-radius: 1px; }
.peer-caret .peer-caret-name { position: absolute; left: 1px; top: -15px; font: 700 9px/1 ui-monospace, monospace; background: var(--pcol, #ec7fb0); color: #0a0c09; padding: 2px 5px; border-radius: 4px 4px 4px 0; white-space: nowrap; box-shadow: 0 2px 6px rgba(0,0,0,.4); }
@keyframes peerBlink { 50% { opacity: .25; } }

/* badge "sta scrivendo" sul nodo (quando il partner edita un nodo) */
.peer-edit-badge { position: absolute; top: -11px; right: 10px; display: flex; align-items: center; gap: 4px; background: var(--pcol, #ec7fb0); color: #0a0c09; font: 700 9px/1 system-ui, sans-serif; padding: 3px 6px 3px 5px; border-radius: 7px; pointer-events: none; z-index: 7; box-shadow: 0 2px 8px rgba(0,0,0,.45); animation: pop var(--t-fast); }
.peer-edit-badge .peb-i { font: 800 12px/1 ui-monospace, monospace; animation: peerBlink 1.05s steps(2, start) infinite; }

/* roster: chi è nella stanza */
#roster { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; z-index: 30; background: color-mix(in srgb, var(--bg-2) 86%, transparent); border: 1px solid var(--line-2); border-radius: 22px; padding: 6px 14px; box-shadow: 0 6px 22px rgba(0,0,0,.4); backdrop-filter: blur(6px); font-size: 11.5px; max-width: 80vw; overflow: hidden; }
#roster.hidden { display: none; }
#roster .rost-title { color: var(--ink-dim); font-size: 10px; text-transform: uppercase; letter-spacing: .07em; }
#roster .rost-person { display: flex; align-items: center; gap: 6px; color: var(--ink-soft); white-space: nowrap; }
#roster .rost-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; box-shadow: 0 0 7px currentColor; }
#app.focus #roster { top: 12px; }

.collab-modal { position: fixed; inset: 0; z-index: 160; display: flex; align-items: center; justify-content: center; background: rgba(5,7,5,.55); backdrop-filter: blur(3px); }
.collab-panel { width: min(460px, 92vw); max-height: 88vh; overflow: auto; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--r-l); box-shadow: var(--shadow); animation: pop var(--t-med); }
.cm-head { display: flex; align-items: center; justify-content: space-between; padding: 13px 16px; border-bottom: 1px solid var(--line); font-size: 15px; font-weight: 600; color: var(--ink); }
.cm-sub { font-size: 11px; color: var(--ink-faint); font-weight: 400; margin-left: 6px; }
.cm-x { background: transparent; border: none; color: var(--ink-dim); font-size: 22px; cursor: pointer; }
.cm-x:hover { color: var(--ink); }
.cm-body { padding: 16px; }
.cm-tabs { display: flex; gap: 4px; background: var(--bg-0); padding: 3px; border-radius: var(--r-m); border: 1px solid var(--line); margin: 4px 0 12px; }
.cm-tab { flex: 1; padding: 7px; border: none; background: transparent; color: var(--ink-dim); cursor: pointer; border-radius: var(--r-s); font-size: 13px; }
.cm-tab.on { background: var(--bg-3); color: var(--lav-2); }
.cm-step { font-size: 12.5px; color: var(--ink-soft); margin: 12px 0 6px; }
.cm-step b { color: var(--lav-2); }
.cm-note { font-size: 12.5px; color: var(--ink-dim); line-height: 1.5; }
.cm-ok { font-size: 15px; color: var(--ink); margin: 4px 0 10px; }
.cm-code { width: 100%; height: 68px; resize: vertical; background: var(--bg-0); border: 1px solid var(--line); color: var(--ink-soft); border-radius: var(--r-s); padding: 8px; font-family: var(--font-mono); font-size: 12px; outline: none; word-break: break-all; }
.cm-btn { width: 100%; padding: 9px; margin-top: 8px; border-radius: var(--r-m); border: 1px solid rgba(155,142,196,.4); background: var(--accent-soft); color: var(--lav-2); cursor: pointer; font-size: 13.5px; font-weight: 600; }
.cm-btn:hover { background: rgba(155,142,196,.24); }
.cm-btn.danger { border-color: rgba(207,127,58,.4); background: rgba(207,127,58,.12); color: var(--koi); }
.cm-copy { width: 100%; padding: 7px; margin-top: 6px; border-radius: var(--r-m); border: 1px solid var(--line); background: var(--bg-3); color: var(--ink-soft); cursor: pointer; font-size: 12.5px; }
.cm-copy:hover { background: var(--bg-4); color: var(--ink); }
.cm-body .field input { width: 100%; background: var(--bg-0); border: 1px solid var(--line); color: var(--ink); border-radius: var(--r-s); padding: 7px 9px; font-size: 13px; outline: none; }
.cm-body .field input:focus { border-color: var(--line-2); }
.cm-lock { font-size: 10.5px; color: var(--moss-2); font-weight: 600; margin-left: 4px; }
.cm-passrow { display: flex; gap: 6px; }
.cm-passrow input { flex: 1; font-family: var(--font-mono); }
.cm-gen { background: var(--bg-3); border: 1px solid var(--line); color: var(--ink-soft); border-radius: var(--r-s); padding: 0 11px; cursor: pointer; font-size: 16px; }
.cm-gen:hover { background: var(--bg-4); }
.cm-passhint { font-size: 11px; color: var(--ink-faint); line-height: 1.5; margin-top: 5px; }
.cm-passhint b { color: var(--ink-dim); }
.cm-safety { background: var(--bg-0); border: 1px solid var(--line); border-radius: var(--r-m); padding: 10px 12px; margin: 8px 0 12px; text-align: center; font-size: 12px; color: var(--ink-dim); }
.cm-safecode { font-family: var(--font-mono); font-size: 26px; letter-spacing: 4px; color: var(--moss-2); margin: 4px 0; }
.cm-adv { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.cm-adv summary { cursor: pointer; font-size: 12.5px; color: var(--ink-dim); }
.cm-adv summary:hover { color: var(--ink); }
.cm-turn { width: 100%; margin-top: 6px; background: var(--bg-0); border: 1px solid var(--line); color: var(--ink); border-radius: var(--r-s); padding: 7px 9px; font-size: 12.5px; outline: none; font-family: var(--font-mono); box-sizing: border-box; }
.cm-chk { display: flex; align-items: center; gap: 7px; margin: 8px 0; font-size: 12px; color: var(--ink-soft); cursor: pointer; }
.cm-chk input { width: 15px; height: 15px; }

#chatPanel { position: fixed; right: 16px; bottom: 16px; left: auto; width: 340px; z-index: 140; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--r-l); box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; }
#chatPanel.hidden { display: none; }
#chatPanel.over-modal { z-index: 200; } /* sopra la pagina a schermo intero (page-modal z176) */
#chatPanel.dragging { cursor: grabbing; opacity: .96; }
#chatPanel.min .chat-list, #chatPanel.min .chat-emojis, #chatPanel.min .chat-inputrow { display: none; }
.chat-head { display: flex; align-items: center; gap: 7px; padding: 7px 10px; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--ink); user-select: none; }
.chat-grip { color: var(--ink-faint); cursor: grab; font-size: 13px; line-height: 1; letter-spacing: -2px; flex: none; }
#chatPanel.dragging .chat-grip { cursor: grabbing; }
.chat-thread { flex: 1; min-width: 0; background: var(--bg-3); border: 1px solid var(--line); color: var(--ink); border-radius: var(--r-s); padding: 4px 6px; font-size: 12.5px; font-weight: 600; outline: none; cursor: pointer; }
.chat-thread:hover { border-color: var(--line-2); }
.tb-btn.icon { position: relative; }
.tb-btn.has-unread::after { content: ""; position: absolute; top: 5px; right: 5px; width: 7px; height: 7px; border-radius: 50%; background: var(--koi); box-shadow: 0 0 0 2px var(--bg-1); }

/* mini-grafo force-directed */
#graphPanel { position: fixed; right: 16px; bottom: 16px; z-index: 142; width: 280px; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--r-l); box-shadow: var(--shadow); overflow: hidden; }
#graphPanel.hidden { display: none; }
#graphPanel .gp-head { display: flex; align-items: center; gap: 7px; padding: 7px 10px; border-bottom: 1px solid var(--line); font-size: 12.5px; font-weight: 600; color: var(--ink); user-select: none; }
#graphPanel .gp-grip { color: var(--ink-faint); cursor: grab; letter-spacing: -2px; }
#graphPanel .gp-title { flex: 1; }
#graphPanel .gp-x { background: transparent; border: none; color: var(--ink-dim); cursor: pointer; font-size: 17px; line-height: 1; }
#graphPanel .gp-x:hover { color: var(--ink); }
#graphCanvas { display: block; width: 280px; height: 210px; background: radial-gradient(circle at 50% 45%, var(--bg-1), var(--bg-0)); cursor: pointer; }
#graphPanel .gp-hint { padding: 5px 10px 7px; font-size: 10.5px; color: var(--ink-faint); text-align: center; }
#graphPanel .gp-search { width: calc(100% - 16px); margin: 8px; box-sizing: border-box; background: var(--bg-0); border: 1px solid var(--line); color: var(--ink); border-radius: var(--r-s); padding: 7px 10px; font-size: 12px; outline: none; }
#graphPanel .gp-search:focus { border-color: var(--accent); }
/* filtri per TIPO di connessione + scope (fanno anche da legenda colorata) */
#graphPanel .gp-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 0 8px 6px; }
#graphPanel .gp-ft, #graphPanel .gp-scope { background: var(--bg-0); border: 1px solid var(--line); color: var(--ink-dim); border-radius: 999px; padding: 2px 8px; font-size: 10.5px; cursor: pointer; opacity: .55; }
#graphPanel .gp-ft:hover, #graphPanel .gp-scope:hover { color: var(--ink); }
#graphPanel .gp-ft.on { opacity: 1; color: var(--ink); }
#graphPanel .gp-ft.on[data-t="edge"] { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
#graphPanel .gp-ft.on[data-t="tag"] { border-color: var(--moss); box-shadow: inset 3px 0 0 var(--moss); }
#graphPanel .gp-ft.on[data-t="mention"] { border-color: var(--lav-2); box-shadow: inset 3px 0 0 var(--lav-2); }
#graphPanel .gp-scope.on { opacity: 1; color: var(--ink); border-color: var(--accent); background: var(--accent-soft); }
#graphPanel .gp-fsep { flex: 1; }
.gp-preview { position: fixed; z-index: 150; width: 230px; max-width: 230px; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--r-m); box-shadow: var(--shadow); padding: 9px 11px; pointer-events: none; animation: pop var(--t-fast); }
.gp-preview.hidden { display: none; }
.gp-preview .gpp-type { font-size: 9.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--lav-2); margin-bottom: 2px; }
.gp-preview .gpp-title { font-size: 13px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gp-preview .gpp-snip { font-size: 11.5px; color: var(--ink-dim); margin-top: 4px; line-height: 1.45; max-height: 54px; overflow: hidden; }
.gp-preview .gpp-tags { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px; }
.gp-preview .gpp-tag { font-size: 9.5px; color: var(--moss-2); background: color-mix(in srgb, var(--moss) 16%, transparent); border-radius: 7px; padding: 1px 6px; }
.chat-min { background: transparent; border: none; color: var(--ink-dim); cursor: pointer; font-size: 16px; line-height: 1; }
.chat-acts { display: flex; gap: 2px; }
.chat-close { background: transparent; border: none; color: var(--ink-dim); cursor: pointer; font-size: 17px; line-height: 1; }
.chat-close:hover { color: var(--ink); }
.chat-div { text-align: center; margin: 7px 0 3px; }
.chat-div span { font-size: 10.5px; color: var(--ink-faint); background: var(--bg-3); padding: 1px 9px; border-radius: 10px; text-transform: capitalize; }
.chat-when { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-faint); margin-right: 5px; }
.chat-list { height: min(46vh, 380px); min-height: 200px; overflow-y: auto; padding: 8px 12px; display: flex; flex-direction: column; gap: 5px; }
.chat-att { margin-top: 4px; max-width: 100%; }
.chat-att .att-media { margin: 0; }
.chat-att .att-media img, .chat-att .att-media video { max-height: 200px; }
.chat-att .att-media.att-m3d .m3d-stage { height: 200px; }
.chat-inputrow #chatAttach { background: var(--bg-3); border: 1px solid var(--line); color: var(--ink-soft); border-radius: var(--r-s); padding: 0 9px; cursor: pointer; flex: none; display: inline-flex; align-items: center; }
.chat-inputrow #chatAttach svg { width: 16px; height: 16px; }
.chat-inputrow #chatAttach:hover { border-color: var(--accent); color: var(--ink); }
.chat-msg { font-size: 13px; color: var(--ink-soft); line-height: 1.4; word-break: break-word; }
.chat-sys { font-size: 11.5px; color: var(--ink-faint); text-align: center; font-style: italic; }
.chat-emojis { display: flex; flex-wrap: wrap; gap: 2px; padding: 4px 8px; border-top: 1px solid var(--line); }
.chat-emoji { background: transparent; border: none; cursor: pointer; font-size: 17px; padding: 3px 5px; border-radius: 6px; }
.chat-emoji:hover { background: var(--bg-3); }
.chat-inputrow { display: flex; gap: 6px; padding: 8px; border-top: 1px solid var(--line); }
.chat-inputrow input { flex: 1; background: var(--bg-0); border: 1px solid var(--line); color: var(--ink); border-radius: var(--r-s); padding: 7px 9px; font-size: 13px; outline: none; }
.chat-inputrow button { background: var(--accent-soft); border: 1px solid rgba(155,142,196,.35); color: var(--lav-2); border-radius: var(--r-s); padding: 0 12px; cursor: pointer; font-size: 13px; }

.side-search {
  width: 100%; background: var(--bg-0); border: 1px solid var(--line);
  color: var(--ink); border-radius: var(--r-m); padding: 7px 10px; font-size: 13px; outline: none;
  font-family: var(--font-ui);
}
.side-search:focus { border-color: var(--line-2); }
.side-search::placeholder { color: var(--ink-faint); }

.tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-chip {
  font-size: 12.5px; padding: 4px 11px; border-radius: 20px; cursor: pointer;
  background: transparent; border: 1px solid var(--line); color: var(--ink-soft);
  transition: var(--t-fast); font-weight: 500; letter-spacing: .2px;
}
.tag-chip:hover { filter: brightness(1.25); }
.tag-chip.on { font-weight: 600; }

/* selettore tag a chip (ispettore) */
.tp-wrap { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.tp-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 7px;
  border-radius: 20px; cursor: pointer; font-size: 12.5px; font-weight: 500;
  border: 1px solid var(--tc); color: var(--tc); background: transparent; transition: var(--t-fast);
}
.tp-chip:hover { filter: brightness(1.2); }
.tp-chip.on { background: var(--tc); color: #0a0c09; font-weight: 600; }
.tp-chip .tp-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--tc); flex: none; box-shadow: inset 0 0 0 1px rgba(0,0,0,.3); }
.tp-chip.on .tp-dot { background: rgba(0,0,0,.4); }
.tp-input {
  width: 100%; background: var(--bg-0); border: 1px solid var(--line); color: var(--ink);
  border-radius: var(--r-s); padding: 7px 9px; font-size: 12.5px; outline: none; font-family: var(--font-ui);
}
.tp-input:focus { border-color: var(--line-2); }
.empty-hint { color: var(--ink-faint); font-size: 12.5px; line-height: 1.5; font-style: italic; }

.search-result {
  padding: 6px 9px; border-radius: var(--r-s); cursor: pointer; color: var(--ink-soft);
  font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.search-result:hover { background: var(--bg-3); color: var(--ink); }
.search-result .ty { color: var(--ink-faint); font-family: var(--font-mono); font-size: 13px; margin-right: 6px; }

.side-foot {
  margin-top: auto; padding: 12px; border-top: 1px solid var(--line);
  font-size: 11px; color: var(--ink-faint); line-height: 1.6;
}
.side-foot b { color: var(--ink-dim); font-weight: 600; }

/* ===== Stage / Canvas ==================================================== */
#stage {
  grid-area: stage;
  position: relative;
  overflow: hidden;
  background: var(--bg-1);
  cursor: default;
}
#stage.panning, #stage.space { cursor: grab; }
#stage.panning.dragging { cursor: grabbing; }
#stage.tool-note, #stage.tool-image, #stage.tool-link,
#stage.tool-symbol, #stage.tool-frame, #stage.tool-text { cursor: crosshair; }

/* sabbia rastrellata + vignette */
#bg {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background-color: var(--bg-1);
  background-image:
    radial-gradient(120% 120% at 50% 0%, rgba(155,142,196,0.05), transparent 55%),
    radial-gradient(100% 100% at 100% 100%, rgba(127,154,111,0.05), transparent 55%);
}
#sand {
  position: absolute; inset: -10%; z-index: 0; pointer-events: none; opacity: .6;
  background-repeat: repeat;
}
#petals {
  position: absolute; inset: 0; z-index: 6; pointer-events: none;
}
.vignette {
  position: absolute; inset: 0; z-index: 7; pointer-events: none;
  box-shadow: inset 0 0 160px 40px rgba(0,0,0,0.55);
}

#viewport { position: absolute; inset: 0; z-index: 2; overflow: hidden; }
/* niente will-change: evita la bitmap GPU scalata che sfoca il testo a zoom != 100% */
#world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }

#edgeLayer { position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: visible; }
#edgeLayer path.hit { stroke: transparent; stroke-width: 18; fill: none; cursor: pointer; }
#edgeLayer path.wire { fill: none; stroke-linecap: round; pointer-events: none; }
#edgeLayer .edge-g.sel path.wire { filter: drop-shadow(0 0 5px rgba(155,142,196,.6)); }
#edgeLayer text.elabel {
  fill: var(--ink); font-family: var(--font-mono); font-size: 15px;
  paint-order: stroke; stroke: var(--bg-1); stroke-width: 5px; stroke-linejoin: round;
  pointer-events: none;
}

#nodeLayer { position: absolute; left: 0; top: 0; }

/* ===== Nodes ============================================================= */
.node {
  position: absolute;
  background: var(--bg-2);
  border: 1px solid color-mix(in srgb, var(--nac, var(--line-2)) 30%, var(--line-2));
  border-radius: var(--r-m);
  box-shadow: var(--shadow-soft);
  color: var(--ink);
  display: flex; flex-direction: column;
  overflow: visible;
  transition: box-shadow var(--t-fast), border-color var(--t-fast), transform .16s ease;
}
/* selezione: anello esterno DEL COLORE DEL NODO (--nac), così l'effetto colore non si perde */
.node.sel {
  outline: 2px solid var(--nac, var(--accent)); outline-offset: 1px;
  box-shadow: 0 0 20px color-mix(in srgb, var(--nac, #9b8ec4) 34%, transparent), var(--shadow-soft);
  z-index: 5;
}
.node.peer-sel { outline: 2px dashed var(--peer-col, #ec7fb0); outline-offset: 3px; }
/* opzioni aspetto: togli bordo / sfondo / titolo · blocca · vista */
.node.no-bg { background: transparent; box-shadow: none; }
.node.no-border { border-color: transparent; box-shadow: none; }
.node.no-border.sel, .node.no-bg.sel { outline: 2px solid var(--nac, var(--accent)); outline-offset: 1px; box-shadow: none; }
.node.no-title > .nhead { display: none; }
.node.locked { cursor: default; }
.node.locked .m3d-stage, .node.locked .bportal, .node.locked .tblbody, .node.locked .kbbody { pointer-events: none; }
.node.locked .nbody { cursor: default; }
/* maniglia di spostamento: centrata in alto, grande, appare SOLO on-hover quando manca il titolo */
.node-grip { position: absolute; top: -11px; left: 50%; transform: translateX(-50%); width: 46px; height: 20px; border-radius: 10px; background: var(--bg-1); border: 1px solid var(--line-2); box-shadow: var(--shadow-soft); opacity: 0; pointer-events: none; cursor: grab; z-index: 8; display: flex; align-items: center; justify-content: center; transition: opacity .12s; }
.node-grip::before { content: "⠿⠿"; letter-spacing: 1px; color: var(--ink-dim); font-size: 13px; line-height: 1; }
.node:hover > .node-grip { opacity: .95; pointer-events: auto; }
.node-grip:hover { border-color: var(--accent); }
/* freccetta espandi/comprimi (in basso, on-hover): le 2 versioni compatta ⇄ estesa */
/* spostata a destra: NON copre più il connettore centrale in basso */
.node-expand { position: absolute; bottom: -9px; right: 26px; width: 30px; height: 17px; border-radius: 9px; background: var(--bg-1); border: 1px solid var(--line-2); color: var(--ink-dim); display: flex; align-items: center; justify-content: center; cursor: pointer; opacity: 0; transition: opacity .12s, color .12s, border-color .12s; z-index: 8; }
.node:hover > .node-expand, .node.expanded > .node-expand { opacity: .95; pointer-events: auto; }
.node-expand:hover { color: var(--accent); border-color: var(--accent); }
.node-expand svg { width: 13px; height: 13px; transition: transform .22s ease; }
.node.expanded > .node-expand svg { transform: rotate(180deg); }
/* animazione di crescita/compressione (classe aggiunta solo durante il toggle) */
.node.anim { transition: width .26s cubic-bezier(.2,.85,.25,1), height .26s cubic-bezier(.2,.85,.25,1), box-shadow var(--t-fast), border-color var(--t-fast), transform .16s ease; }
/* trasporto: lift; le note ESTESE si rannicchiano piccole durante il drag (feeling di movimento) */
.node.dragging { box-shadow: 0 14px 32px rgba(0,0,0,.42), var(--shadow-soft); z-index: 6; }
.node.expanded.dragging { transform: scale(.55); transform-origin: top left; opacity: .92; }
/* nota ESTESA: la mini-pagina Notion (editor a blocchi) montata dentro al nodo */
.node.expanded { z-index: 4; }
/* banner/copertina della nota estesa */
.node .np-banner { position: relative; height: 84px; margin: -1px -1px 4px; border-radius: var(--r-m) var(--r-m) 0 0; background-size: cover; background-position: center; }
.node .np-banner .np-banner-x, .node .np-banner .np-banner-edit, .page-banner .np-banner-x, .page-banner .np-banner-edit { position: absolute; top: 6px; width: 24px; height: 24px; border-radius: 50%; border: none; background: rgba(0,0,0,.5); color: #fff; cursor: pointer; opacity: 0; transition: opacity .12s, background .12s; font-size: 13px; line-height: 1; display: flex; align-items: center; justify-content: center; }
.node .np-banner .np-banner-x, .page-banner .np-banner-x { right: 6px; }
.node .np-banner .np-banner-edit, .page-banner .np-banner-edit { right: 34px; }
.node .np-banner:hover .np-banner-x, .node .np-banner:hover .np-banner-edit, .page-banner:hover .np-banner-x, .page-banner:hover .np-banner-edit { opacity: 1; }
.node .np-banner .np-banner-x:hover, .node .np-banner .np-banner-edit:hover, .page-banner .np-banner-x:hover, .page-banner .np-banner-edit:hover { background: rgba(0,0,0,.72); }
.node .np-banner-add { display: inline-flex; align-items: center; gap: 6px; margin: 4px 8px 0; background: transparent; border: none; color: var(--ink-faint); cursor: pointer; font-size: 12px; opacity: 0; transition: opacity .12s; }
.node.expanded:hover .np-banner-add { opacity: 1; }
.node .np-banner-add:hover { color: var(--ink); }
.page-banner { position: relative; }
.page-banner-add-row { margin-bottom: 10px; }
.page-banner-add-row .np-banner-add { display: inline-flex; align-items: center; gap: 6px; background: var(--bg-1); border: 1px solid var(--line-2); color: var(--ink-faint); cursor: pointer; font-size: 12.5px; padding: 6px 12px; border-radius: 8px; transition: color .12s, border-color .12s; }
.page-banner-add-row .np-banner-add:hover { color: var(--ink); border-color: var(--lav-2); }
.page-banner-add-row .np-banner-add svg { width: 15px; height: 15px; }
/* selettore copertina: sfumature + tinte unite */
.banner-pick { width: 268px; padding: 6px 8px 8px; }
.banner-pick .ctx-title { margin: 6px 4px 5px; }
.bp-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; padding: 0 2px; }
.bp-grid.bp-solids { grid-template-columns: repeat(6, 1fr); }
.bp-cell { height: 30px; border-radius: 7px; border: 1px solid rgba(255,255,255,.08); cursor: pointer; padding: 0; transition: transform .1s, box-shadow .1s; background-size: cover; }
.bp-cell:hover { transform: scale(1.08); box-shadow: 0 0 0 2px var(--accent); }
.banner-pick .ctx-item { margin-top: 2px; }
.node .np-host { padding: 6px 10px 12px; overflow: auto; flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 6px; }
.node .np-props .page-props { margin: 0; }
.node .np-blocks { flex: 1; min-height: 60px; border-top: 1px solid var(--line); padding-top: 8px; }
.node .np-blocks:empty::before { content: "Scrivi qui… premi / per i comandi (titoli, elenchi, immagini, tabelle)"; color: var(--ink-faint); font-size: 12.5px; }
/* sezione Collegamenti (nota estesa in-place + fullscreen) */
.np-conns { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 2px; }
.np-conns-h { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--ink-dim); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 5px; }
.np-conns-ic { display: inline-flex; } .np-conns-ic svg { width: 14px; height: 14px; }
.np-conns-cnt { margin-left: auto; background: var(--bg-3); border-radius: 8px; padding: 0 6px; font-size: 10px; }
.np-conns-empty { font-size: 11.5px; color: var(--ink-faint); }
.np-conn { display: flex; align-items: center; gap: 6px; padding: 4px 5px; border-radius: 6px; cursor: pointer; font-size: 12px; }
.np-conn:hover { background: var(--accent-soft); }
.np-conn-arr { color: var(--lav-2); font-weight: 700; }
.np-conn-arr.in { color: var(--moss-2); }
.np-conn-dot { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.np-conn-name { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.np-conn-lbl { font-size: 10px; color: var(--ink-faint); background: var(--bg-3); border-radius: 6px; padding: 1px 6px; }
/* fullscreen: banner + collegamenti più grandi */
.page-banner { height: 150px; background-size: cover; background-position: center; border-radius: 10px; margin-bottom: 14px; }
.page-conns { margin-top: 16px; } .page-conns .np-conn { font-size: 13px; padding: 5px 6px; }
/* "Collega…" + popover di ricerca con anteprima */
.np-conn-add { margin-left: 8px; background: var(--bg-1); border: 1px solid var(--line-2); color: var(--ink-dim); border-radius: 6px; padding: 2px 8px; cursor: pointer; font-size: 10.5px; text-transform: none; letter-spacing: 0; }
.np-conn-add:hover { color: var(--ink); border-color: var(--lav-2); }
.connect-pop { width: 286px; }
.connect-pop .cp-search { width: calc(100% - 16px); margin: 4px 8px 6px; }
.cp-results { max-height: 260px; overflow: auto; padding: 0 4px 4px; }
.cp-res { display: flex; align-items: center; gap: 8px; padding: 6px 9px; border-radius: 7px; cursor: pointer; }
.cp-res:hover, .cp-res.on { background: var(--accent-soft); }
.mention-pop { width: 260px; }
.mention-pop .cp-res { padding: 5px 8px; }
.mp-create .cp-res-name { color: var(--accent); }
.cp-res-ic { display: inline-flex; color: var(--ink-dim); flex: none; } .cp-res-ic svg { width: 15px; height: 15px; }
.cp-res-txt { min-width: 0; flex: 1; }
.cp-res-name { font-size: 13px; font-weight: 600; color: var(--ink); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cp-res-snip { font-size: 11px; color: var(--ink-faint); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
/* blocchi colorati (customizzazione testo/blocco) */
.pb-row.pb-colored .pb-edit { color: var(--blkc); }
.pb-row.pb-colored.pb-callout, .pb-row.pb-colored.pb-quote { border-left: 3px solid var(--blkc); background: color-mix(in srgb, var(--blkc) 13%, transparent); border-radius: 6px; padding-left: 10px; }
.pb-row.pb-colored.pb-callout .pb-edit, .pb-row.pb-colored.pb-quote .pb-edit { color: var(--ink); }
/* evidenziato inline (==testo==) sul tema scuro */
mark { background: color-mix(in srgb, #f2c84b 36%, transparent); color: var(--ink); border-radius: 3px; padding: 0 2px; }
/* mini-banner sulla nota compatta */
.node .np-mini-banner { height: 38px; background-size: cover; background-position: center; border-radius: var(--r-m) var(--r-m) 0 0; margin: -1px -1px 4px; }
.node.no-border .np-mini-banner, .node.no-bg .np-mini-banner { border-radius: var(--r-m); }
/* densità COMPATTA delle note (impostazione globale, menu ⋯) */
#app.dense .node .nhead { padding: 4px 7px; }
#app.dense .node .nbody { padding: 5px 8px; font-size: 12px; }
#app.dense .node .ntitle, #app.dense .node .nbody.md { font-size: 12px; }
#app.dense .node .np-mini-banner { height: 26px; }
#app.dense .node .ntags { padding: 0 7px 5px; }
/* riga azioni in alto a destra: chat + impostazioni avanzate (ingranaggio) */
.node-actions { position: absolute; top: -11px; right: -8px; display: flex; align-items: center; gap: 5px; z-index: 9; }
.node-act { position: relative; width: 24px; height: 24px; border-radius: 50%; background: var(--bg-1); border: 1px solid var(--line-2); color: var(--ink-dim); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: var(--shadow-soft); transition: color .12s, border-color .12s, background .12s, opacity .12s; }
.node-act.node-chat { opacity: 0; }
.node:hover > .node-actions .node-chat, .node-act.node-chat.has { opacity: 1; }
.node-act.node-chat svg { width: 13px; height: 13px; }
.node-act.node-chat.unread { color: var(--gold); border-color: var(--koi); }
.node-act .nc-count { position: absolute; top: -5px; right: -5px; min-width: 14px; height: 14px; padding: 0 3px; border-radius: 7px; background: var(--koi); color: #0a0c09; font-size: 9px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.node-act:hover { color: var(--lav-2); border-color: var(--accent); background: var(--accent-soft); }
.node-act .bic { display: inline-flex; }
.node-act .bic svg { width: 13px; height: 13px; }
.node-actions .node-chat-ind { position: static; top: auto; right: auto; box-shadow: var(--shadow-soft); }
.node-actions .node-eye { position: static; top: auto; right: auto; width: 22px; height: 22px; }
.node-actions:empty { display: none; }
/* popover Impostazioni avanzate */
.adv-pop { min-width: 252px; max-width: 286px; }
.adv-pop .adv-props .page-props { margin: 0; }
.node-grip:active { cursor: grabbing; }
/* "Sfondo: no" toglie anche la plate scura dietro il modello / il portale (usa l'oggetto come un PNG) */
.node.model.no-bg .m3d-stage, .node.no-bg .m3d-stage { background: transparent; border: 0; }
.node.no-bg .bportal { background: transparent; }
.node-lock svg { width: 12px; height: 12px; }
.node-lock:hover { color: var(--lav-2); border-color: var(--accent); }
/* separatore / linea sul canvas (orizzontale o verticale) */
.node.sep { background: transparent; border: 0; box-shadow: none; overflow: visible; }
.node.sep.sel { box-shadow: 0 0 0 1px var(--accent); border-radius: var(--r-s); }
.node.sep .sep-line { position: absolute; border-radius: 3px; opacity: .8; }
.node.sep .sep-line.horiz { left: 0; right: 0; top: 50%; height: 3px; transform: translateY(-50%); }
.node.sep .sep-line.vert { top: 0; bottom: 0; left: 50%; width: 3px; transform: translateX(-50%); }
.node.sep .sep-label { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); background: var(--bg-0); padding: 1px 8px; font-size: 11px; border-radius: 9px; white-space: nowrap; }
/* occhietto "condiviso" in alto a destra (sostituisce il vecchio badge Vista) */
.node-eye { position: absolute; top: -9px; right: -9px; width: 22px; height: 22px; border-radius: 50%; background: var(--bg-1); border: 1px solid var(--accent); color: var(--lav-2); display: flex; align-items: center; justify-content: center; z-index: 8; cursor: pointer; box-shadow: var(--shadow-soft); }
.node-eye svg { width: 13px; height: 13px; }
.node-eye:hover { color: var(--ink); border-color: var(--accent); background: var(--accent-soft); }
/* sezione "Viste riutilizzabili" nei Progetti */
.views-lib { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.views-lib-head { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-dim); padding: 2px 6px 6px; display: flex; align-items: center; gap: 5px; }
.views-lib-head svg { width: 12px; height: 12px; color: var(--lav-2); }
.view-lib-row { display: flex; align-items: center; gap: 7px; padding: 5px 7px; border-radius: var(--r-s); cursor: pointer; color: var(--ink-soft); }
.view-lib-row:hover { background: var(--accent-soft); color: var(--ink); }
.vlr-ic { display: inline-flex; width: 15px; height: 15px; color: var(--lav-2); flex: none; }
.vlr-ic svg { width: 15px; height: 15px; }
.vlr-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; }
.vlr-type { font-size: 9px; color: var(--ink-faint); text-transform: uppercase; }
.vlr-del { background: transparent; border: none; color: var(--ink-faint); cursor: pointer; font-size: 14px; line-height: 1; padding: 0 2px; opacity: 0; flex: none; }
.view-lib-row:hover .vlr-del { opacity: 1; }
.vlr-del:hover { color: var(--koi); }
.vlr-link { display: inline-flex; align-items: center; gap: 2px; background: var(--accent-soft); border: 1px solid var(--accent); color: var(--lav-2); border-radius: 9px; padding: 1px 6px 1px 4px; font-size: 9px; cursor: pointer; flex: none; }
.vlr-link svg { width: 11px; height: 11px; }
.vlr-link:hover { color: var(--ink); }
.views-lib-head .vlr-ic { display: inline-flex; width: 12px; height: 12px; vertical-align: -2px; }
/* popup "usato in N posti" */
.inst-pop { position: fixed; z-index: 220; min-width: 200px; max-width: 280px; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--r-m); box-shadow: var(--shadow); padding: 6px; animation: pop var(--t-med); }
.inst-head { font-size: 11px; color: var(--ink-dim); padding: 4px 8px 6px; display: flex; align-items: center; gap: 6px; }
.inst-ic { display: inline-flex; width: 14px; height: 14px; flex: none; color: var(--lav-2); }
.inst-ic svg { width: 14px; height: 14px; }
.inst-item { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: var(--r-s); cursor: pointer; color: var(--ink-soft); font-size: 12.5px; }
.inst-item:hover { background: var(--accent-soft); color: var(--ink); }
.inst-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inst-where { font-size: 9px; color: var(--ink-faint); text-transform: uppercase; }
.inst-empty { padding: 8px; font-size: 11.5px; color: var(--ink-faint); font-style: italic; }
.node .nhead {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 8px; cursor: grab;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,0.018), transparent);
  border-radius: var(--r-m) var(--r-m) 0 0;
}
.node .nhead .accent { width: 8px; height: 8px; border-radius: 2px; background: var(--accent); flex: none; }
.node .ntitle {
  flex: 1; font-size: 13px; font-weight: 600; color: var(--ink);
  outline: none; min-width: 10px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.node .ntitle:empty::before { content: "Senza titolo"; color: var(--ink-faint); font-weight: 400; }
/* icona dell'elemento nel titolo: unica fonte (entityIcon) — distingue il tipo a colpo d'occhio */
.node .nhead .nicon { display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px; flex: none; color: var(--ink-faint); opacity: .85; }
.node .nhead .nicon svg { width: 15px; height: 15px; display: block; }
/* nome DEDOTTO dal contenuto (titolo non impostato): si legge come suggerimento, non come nome reale */
.node .ntitle.is-auto { color: var(--ink-faint); font-weight: 500; font-style: italic; }
.node.symbol .sym-label.is-auto { color: var(--ink-faint); font-style: italic; }
.node .ntitle.editing { white-space: normal; overflow: visible; cursor: text; background: var(--bg-0); box-shadow: inset 0 0 0 1px var(--accent); border-radius: 4px; padding: 1px 4px; color: var(--ink); }
.node .nbody {
  padding: 8px 10px; font-size: 13px; line-height: 1.55; color: var(--ink-soft);
  overflow: auto; flex: 1; outline: none;
}
.node .nbody.editing { cursor: text; background: var(--bg-0); box-shadow: inset 0 0 0 1px var(--accent); border-radius: 6px; color: var(--ink); outline: none; }
.node .nbody.editing:focus { box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 3px var(--accent-soft); }
.node .nbody:empty::before { content: "Doppio-click per scrivere…"; color: var(--ink-faint); font-style: italic; }

/* markdown render */
.md h1, .md h2, .md h3 { color: var(--ink); margin: 6px 0 4px; line-height: 1.25; }
.md h1 { font-size: 17px; } .md h2 { font-size: 15px; } .md h3 { font-size: 14px; }
.md p { margin: 5px 0; }
.md a { color: var(--lav-2); text-decoration: none; border-bottom: 1px dotted var(--lav); }
.md code { background: var(--bg-0); padding: 1px 5px; border-radius: 4px; font-family: var(--font-mono); font-size: 14px; color: var(--moss-2); }
/* [[mention]] — riferimento ad un altro elemento (stile Obsidian) */
.md-ref { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); border-radius: 4px; padding: 0 4px; cursor: pointer; font-weight: 600; box-decoration-break: clone; -webkit-box-decoration-break: clone; transition: background .12s; }
.md-ref::before { content: "🔗"; font-size: .82em; margin-right: 3px; opacity: .8; }
.md-ref:hover { background: color-mix(in srgb, var(--accent) 26%, transparent); text-decoration: underline; }
.md ul, .md ol { margin: 5px 0; padding-left: 20px; }
.md li { margin: 2px 0; }
.md .chk { list-style: none; margin-left: -16px; }
.md .chk input { margin-right: 6px; accent-color: var(--moss); cursor: pointer; }
.md li.chk.done { color: var(--ink-faint); text-decoration: line-through; text-decoration-color: var(--ink-faint); }
.md ul ul, .md ol ol, .md ul ol, .md ol ul { margin: 2px 0; padding-left: 18px; }
.md-due { font-size: .82em; font-family: var(--font-mono); color: var(--moss-2); background: rgba(127,154,111,.12); border: 1px solid rgba(127,154,111,.25); padding: 0 6px; border-radius: 10px; white-space: nowrap; }
.md-due.over { color: var(--koi); background: rgba(207,127,58,.12); border-color: rgba(207,127,58,.3); }

/* barra di formattazione (editor note/documenti) */
.md-bar { display: flex; flex-wrap: wrap; gap: 2px; align-items: center; padding: 5px; background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--r-s); margin-bottom: 6px; }
.md-btn { background: transparent; border: 1px solid transparent; color: var(--ink-soft); cursor: pointer; font-size: 14px; font-weight: 600; padding: 6px 8px; border-radius: 5px; min-width: 32px; height: 32px; line-height: 1; font-family: var(--font-ui); }
.md-btn:hover { background: var(--bg-3); color: var(--ink); border-color: var(--line-2); }
.md-btn b, .md-btn i { font-size: 16px; }
/* icone della barra (al posto delle etichette-parola) */
.md-btn svg { width: 20px; height: 20px; display: block; }
.md-btn { display: inline-flex; align-items: center; justify-content: center; }
.md-btn.md-plus { color: var(--lav-2); }
.md-btn.md-plus:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--ink); }
.md-bar-sep { width: 1px; height: 16px; background: var(--line-2); margin: 0 3px; }
/* menu "+" : crea elemento */
.fmt-ins-menu { position: fixed; z-index: 300; min-width: 184px; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--r-m); box-shadow: var(--shadow); padding: 5px; animation: pop var(--t-fast); }
.fmt-ins-menu .fim-title { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); padding: 4px 8px 6px; }
.fmt-ins-menu .fim-item { display: flex; align-items: center; gap: 9px; width: 100%; background: transparent; border: none; color: var(--ink); border-radius: var(--r-s); padding: 7px 9px; cursor: pointer; font-size: 12.5px; text-align: left; }
.fmt-ins-menu .fim-item:hover { background: var(--bg-3); }
.fmt-ins-menu .fim-item svg { width: 16px; height: 16px; flex: none; color: var(--lav-2); }
.md-bar.md-float { position: fixed; z-index: 90; margin: 0; flex-wrap: nowrap; padding: 4px 5px; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--r-m); box-shadow: 0 10px 30px rgba(0,0,0,.5); backdrop-filter: blur(6px); animation: pop var(--t-fast); max-width: 96vw; overflow-x: auto; }
.md-bar.md-float .md-btn { font-size: 14px; padding: 6px 8px; }
.doc-body.note { position: relative; }
.doc-panel .md-bar { margin: 0 14px; }
.md blockquote { border-left: 2px solid var(--moss); margin: 6px 0; padding-left: 10px; color: var(--ink-dim); }
.md hr { border: none; border-top: 1px solid var(--line-2); margin: 8px 0; }
.md strong { color: var(--ink); } .md em { color: var(--lav-2); }

/* node footer: tags */
.node .ntags { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 8px 7px; }
.node .ntag {
  font-size: 11.5px; font-weight: 600; letter-spacing: .2px;
  color: var(--moss-2); border: 1px solid transparent;
  padding: 2px 9px; border-radius: 20px;
}
#app.hide-tags .ntags { display: none; }
.node.frame .ntags { padding: 4px 10px; }

/* anteprima fantasma di posizionamento */
#placeGhost {
  position: absolute; z-index: 9; pointer-events: none;
  border: 1.5px dashed var(--accent); border-radius: var(--r-m);
  background: var(--accent-soft);
  display: flex; align-items: center; justify-content: center;
  animation: ghostPulse 1.3s ease-in-out infinite;
}
#placeGhost .pg-label { font-size: 12px; color: var(--lav-2); font-weight: 600; letter-spacing: .5px; }
@keyframes ghostPulse { 0%,100% { opacity: .5; } 50% { opacity: .85; } }
.node.dim { opacity: .28; filter: grayscale(.5); }

/* image node */
.node.image { padding: 0; overflow: hidden; }
.node.image .nbody { padding: 0; display: flex; align-items: center; justify-content: center; background: var(--bg-0); }
.node.image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.node.image .img-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  color: var(--ink-faint); font-size: 12px; padding: 16px; text-align: center; height: 100%;
}

/* link node */
.node.link .nbody { display: flex; flex-direction: column; gap: 4px; }
.node.link .lk-host { font-family: var(--font-mono); font-size: 14px; color: var(--water); }
.node.link a.lk-url { color: var(--lav-2); font-size: 12px; word-break: break-all; text-decoration: none; }
.node.link .lk-fav { font-size: 22px; }

/* symbol node */
.node.symbol {
  background: transparent; border-color: transparent; box-shadow: none;
  align-items: center; justify-content: center;
}
.node.symbol .nhead { display: none; }
.node.symbol.sel { background: var(--accent-soft); border-color: var(--accent); }
.node.symbol .sym-wrap { display: flex; align-items: center; justify-content: center; flex: 1; padding: 6px; }
.node.symbol .sym-wrap svg { width: 100%; height: 100%; filter: drop-shadow(0 3px 6px rgba(0,0,0,.4)); }
.node.symbol .sym-wrap svg.px-sprite { image-rendering: pixelated; }
.node.symbol .sym-label {
  font-family: var(--font-mono); font-size: 15px; color: var(--ink-soft); text-align: center;
  padding-bottom: 4px; letter-spacing: 1px;
}

/* frame node */
.node.frame {
  background: rgba(127,154,111,0.035);
  border: 1px dashed var(--line-2);
  border-radius: var(--r-l);
  box-shadow: none;
}
.node.frame .nhead { background: transparent; border: none; cursor: grab; }
.node.frame .ntitle { font-family: var(--font-pixel); font-size: 9px; letter-spacing: 1px; color: var(--moss-2); text-transform: uppercase; }
.node.frame .nbody { display: none; }
.node.frame.sel { border-color: var(--accent); border-style: solid; }
/* la cornice non blocca i nodi al suo interno: clic attivi solo su header/maniglie */
.node.frame { pointer-events: none; }
.node.frame .nhead, .node.frame .conn, .node.frame .resize { pointer-events: auto; }
/* container "Colonne" sul canvas (bande verticali stile Notion) */
.node.cols { background: rgba(155,142,196,0.05); border: 1px solid var(--line-2); border-radius: var(--r-l); box-shadow: none; pointer-events: none; display: flex; flex-direction: column; overflow: hidden; }
.node.cols .nhead { background: transparent; border: none; cursor: grab; pointer-events: auto; }
.node.cols .ntitle { font-family: var(--font-pixel); font-size: 9px; letter-spacing: 1px; color: var(--lav-2); text-transform: uppercase; }
.node.cols.sel { border-color: var(--accent); }
.node.cols .conn, .node.cols .resize, .node.cols .node-grip { pointer-events: auto; }
.cols-bands { flex: 1; display: flex; align-items: stretch; min-height: 0; }
.cols-band { flex: 1; min-width: 0; position: relative; display: flex; justify-content: center; }
.cols-band-label { pointer-events: auto; cursor: text; margin-top: 6px; align-self: flex-start; height: fit-content; font-size: 11px; font-weight: 700; color: var(--lav-2); background: color-mix(in srgb, var(--accent) 16%, transparent); padding: 2px 10px; border-radius: 9px; max-width: 88%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cols-band-label:empty::before { content: "+ etichetta"; color: var(--ink-faint); font-weight: 500; }
.cols-div { flex: 0 0 12px; position: relative; pointer-events: auto; cursor: col-resize; touch-action: none; }
.cols-div::after { content: ""; position: absolute; left: 50%; top: 4px; bottom: 4px; width: 1px; background: var(--line-2); transform: translateX(-50%); transition: background .15s, width .15s; }
.cols-div:hover::after { background: var(--accent); width: 2px; }

/* connectors + resize */
.node .conn {
  position: absolute; width: 11px; height: 11px; border-radius: 50%;
  background: var(--bg-1); border: 2px solid var(--accent);
  opacity: 0; transition: opacity var(--t-fast), transform var(--t-fast);
  cursor: crosshair; z-index: 8; transform: scale(.6);
}
.node:hover .conn, .node.sel .conn { opacity: 1; transform: scale(1); }
.node .conn:hover { background: var(--accent); transform: scale(1.35); }
.node .conn.t { top: -7px; left: 50%; margin-left: -6px; }
.node .conn.b { bottom: -7px; left: 50%; margin-left: -6px; }
.node .conn.l { left: -7px; top: 50%; margin-top: -6px; }
.node .conn.r { right: -7px; top: 50%; margin-top: -6px; }

.node .resize {
  position: absolute; right: -3px; bottom: -3px; width: 14px; height: 14px;
  cursor: nwse-resize; opacity: 0; z-index: 8;
}
.node .resize::after {
  content: ""; position: absolute; right: 3px; bottom: 3px; width: 7px; height: 7px;
  border-right: 2px solid var(--accent); border-bottom: 2px solid var(--accent); border-radius: 0 0 2px 0;
}
.node:hover .resize, .node.sel .resize { opacity: .85; }

/* marquee */
#marquee {
  position: absolute; border: 1px solid var(--accent);
  background: var(--accent-soft); border-radius: 3px; z-index: 9; pointer-events: none;
}

/* ===== Inspector ========================================================= */
#inspector {
  grid-area: inspect;
  background: var(--bg-2);
  border-left: 1px solid var(--line);
  overflow: hidden auto; z-index: 20;
}
#app.no-inspect #inspector { pointer-events: none; } /* clip via griglia → animazione di collasso */
/* ---- Ispettore FLOTTANTE a richiesta: non divide più il canvas ---- */
#app.insp-float { grid-template-columns: var(--toolbar-w) var(--sidebar-w) 1fr 0; }
#app.insp-float.no-side { grid-template-columns: var(--toolbar-w) 0 1fr 0; }
#app.insp-float #inspector {
  position: fixed; top: calc(var(--topbar-h) + 10px); right: 12px; bottom: 12px;
  width: var(--inspector-w); max-width: calc(100vw - 32px);
  border: 1px solid var(--line-2); border-left: 1px solid var(--line-2);
  border-radius: 14px; box-shadow: var(--shadow); z-index: 185; overflow: hidden auto;
  transform: translateX(calc(100% + 22px)); opacity: 0; pointer-events: none;
  transition: transform .24s ease, opacity .2s ease;
}
#app.insp-float.insp-open #inspector { transform: none; opacity: 1; pointer-events: auto; }
#inspClose {
  position: fixed; top: calc(var(--topbar-h) + 18px); right: 22px; z-index: 186;
  width: 26px; height: 26px; padding: 0; border-radius: 8px; display: none;
  align-items: center; justify-content: center; cursor: pointer;
  background: var(--bg-1); border: 1px solid var(--line-2); color: var(--ink-dim);
}
#inspClose svg { width: 15px; height: 15px; }
#inspClose:hover { color: var(--ink); border-color: var(--lav-2); }
#app.insp-float.insp-open #inspClose { display: inline-flex; }
.insp-section { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.insp-title {
  font-family: var(--font-pixel); font-size: 8px; letter-spacing: 1.5px;
  color: var(--ink-dim); text-transform: uppercase; margin-bottom: 12px;
}
.insp-empty {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  padding: 40px 18px; text-align: center; color: var(--ink-faint);
}
.insp-empty .enso { width: 64px; height: 64px; opacity: .5; }
.insp-empty p { font-size: 13px; line-height: 1.6; font-style: italic; }

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 11px; color: var(--ink-dim); margin-bottom: 5px; letter-spacing: .5px; }
.field input[type="text"], .field input[type="url"], .field textarea, .field select {
  width: 100%; background: var(--bg-0); border: 1px solid var(--line);
  color: var(--ink); border-radius: var(--r-s); padding: 7px 9px; font-size: 13px; outline: none;
  font-family: var(--font-ui); resize: vertical;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--line-2); }
.field textarea { min-height: 70px; line-height: 1.5; }
/* editor DECORATO (WYSIWYG) dell'inspector: rende la formattazione, niente markdown a vista */
.isp-ce { width: 100%; min-height: 72px; background: var(--bg-0); border: 1px solid var(--line); color: var(--ink); border-radius: var(--r-s); padding: 8px 10px; font-size: 13px; line-height: 1.55; outline: none; font-family: var(--font-ui); overflow-wrap: anywhere; }
.isp-ce:focus { border-color: var(--accent); }
.isp-ce:empty::before { content: attr(data-ph); color: var(--ink-faint); pointer-events: none; }
.isp-ce > :first-child { margin-top: 0; }
.isp-ce > :last-child { margin-bottom: 0; }
.isp-ce h1, .isp-ce h2, .isp-ce h3 { margin: .5em 0 .25em; line-height: 1.2; }
.isp-ce ul, .isp-ce ol { margin: .25em 0; padding-left: 1.3em; }
.isp-ce blockquote { margin: .3em 0; padding-left: .7em; border-left: 2px solid var(--line-2); color: var(--ink-soft); }
.isp-ce hr { border: none; border-top: 1px solid var(--line-2); margin: .6em 0; }

.swatches { display: flex; flex-wrap: wrap; gap: 7px; }
.swatch {
  width: 24px; height: 24px; border-radius: 50%; cursor: pointer;
  border: 2px solid transparent; transition: var(--t-fast);
}
.swatch:hover { transform: scale(1.12); }
.swatch.on { border-color: var(--ink); box-shadow: 0 0 0 2px var(--bg-2), 0 0 0 3px currentColor; }

.sym-picker { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.sym-cell {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  background: var(--bg-0); border: 1px solid var(--line); border-radius: var(--r-s);
  cursor: pointer; padding: 6px; transition: var(--t-fast);
}
.sym-cell:hover { border-color: var(--line-2); background: var(--bg-3); }
.sym-cell.on { border-color: var(--accent); background: var(--accent-soft); }
.sym-cell svg { width: 100%; height: 100%; }
.sym-cell svg.px-sprite { image-rendering: pixelated; }

.insp-btn {
  width: 100%; padding: 8px; border-radius: var(--r-m); cursor: pointer; font-size: 13px;
  background: var(--bg-3); border: 1px solid var(--line); color: var(--ink-soft);
  transition: var(--t-fast); margin-top: 4px; display: flex; align-items: center; justify-content: center; gap: 7px;
}
.insp-btn:hover { background: var(--bg-4); color: var(--ink); }
.insp-btn.danger:hover { background: rgba(207,127,58,.14); color: var(--koi); border-color: rgba(207,127,58,.3); }
.insp-btn svg { width: 15px; height: 15px; flex: none; }
/* toggle Aspetto compatti a icone */
.ins-itog-row { display: flex; gap: 6px; margin: 6px 0 2px; }
.ins-itog { flex: 1; height: 34px; display: flex; align-items: center; justify-content: center; background: var(--bg-0); border: 1px solid var(--line); border-radius: var(--r-m); color: var(--ink-dim); cursor: pointer; transition: var(--t-fast); }
.ins-itog:hover { color: var(--ink); border-color: var(--line-2); }
.ins-itog.on { background: var(--accent-soft); border-color: var(--accent); color: var(--ink); }
.ins-itog .ins-itog-ic { display: flex; }
.ins-itog svg { width: 17px; height: 17px; }
/* griglia azioni modello 3D */
.insp-icogrid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 4px 0 8px; }
.insp-icobtn { display: flex; align-items: center; gap: 7px; padding: 8px 9px; background: var(--bg-3); border: 1px solid var(--line); border-radius: var(--r-m); color: var(--ink-soft); cursor: pointer; font-size: 12px; transition: var(--t-fast); text-align: left; }
.insp-icobtn:hover { background: var(--bg-4); color: var(--ink); }
.insp-icobtn svg { width: 15px; height: 15px; flex: none; }
.insp-icobtn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.insp-link-ic { display: inline-flex; vertical-align: -2px; } .insp-link-ic svg { width: 14px; height: 14px; }

.insp-meta { font-family: var(--font-mono); font-size: 14px; color: var(--ink-faint); line-height: 1.5; }
.hint-ok { font-size: 10.5px; color: var(--moss-2); font-weight: 600; }
.hint-warn { font-size: 10.5px; color: var(--koi); font-weight: 600; }
.hint-box { font-size: 11.5px; color: var(--koi); background: rgba(207,127,58,.1); border: 1px solid rgba(207,127,58,.25); border-radius: var(--r-s); padding: 8px 10px; line-height: 1.45; margin-top: 4px; }
.stor-bar { height: 7px; background: var(--bg-0); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; margin: 4px 0 5px; }
.stor-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--moss), var(--accent)); transition: width .3s; }
.stor-bar.warn i { background: linear-gradient(90deg, var(--gold), var(--koi)); }
.seg { display: flex; gap: 4px; background: var(--bg-0); padding: 3px; border-radius: var(--r-m); border: 1px solid var(--line); }
.seg button {
  flex: 1; padding: 6px; border-radius: var(--r-s); border: none; background: transparent;
  color: var(--ink-dim); cursor: pointer; font-size: 12px; transition: var(--t-fast);
}
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--bg-3); color: var(--lav-2); }
.seg.seg-sm button { padding: 4px 5px; font-size: 11px; }

/* ===== Command palette =================================================== */
#palette {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 14vh; background: rgba(5,7,5,0.55); backdrop-filter: blur(3px);
}
.palette-box {
  width: min(560px, 92vw); background: var(--bg-2);
  border: 1px solid var(--line-2); border-radius: var(--r-l);
  box-shadow: var(--shadow); overflow: hidden;
  animation: pop var(--t-med);
}
@keyframes pop { from { opacity: 0; transform: translateY(-8px) scale(.98); } to { opacity: 1; transform: none; } }
.palette-box input {
  width: 100%; background: transparent; border: none; border-bottom: 1px solid var(--line);
  color: var(--ink); padding: 16px 18px; font-size: 16px; outline: none; font-family: var(--font-ui);
}
.palette-box input::placeholder { color: var(--ink-faint); }
.palette-list { max-height: 46vh; overflow: auto; padding: 6px; }
.palette-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border-radius: var(--r-m); cursor: pointer; color: var(--ink-soft);
}
.palette-item.active { background: var(--accent-soft); color: var(--ink); }
.palette-item .pi-icon { width: 18px; height: 18px; color: var(--ink-dim); display: flex; flex: none; }
.palette-item .pi-icon svg { width: 16px; height: 16px; }
.palette-item.active .pi-icon { color: var(--lav-2); }
.palette-item .pi-label { flex: 1; font-size: 14px; }
.palette-item .pi-kbd { font-family: var(--font-mono); font-size: 14px; color: var(--ink-faint); }

/* ===== Toast ============================================================= */
#toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--bg-3); border: 1px solid var(--line-2); color: var(--ink);
  padding: 9px 16px; border-radius: 22px; font-size: 13px; z-index: 120;
  box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: var(--t-med);
  display: flex; align-items: center; gap: 8px;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--moss); }

/* ===== Mini-map ========================================================= */
#minimap {
  position: absolute; right: 14px; bottom: 14px; z-index: 8;
  width: 170px; height: 116px; background: rgba(10,12,9,.7);
  border: 1px solid var(--line); border-radius: var(--r-m); overflow: hidden;
  box-shadow: var(--shadow-soft); backdrop-filter: blur(2px);
}
#minimap canvas { width: 100%; height: 100%; display: block; }

/* context hint bottom-left */
#hint {
  position: absolute; left: 14px; bottom: 14px; z-index: 8;
  font-family: var(--font-mono); font-size: 14px; color: var(--ink-faint);
  background: rgba(10,12,9,.55); border: 1px solid var(--line); border-radius: 20px;
  padding: 4px 12px; pointer-events: none; letter-spacing: .5px;
}

/* welcome onboarding card */
.welcome {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
  width: min(420px, 80vw); text-align: center; color: var(--ink-soft);
  z-index: 3; pointer-events: none;
}
.welcome .w-enso { width: 92px; height: 92px; margin: 0 auto 18px; opacity: .85; }
.welcome h2 { font-family: var(--font-pixel); font-size: 13px; color: var(--lav-2); letter-spacing: 2px; margin: 0 0 12px; }
.welcome p { font-size: 13.5px; line-height: 1.7; color: var(--ink-dim); }
.welcome .w-keys { margin-top: 16px; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.welcome kbd {
  font-family: var(--font-mono); font-size: 14px; background: var(--bg-3);
  border: 1px solid var(--line-2); border-radius: 4px; padding: 1px 7px; color: var(--ink-soft);
}

/* ===== Transizione morbida al cambio tema =============================== */
#topbar, #toolbar, #sidebar, #inspector, #stage, .node, .tb-btn, .tool, .board-item,
.tag-chip, .insp-btn, .field input, .field textarea, .field select, .side-search {
  transition: background-color var(--t-med), border-color var(--t-med), color var(--t-med);
}

/* ===== Tema chiaro (Sumi-e · Carta) ==================================== */
body.light #minimap { background: rgba(60,56,44,.55); }
body.light #hint { background: rgba(240,236,224,.65); border-color: var(--line-2); }
body.light .vignette { box-shadow: inset 0 0 150px 26px rgba(120,108,84,0.28); }
body.light .brand .kanji { text-shadow: 0 0 10px rgba(122,95,192,.35); }
body.light ::-webkit-scrollbar-thumb { background: #c2b89e; }
body.light ::-webkit-scrollbar-thumb:hover { background: #aa9f82; }
body.light .node { box-shadow: 0 4px 14px rgba(90,78,52,0.16); }
body.light .md code { color: #3f6b38; }
body.light #edgeLayer text.elabel { stroke: var(--bg-1); }

/* ===== Widget (orologio, avanzamento, statistiche) ===================== */
.node.widget .nbody.wbody { display: flex; align-items: center; justify-content: center; padding: 10px 12px; overflow: hidden; }
.w-clock { text-align: center; }
.w-time { font-family: var(--font-mono); font-size: 40px; line-height: 1; color: var(--ink); letter-spacing: 3px; }
.w-date { font-size: 12px; color: var(--ink-dim); margin-top: 6px; text-transform: capitalize; }
.w-prog { width: 100%; }
.w-prog-num { font-family: var(--font-mono); font-size: 32px; color: var(--ink); text-align: center; line-height: 1; }
.w-prog-num span { color: var(--ink-faint); font-size: 18px; }
.w-prog-bar { height: 8px; background: var(--bg-0); border-radius: 6px; overflow: hidden; margin: 9px 0 6px; border: 1px solid var(--line); }
.w-prog-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--moss), var(--accent)); transition: width .4s; }
.w-prog-lbl { font-size: 11px; color: var(--ink-dim); text-align: center; }
.w-stats { display: flex; flex-wrap: wrap; gap: 10px 16px; justify-content: center; width: 100%; }
.w-stats > div { display: flex; flex-direction: column; align-items: center; min-width: 40px; }
.w-stats b { font-family: var(--font-mono); font-size: 21px; color: var(--ink); line-height: 1; }
.w-stats span { font-size: 10px; color: var(--ink-dim); letter-spacing: .5px; margin-top: 2px; }

/* ===== Modalità pulita (focus) ========================================= */
#app.focus { grid-template-columns: 0 0 1fr 0; grid-template-rows: 0 1fr; }
#app.focus #topbar, #app.focus #toolbar, #app.focus #sidebar, #app.focus #inspector { display: none; }
#focusExit {
  position: absolute; top: 12px; right: 14px; z-index: 40;
  display: none; align-items: center; gap: 7px;
  background: var(--bg-3); border: 1px solid var(--line-2); color: var(--ink-soft);
  padding: 6px 12px; border-radius: 20px; cursor: pointer; font-size: 12.5px;
  box-shadow: var(--shadow-soft); transition: var(--t-fast); font-family: var(--font-ui);
}
#focusExit svg { width: 14px; height: 14px; }
#focusExit:hover { background: var(--bg-4); color: var(--ink); }
#app.focus #focusExit { display: inline-flex; }

/* ===== Layer decorazioni (cerchi zen, pietre) ========================== */
#decor { position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: visible; pointer-events: none; opacity: .5; }

/* ===== Widget media (radio / youtube / twitch) ========================= */
.node.widget .nbody.wbody.media { padding: 0; }
.wmedia { width: 100%; height: 100%; display: flex; flex-direction: column; }
.wmedia iframe { width: 100%; height: 100%; border: 0; display: block; flex: 1; background: #000; }
.wmedia.wradio {
  align-items: center; justify-content: center; gap: 10px; padding: 12px;
  background: radial-gradient(120% 120% at 50% 0%, var(--accent-soft), transparent 70%);
}
.wradio-name { font-family: var(--font-mono); font-size: 16px; color: var(--ink); text-align: center; letter-spacing: .5px; }
.wradio audio { width: 100%; height: 34px; filter: saturate(.7) brightness(1.02); }
.whint { display: flex; align-items: center; justify-content: center; text-align: center; padding: 14px;
  color: var(--ink-faint); font-size: 12px; font-style: italic; height: 100%; }
.yt-poster { width: 100%; height: 100%; background-size: cover; background-position: center; cursor: pointer; display: flex; align-items: center; justify-content: center; position: relative; }
.yt-poster::after { content: ""; position: absolute; inset: 0; background: rgba(0,0,0,.28); transition: background .15s; }
.yt-poster:hover::after { background: rgba(0,0,0,.1); }
.yt-play { position: relative; z-index: 1; width: 50px; height: 50px; border-radius: 50%; background: rgba(220,40,40,.92); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 20px; padding-left: 3px; box-shadow: 0 4px 16px rgba(0,0,0,.45); transition: transform .15s; }
.yt-poster:hover .yt-play { transform: scale(1.12); }
.wbadge { display: flex; align-items: center; justify-content: center; gap: 8px; height: 100%;
  font-family: var(--font-mono); font-size: 15px; color: var(--ink-soft); }
.wbadge .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }

/* ===== Kanban (sul canvas) ============================================ */
.node.kanban .nbody.kbbody { padding: 6px; overflow: hidden; }
.kb-cols { display: flex; gap: 8px; height: 100%; overflow-x: auto; overflow-y: hidden; align-items: stretch; }
.kb-col {
  flex: 0 0 150px; width: 150px; background: var(--bg-1); border: 1px solid var(--line);
  border-radius: var(--r-m); display: flex; flex-direction: column; min-height: 0;
  transition: box-shadow var(--t-fast), border-color var(--t-fast);
}
.kb-col.kb-over { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 0 18px rgba(155,142,196,.18); }
.kb-col-head { display: flex; align-items: center; gap: 6px; padding: 7px 8px; border-bottom: 1px solid var(--line); font-size: 12px; font-weight: 600; color: var(--ink); }
.kb-col-dot { width: 8px; height: 8px; border-radius: 2px; background: var(--cc); flex: none; }
.kb-col-name { flex: 1; outline: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb-col-name.editing { white-space: normal; cursor: text; overflow: visible; }
.kb-col-cnt { font-family: var(--font-mono); font-size: 13px; color: var(--ink-faint); }
.kb-col-del { color: var(--ink-faint); cursor: pointer; opacity: 0; font-size: 15px; line-height: 1; transition: var(--t-fast); }
.kb-col:hover .kb-col-del { opacity: .5; }
.kb-col-del:hover { color: var(--koi); opacity: 1; }
.kb-cards { padding: 6px; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; flex: 1; min-height: 0; }
.kb-card {
  position: relative; background: var(--bg-3); border: 1px solid var(--line-2);
  border-left: 3px solid var(--cardc); border-radius: 5px; padding: 7px 9px;
  font-size: 12px; color: var(--ink); cursor: grab; line-height: 1.4;
}
.kb-card:hover { border-color: var(--accent); }
.kb-card.kb-dragging { opacity: .45; }
/* note-card: la nota-Entità mostrata come card nel Kanban */
.kb-card.kb-note { padding: 8px 10px; transition: border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast); }
.kb-card.kb-note:hover { box-shadow: 0 4px 14px rgba(0,0,0,.28); transform: translateY(-1px); }
.kb-note-head { display: flex; align-items: center; gap: 5px; }
.kb-note-name { flex: 1; font-weight: 600; font-size: 12.5px; color: var(--ink); outline: none; min-width: 8px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.kb-note-name:empty::before { content: "Senza titolo"; color: var(--ink-faint); font-weight: 400; }
.kb-note-name.editing { white-space: normal; cursor: text; background: var(--bg-0); box-shadow: inset 0 0 0 1px var(--accent); border-radius: 4px; padding: 0 3px; }
.kb-note-gear, .kb-note-del { flex: none; cursor: pointer; color: var(--ink-faint); opacity: 0; transition: var(--t-fast); display: inline-flex; align-items: center; }
.kb-note-gear svg { width: 13px; height: 13px; }
.kb-note-del { font-size: 15px; line-height: 1; }
.kb-card.kb-note:hover .kb-note-gear, .kb-card.kb-note:hover .kb-note-del { opacity: .65; }
.kb-note-gear:hover { color: var(--lav-2); opacity: 1; }
.kb-note-del:hover { color: var(--koi); opacity: 1; }
.kb-note-body { font-size: 11px; color: var(--ink-soft); margin-top: 4px; line-height: 1.4; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.kb-note-pills { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 6px; align-items: center; }
.kb-card-txt { outline: none; display: block; min-height: 15px; word-break: break-word; }
.kb-card-txt:empty::before { content: "…"; color: var(--ink-faint); }
.kb-card-txt.editing { cursor: text; }
.kb-card-del { position: absolute; top: 3px; right: 5px; color: var(--ink-faint); cursor: pointer; opacity: 0; font-size: 14px; line-height: 1; transition: var(--t-fast); }
.kb-card:hover .kb-card-del { opacity: .55; }
.kb-card-del:hover { color: var(--koi); opacity: 1; }
.kb-add { padding: 6px; text-align: center; font-size: 12px; color: var(--ink-faint); cursor: pointer; border-radius: 5px; transition: var(--t-fast); }
.kb-add:hover { background: var(--bg-2); color: var(--ink); }
.kb-addcol {
  flex: 0 0 32px; align-self: stretch; display: flex; align-items: center; justify-content: center;
  font-size: 22px; color: var(--ink-faint); cursor: pointer; border: 1px dashed var(--line-2); border-radius: var(--r-m); transition: var(--t-fast);
}
.kb-addcol:hover { color: var(--lav-2); border-color: var(--accent); }

/* carte: scadenza + persona + clone trascinato */
.kb-card-meta { display: flex; align-items: center; gap: 5px; margin-top: 6px; flex-wrap: wrap; }
.kb-ava { width: 18px; height: 18px; border-radius: 50%; background: var(--ac); color: #0a0c09; font-size: 9px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex: none; }
.kb-due { font-size: 10.5px; font-family: var(--font-mono); color: var(--ink-dim); background: var(--bg-1); border: 1px solid var(--line); padding: 1px 6px; border-radius: 10px; }
.kb-due.over { color: var(--koi); border-color: rgba(207,127,58,.4); background: rgba(207,127,58,.12); }
.kb-clone { box-shadow: 0 12px 30px rgba(0,0,0,.5); transform: rotate(2.5deg) scale(1.04); opacity: .97; border-radius: 5px; background: var(--bg-3); border: 1px solid var(--accent); border-left: 3px solid var(--cardc); padding: 7px 18px 7px 9px; font-size: 12px; color: var(--ink); }
.kb-clone .kb-card-del { display: none; }

/* popover di modifica carta */
.card-pop {
  position: fixed; z-index: 200; width: 222px; background: var(--bg-2);
  border: 1px solid var(--line-2); border-radius: var(--r-l); box-shadow: var(--shadow);
  padding: 12px; display: flex; flex-direction: column; gap: 2px; animation: pop var(--t-med);
}
.cp-text { width: 100%; min-height: 54px; resize: vertical; background: var(--bg-0); border: 1px solid var(--line); color: var(--ink); border-radius: var(--r-s); padding: 7px; font-size: 13px; outline: none; font-family: var(--font-ui); }
.cp-lbl { font-size: 11px; color: var(--ink-dim); margin-top: 8px; }
.card-pop input { width: 100%; background: var(--bg-0); border: 1px solid var(--line); color: var(--ink); border-radius: var(--r-s); padding: 6px 8px; font-size: 13px; outline: none; }
.card-pop input:focus, .cp-text:focus { border-color: var(--line-2); }
.cp-colors { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 3px; }
.cp-sw { width: 22px; height: 22px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; transition: var(--t-fast); }
.cp-sw:hover { transform: scale(1.12); }
.cp-sw.on { border-color: var(--ink); box-shadow: 0 0 0 2px var(--bg-2), 0 0 0 3px currentColor; }
.cp-del { margin-top: 10px; padding: 7px; border-radius: var(--r-m); border: 1px solid var(--line); background: var(--bg-3); color: var(--ink-soft); cursor: pointer; font-size: 12.5px; }
.cp-del:hover { background: rgba(207,127,58,.14); color: var(--koi); border-color: rgba(207,127,58,.3); }
/* card kanban = task completo (stato, etichette, fascia date, checklist, remind, assegnatari) */
.kb-card-top { display: flex; align-items: flex-start; gap: 6px; }
.kb-st { width: 8px; height: 8px; border-radius: 50%; flex: none; margin-top: 4px; }
.kb-card-top .kb-card-del { position: static; opacity: 0; margin-left: auto; flex: none; }
.kb-card:hover .kb-card-top .kb-card-del { opacity: .55; }
.kb-label { font-size: 9.5px; background: var(--accent-soft); color: var(--lav-2); border-radius: 8px; padding: 1px 6px; }
.kb-chk { font-size: 10px; color: var(--ink-dim); font-family: var(--font-mono); }
.kb-chk.all { color: var(--moss); }
.kb-rem { font-size: 11px; }
.kb-hrs { font-size: 10px; color: var(--ink-faint); font-family: var(--font-mono); }
.kb-card-meta .pm-ava { width: 17px; height: 17px; font-size: 8.5px; }
/* editor card esteso */
.card-pop { max-height: 84vh; overflow-y: auto; }
.cp-title { font-weight: 600; }
.cp-desc { width: 100%; min-height: 46px; resize: vertical; background: var(--bg-0); border: 1px solid var(--line); color: var(--ink); border-radius: var(--r-s); padding: 7px; font-size: 12.5px; outline: none; font-family: var(--font-ui); margin-top: 4px; }
.card-pop select { width: 100%; background: var(--bg-0); border: 1px solid var(--line); color: var(--ink); border-radius: var(--r-s); padding: 6px 8px; font-size: 12.5px; font-family: var(--font-ui); }
.cp-row2 { display: flex; gap: 6px; }
.cp-row2 > div, .cp-row2 > input { flex: 1; min-width: 0; }
.cp-assignees { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.cp-assign { display: inline-flex; align-items: center; gap: 4px; background: var(--bg-1); border: 1px solid var(--line); color: var(--ink-soft); border-radius: 12px; padding: 2px 8px 2px 5px; font-size: 11px; cursor: pointer; width: auto; }
.cp-assign.on { background: color-mix(in srgb, var(--ac) 22%, transparent); border-color: var(--ac); color: var(--ink); }
.cp-hint { font-size: 11px; color: var(--ink-faint); font-style: italic; }
.cp-labels { display: flex; flex-wrap: wrap; gap: 4px; margin: 3px 0; }
.cp-checklist { display: flex; flex-direction: column; gap: 3px; margin: 3px 0; }
.cp-chk-it { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-soft); }
.cp-chk-it input { width: auto; }
.cp-chk-it span { flex: 1; min-width: 0; }
.cp-chk-rm { background: transparent; border: none; color: var(--ink-faint); cursor: pointer; font-size: 13px; line-height: 1; }
.cp-chk-rm:hover { color: var(--koi); }

/* widget timeline */
.node.widget .nbody.wbody.tl { align-items: stretch; justify-content: flex-start; padding: 4px; overflow: hidden; }
.w-tl { width: 100%; height: 100%; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.w-tl-row { display: flex; align-items: center; gap: 7px; padding: 4px 6px; border-radius: 5px; font-size: 12px; }
.w-tl-row:hover { background: var(--bg-1); }
.w-tl-row.over .w-tl-due { color: var(--koi); }
.w-tl-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.w-tl-due { font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-dim); flex: none; width: 50px; }
.w-tl-txt { flex: 1; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-tl-ava { width: 18px; height: 18px; border-radius: 50%; background: var(--ac); color: #0a0c09; font-size: 9px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex: none; }
.w-tl-empty { color: var(--ink-faint); font-size: 12px; font-style: italic; text-align: center; margin: auto; padding: 12px; }

/* widget timer pomodoro */
.w-pomo { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 100%; }
.w-pomo-mode { font-size: 11px; color: var(--ink-dim); letter-spacing: 1px; text-transform: uppercase; }
.w-pomo.break .w-pomo-mode { color: var(--moss-2); }
.w-pomo-time { font-family: var(--font-mono); font-size: 42px; line-height: 1; color: var(--ink); letter-spacing: 2px; }
.w-pomo.break .w-pomo-time { color: var(--moss-2); }
.w-pomo-btns { display: flex; gap: 6px; margin-top: 5px; }
.w-pomo-btns button { background: var(--bg-3); border: 1px solid var(--line); color: var(--ink-soft); border-radius: var(--r-m); padding: 5px 12px; cursor: pointer; font-size: 12.5px; }
.w-pomo-btns button:hover { background: var(--bg-4); color: var(--ink); }
.w-pomo-start { min-width: 62px; }
.w-pomo-cycles { font-family: var(--font-mono); font-size: 12px; color: var(--ink-faint); margin-top: 2px; }

/* ---- Backup & ripristino ---- */
.bk-modal { position: fixed; inset: 0; z-index: 170; display: flex; align-items: center; justify-content: center; background: rgba(5,7,5,.55); backdrop-filter: blur(3px); }
.bk-panel { width: min(440px, 92vw); max-height: 86vh; display: flex; flex-direction: column; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--r-l); box-shadow: var(--shadow); animation: pop var(--t-med); overflow: hidden; }
.bk-head { display: flex; align-items: center; justify-content: space-between; padding: 13px 16px; border-bottom: 1px solid var(--line); font-weight: 700; }
.bk-head .bk-x { background: none; border: none; color: var(--ink-dim); font-size: 20px; cursor: pointer; line-height: 1; }
.bk-head .bk-x:hover { color: var(--ink); }
.bk-note { padding: 11px 16px; font-size: 11.5px; color: var(--ink-dim); border-bottom: 1px solid var(--line); line-height: 1.5; }
.bk-list { overflow: auto; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.bk-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 11px; background: var(--bg-3); border: 1px solid var(--line); border-radius: var(--r-m); }
.bk-row:hover { border-color: var(--line-2); }
.bk-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bk-meta b { font-size: 12.5px; color: var(--ink); }
.bk-meta span { font-size: 11px; color: var(--ink-dim); }
.bk-acts { display: flex; gap: 6px; flex: none; }
.bk-rest, .bk-dl, .bk-now, .bk-export { background: var(--bg-4); border: 1px solid var(--line-2); color: var(--ink-soft); border-radius: var(--r-m); padding: 6px 12px; cursor: pointer; font-size: 12px; }
.bk-rest:hover, .bk-now:hover, .bk-export:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--ink); }
.bk-dl { padding: 6px 9px; }
.bk-dl:hover { background: var(--bg-3); color: var(--ink); }
.bk-foot { display: flex; gap: 8px; padding: 11px 16px; border-top: 1px solid var(--line); }
.bk-foot button { flex: 1; }

/* ---- Vista connessioni ---- */
.conn-deg { position: absolute; top: -9px; left: -9px; min-width: 18px; height: 18px; padding: 0 4px; box-sizing: border-box; display: none; align-items: center; justify-content: center; font: 700 10px/1 var(--font-mono, ui-monospace, monospace); background: var(--accent); color: #0a0c09; border-radius: 9px; z-index: 5; box-shadow: 0 1px 5px rgba(0,0,0,.45); pointer-events: none; }
.conn-deg.iso { background: var(--ink-faint); color: var(--bg-1); }
#app.conn-view .conn-deg { display: flex; }
#app.conn-view .node.conn-iso { outline: 1px dashed var(--ink-faint); outline-offset: 3px; }
/* animazione di "flusso" lungo i collegamenti */
#app.conn-view .edge-g .wire { stroke-dasharray: 6 7; animation: connFlow 1.1s linear infinite; }
@keyframes connFlow { to { stroke-dashoffset: -13; } }
/* spotlight: attenua il resto, illumina la rete del nodo */
#app.spotlight .node.conn-dim { opacity: .22; filter: saturate(.4); transition: opacity .18s, filter .18s; }
#app.spotlight .node.conn-focus { outline: 2px solid var(--accent); outline-offset: 3px; box-shadow: 0 0 0 4px var(--accent-soft); border-radius: 4px; }
#app.spotlight .node.conn-near { transition: opacity .18s; }
#app.spotlight .edge-g.conn-dim { opacity: .1; }
#app.spotlight .edge-g.conn-lit { opacity: 1; }
#app.spotlight .edge-g.conn-lit .wire { filter: drop-shadow(0 0 4px var(--accent)); }

/* HUD statistiche rete */
#connHud { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 9px; z-index: 31; background: color-mix(in srgb, var(--bg-2) 88%, transparent); border: 1px solid var(--line-2); border-radius: 20px; padding: 6px 14px; box-shadow: 0 6px 22px rgba(0,0,0,.4); backdrop-filter: blur(6px); font-size: 11.5px; color: var(--ink-soft); max-width: 84vw; }
#connHud.hidden { display: none; }
#connHud b { color: var(--ink); }
#connHud .ch-ico { color: var(--accent); font-size: 13px; }
#connHud .ch-sep { width: 1px; height: 13px; background: var(--line-2); }
#connHud .ch-hub { cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#connHud .ch-hub:hover b { color: var(--accent); }
#connHud .ch-ctl { display: flex; align-items: center; gap: 5px; color: var(--ink-dim); }
#connHud .ch-depth { display: inline-flex; gap: 2px; }
#connHud .ch-depth button { width: 20px; height: 20px; padding: 0; border: 1px solid var(--line-2); background: var(--bg-3); color: var(--ink-soft); border-radius: 5px; cursor: pointer; font-size: 11px; }
#connHud .ch-depth button.on { background: var(--accent); color: #0a0c09; border-color: var(--accent); font-weight: 700; }
#connHud .ch-cluster { border: 1px solid var(--line-2); background: var(--bg-3); color: var(--ink-soft); border-radius: 12px; padding: 3px 10px; cursor: pointer; font-size: 11px; }
#connHud .ch-cluster.on { background: var(--accent-soft); border-color: var(--accent); color: var(--ink); }
#connHud .ch-cluster:hover { color: var(--ink); }

/* lista collegamenti nell'ispettore */
.insp-count { background: var(--bg-4); color: var(--ink-soft); border-radius: 9px; padding: 1px 7px; font-size: 11px; font-weight: 600; margin-left: 6px; }
.conn-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.conn-item { display: flex; align-items: center; gap: 7px; padding: 6px 8px; background: var(--bg-3); border: 1px solid var(--line); border-radius: var(--r-m); cursor: pointer; font-size: 12px; }
.conn-item:hover { background: var(--bg-4); border-color: var(--line-2); }
.conn-arrow { font-family: var(--font-mono, ui-monospace, monospace); font-weight: 700; color: var(--ink-dim); width: 12px; text-align: center; flex: none; }
.conn-arrow.out { color: var(--moss); }
.conn-arrow.in { color: var(--water); }
.conn-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.conn-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-soft); }
.conn-lbl { font-size: 10.5px; color: var(--ink-dim); background: var(--bg-1); border-radius: 5px; padding: 1px 5px; flex: none; }

/* ===== Progetti & Task (Lista + Gantt) ===== */
.pm-modal { position: fixed; inset: 0; z-index: 175; display: flex; align-items: center; justify-content: center; background: rgba(5,7,5,.6); backdrop-filter: blur(4px); }
.pm-panel { width: min(980px, 95vw); height: min(86vh, 760px); display: flex; flex-direction: column; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--r-l); box-shadow: var(--shadow); overflow: hidden; animation: pop var(--t-med); }
.pm-head { display: flex; align-items: center; gap: 14px; padding: 11px 16px; border-bottom: 1px solid var(--line); }
.pm-title { font-weight: 700; font-size: 14px; color: var(--ink); }
.pm-tabs { display: flex; gap: 4px; background: var(--bg-1); padding: 3px; border-radius: var(--r-m); }
.pm-tab { background: transparent; border: none; color: var(--ink-dim); padding: 5px 14px; border-radius: var(--r-s); cursor: pointer; font-size: 12.5px; }
.pm-tab.on { background: var(--bg-3); color: var(--ink); }
.pm-head-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.pm-add { background: var(--accent-soft); border: 1px solid var(--accent); color: var(--ink); border-radius: var(--r-m); padding: 6px 12px; cursor: pointer; font-size: 12.5px; font-weight: 600; }
.pm-members { background: var(--bg-3); border: 1px solid var(--line-2); color: var(--ink-soft); border-radius: var(--r-m); padding: 6px 11px; cursor: pointer; font-size: 12.5px; }
.pm-members:hover { color: var(--ink); }
.pm-x { background: transparent; border: none; color: var(--ink-dim); font-size: 21px; line-height: 1; cursor: pointer; }
.pm-x:hover { color: var(--ink); }
.pm-body { flex: 1; overflow: hidden; display: flex; }
.pm-empty { padding: 40px; text-align: center; color: var(--ink-dim); font-size: 13px; margin: auto; }
.pm-split { flex: 1; display: flex; overflow: hidden; }
.pm-list { flex: 1; overflow-y: auto; padding: 8px; }
.pm-row { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: var(--r-s); border: 1px solid transparent; }
.pm-row:hover { background: var(--bg-3); }
.pm-row.sel { background: var(--bg-3); border-color: var(--line-2); }
.pm-sec { display: flex; align-items: center; gap: 8px; margin: 12px 4px 4px; padding: 0 4px 4px; border-bottom: 1px solid var(--line); font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-faint); }
.pm-sec-n { font-family: var(--font-mono); font-weight: 600; opacity: .8; }
.pm-row-canvas .pm-name { cursor: pointer; }
.pm-canvas-ic { margin-right: 5px; opacity: .85; }
.pm-where { font-size: 10.5px; color: var(--ink-faint); background: var(--bg-1); border: 1px solid var(--line); border-radius: 999px; padding: 1px 7px; margin-left: 6px; font-weight: 500; text-transform: none; letter-spacing: 0; }
.gantt-line.canvas .gantt-row-lbl { color: var(--accent); }
.gantt-canvas-ic { margin-right: 4px; }
.pm-caret { width: 16px; height: 16px; flex: none; display: flex; align-items: center; justify-content: center; color: var(--ink-dim); cursor: pointer; transition: transform .12s; }
.pm-caret.open { transform: rotate(90deg); }
.pm-caret.none { cursor: default; }
.pm-caret svg { width: 12px; height: 12px; }
.pm-check { width: 17px; height: 17px; flex: none; border-radius: 50%; border: 2px solid var(--sc, var(--ink-dim)); cursor: pointer; position: relative; }
.pm-check.done { background: var(--sc); }
.pm-check.done::after { content: "\2713"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #0a0c09; font-size: 11px; font-weight: 800; }
.pm-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font-size: 13px; cursor: pointer; }
.pm-name .pm-sub { color: var(--ink-faint); font-weight: 600; font-size: 11.5px; margin-left: 4px; }
.pm-meta { display: flex; align-items: center; gap: 5px; flex: none; }
/* === Mappa delle urgenze === */
.urg-panel { width: min(720px, 95vw); height: min(82vh, 720px); }
.urg-today { font-weight: 600; font-size: 11.5px; color: var(--ink-faint); margin-left: 8px; padding: 2px 9px; background: var(--bg-1); border-radius: 9px; }
.urg-pm { background: var(--bg-3); border: 1px solid var(--line-2); color: var(--ink-soft); border-radius: var(--r-m); padding: 6px 11px; cursor: pointer; font-size: 12.5px; display: inline-flex; align-items: center; gap: 6px; }
.urg-pm:hover { color: var(--ink); }
.urg-pm svg { width: 15px; height: 15px; }
.urg-body { display: block; overflow-y: auto; padding: 12px 16px 22px; }
.urg-sec { margin-bottom: 18px; }
.urg-sec-h { display: flex; align-items: center; gap: 9px; margin: 4px 0 9px; position: sticky; top: -12px; background: var(--bg-2); padding: 6px 0; z-index: 1; }
.urg-sec-ic { font-size: 15px; }
.urg-sec-l { font-weight: 700; font-size: 13px; color: var(--uc, var(--ink)); letter-spacing: .2px; }
.urg-sec-n { margin-left: 2px; font-size: 11px; font-weight: 700; color: var(--bg-0); background: var(--uc, var(--ink-dim)); border-radius: 9px; padding: 1px 8px; }
.urg-item { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: var(--r-m); border: 1px solid var(--line); border-left: 3px solid var(--uc, var(--line-2)); margin-bottom: 6px; cursor: pointer; transition: background .12s, transform .08s; }
.urg-item:hover { background: var(--bg-3); transform: translateX(2px); }
.urg-item.od { border-left-color: #e05c5c; }
.urg-st { flex: none; font-size: 10.5px; font-weight: 700; color: var(--sc, var(--ink-dim)); border: 1px solid color-mix(in srgb, var(--sc) 55%, transparent); border-radius: 9px; padding: 2px 9px; white-space: nowrap; }
.urg-tt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font-size: 13px; }
.urg-where { flex: none; font-size: 11px; color: var(--ink-faint); max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.urg-ava-row { display: inline-flex; flex: none; }
.urg-ava { width: 20px; height: 20px; border-radius: 50%; background: var(--ac, var(--bg-3)); color: #0a0c09; font-size: 9.5px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; margin-left: -5px; border: 1.5px solid var(--bg-2); }
.urg-ava.more { background: var(--bg-3); color: var(--ink-dim); }
.urg-due { flex: none; font-size: 11.5px; font-weight: 600; color: var(--ink-soft); min-width: 58px; text-align: right; }
.urg-item.od .urg-due { color: #e05c5c; }
.urg-empty { padding: 50px 30px; text-align: center; color: var(--ink-dim); font-size: 14px; margin: auto; }
.urg-empty-ic { font-size: 38px; margin-bottom: 10px; }
.urg-empty-sub { margin-top: 16px; font-size: 12px; color: var(--ink-faint); max-width: 380px; margin-inline: auto; line-height: 1.6; }
.insp-hint { color: var(--ink-faint); font-weight: 400; font-size: 11px; }
.pm-label { background: var(--bg-1); border: 1px solid var(--line); color: var(--ink-soft); border-radius: 5px; padding: 1px 6px; font-size: 10.5px; }
.pm-due { font-size: 11px; color: var(--ink-dim); font-family: var(--font-mono); display: inline-flex; align-items: center; gap: 3px; }
.pm-due.over { color: var(--koi); }
.pm-att-ind, .pm-chat-ind { display: inline-flex; align-items: center; gap: 2px; }
.pm-due .bic svg, .pm-att-ind .bic svg, .pm-chat-ind .bic svg, .dbt-vtab .bic svg, .pp-k .bic svg, .pm-sec .bic svg, .pm-canvas-ic .bic svg, .gantt-canvas-ic .bic svg, .tc-sec .bic svg { width: 13px; height: 13px; }
.pm-canvas-ic, .gantt-canvas-ic { display: inline-flex; align-items: center; margin-right: 4px; vertical-align: -2px; }
.pm-hrs { font-size: 11px; color: var(--ink-faint); font-family: var(--font-mono); }
.pm-status { font-size: 10.5px; color: var(--sc); border: 1px solid var(--sc); border-radius: 10px; padding: 1px 8px; opacity: .9; }
.pm-ava { width: 21px; height: 21px; border-radius: 50%; background: var(--ac, #888); color: #0a0c09; font-size: 9.5px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; margin-left: -5px; border: 1.5px solid var(--bg-2); }
.pm-row-acts { display: none; gap: 3px; flex: none; }
.pm-row:hover .pm-row-acts { display: flex; }
.pm-sub-add, .pm-row-del { width: 22px; height: 22px; border: 1px solid var(--line-2); background: var(--bg-4); color: var(--ink-dim); border-radius: 5px; cursor: pointer; font-size: 12px; }
.pm-sub-add:hover { color: var(--moss); }
.pm-row-del:hover { color: var(--koi); }
.pm-detail { width: 320px; flex: none; border-left: 1px solid var(--line); padding: 14px; overflow-y: auto; background: var(--bg-1); display: flex; flex-direction: column; gap: 4px; }
.pm-detail-head { display: flex; gap: 8px; align-items: flex-start; }
.pm-d-title { flex: 1; background: var(--bg-0); border: 1px solid var(--line-2); color: var(--ink); border-radius: var(--r-s); padding: 8px 10px; font-size: 14px; font-weight: 600; outline: none; }
.pm-d-x { background: transparent; border: none; color: var(--ink-dim); font-size: 18px; cursor: pointer; }
.pm-d-lbl { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-dim); margin-top: 8px; }
.pm-d-desc, .pm-d-status, .pm-d-label-add { width: 100%; background: var(--bg-0); border: 1px solid var(--line); color: var(--ink); border-radius: var(--r-s); padding: 7px 9px; font-size: 12.5px; outline: none; box-sizing: border-box; }
.pm-d-desc { resize: vertical; font-family: inherit; line-height: 1.5; }
.pm-d-row { display: flex; gap: 8px; }
.pm-d-row > div { flex: 1; display: flex; flex-direction: column; }
.pm-d-start, .pm-d-end, .pm-d-hours { background: var(--bg-0); border: 1px solid var(--line); color: var(--ink); border-radius: var(--r-s); padding: 6px 7px; font-size: 12px; outline: none; }
.pm-assignees { display: flex; flex-wrap: wrap; gap: 5px; }
.pm-assign { display: inline-flex; align-items: center; gap: 5px; background: var(--bg-3); border: 1px solid var(--line); color: var(--ink-soft); border-radius: 14px; padding: 3px 9px; cursor: pointer; font-size: 11.5px; }
.pm-assign.on { background: color-mix(in srgb, var(--ac) 22%, transparent); border-color: var(--ac); color: var(--ink); }
.pm-d-hint { font-size: 11px; color: var(--ink-faint); }
.pm-labels { display: flex; flex-wrap: wrap; gap: 5px; }
.pm-label.rm { cursor: pointer; }
.pm-label.rm:hover { border-color: var(--koi); color: var(--koi); }
.pm-d-foot { display: flex; gap: 8px; margin-top: 12px; }
.pm-d-subadd { flex: 1; background: var(--bg-3); border: 1px solid var(--line-2); color: var(--ink-soft); border-radius: var(--r-s); padding: 7px; cursor: pointer; font-size: 12px; }
.pm-d-subadd:hover { color: var(--moss); }
.pm-d-del { background: transparent; border: 1px solid var(--line); color: var(--ink-dim); border-radius: var(--r-s); padding: 7px 12px; cursor: pointer; font-size: 12px; }
.pm-d-del:hover { color: var(--koi); border-color: var(--koi); }
.pm-members-menu { min-width: 200px; }
.ctx-title { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-dim); padding: 6px 10px 4px; }
.pm-mem { display: flex; align-items: center; gap: 8px; padding: 5px 10px; }
.pm-mem-name { flex: 1; font-size: 12.5px; color: var(--ink); }
.pm-mem-role { font-size: 10.5px; color: var(--ink-faint); }
.pm-mem-add { width: calc(100% - 12px); margin: 4px 6px 2px; background: var(--bg-0); border: 1px solid var(--line); color: var(--ink); border-radius: var(--r-s); padding: 6px 8px; font-size: 12px; outline: none; box-sizing: border-box; }
.gantt { flex: 1; overflow: auto; padding: 10px; }
.gantt-head { display: flex; position: sticky; top: 0; background: var(--bg-2); z-index: 2; }
.gantt-corner { font-weight: 700; color: var(--ink-dim); font-size: 11px; }
.gantt-row-lbl { width: 190px; min-width: 190px; flex: none; font-size: 12px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; }
.gantt-scale { display: flex; border-bottom: 1px solid var(--line); }
.gantt-day { flex: none; text-align: center; font-size: 9.5px; color: var(--ink-faint); font-family: var(--font-mono); border-left: 1px solid var(--line); padding: 4px 0; }
.gantt-day.we { background: rgba(255,255,255,.02); }
.gantt-line { display: flex; align-items: center; height: 32px; }
.gantt-line:hover { background: var(--bg-3); }
.gantt-track { position: relative; height: 100%; flex: none; }
.gantt-bar { position: absolute; top: 6px; height: 19px; border-radius: 5px; display: flex; align-items: center; padding-left: 4px; cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,.3); opacity: .92; }
.gantt-bar:hover { opacity: 1; }
.gantt-bar .pm-ava { width: 16px; height: 16px; font-size: 8px; border-width: 1px; margin-left: -3px; }
.gantt-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--koi); opacity: .7; pointer-events: none; }

/* ===== Pagine stile Notion (editor a blocchi) ===== */
.page-modal { position: fixed; inset: 0; z-index: 176; display: flex; align-items: center; justify-content: center; background: rgba(5,7,5,.62); backdrop-filter: blur(4px); }
.page-panel { width: min(1080px, 96vw); height: min(92vh, 980px); display: flex; flex-direction: column; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--r-l); box-shadow: var(--shadow); overflow: hidden; animation: pop var(--t-med); }
.page-head { display: flex; align-items: center; gap: 12px; padding: 13px 22px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, color-mix(in srgb, var(--bg-1) 60%, transparent), transparent); }
.page-name { flex: 1; background: transparent; border: none; color: var(--ink); font-size: 25px; font-weight: 800; letter-spacing: -.015em; outline: none; padding: 2px 0; }
.page-vis-btn { background: var(--bg-3); border: 1px solid var(--line-2); color: var(--ink-soft); border-radius: 14px; padding: 5px 12px; cursor: pointer; font-size: 12px; white-space: nowrap; }
.page-vis-btn:hover { color: var(--ink); border-color: var(--accent); }
.page-wiki-btn { background: var(--accent-soft); border: 1px solid var(--accent); color: var(--ink); border-radius: 14px; padding: 5px 12px; cursor: pointer; font-size: 12px; white-space: nowrap; font-weight: 600; }
.page-wiki-btn:hover { background: color-mix(in srgb, var(--accent) 32%, transparent); }
.page-tocanvas-btn { background: var(--bg-3); border: 1px solid var(--line-2); color: var(--ink-soft); border-radius: 14px; padding: 5px 12px; cursor: pointer; font-size: 12px; white-space: nowrap; }
.page-tocanvas-btn:hover { color: var(--ink); border-color: var(--accent); }
.node.boardview .bv-empty { display: flex; align-items: center; justify-content: center; padding: 12px; }
.node.boardview .bv-pick { margin-top: 8px; background: var(--bg-3); border: 1px solid var(--line); color: var(--ink); border-radius: var(--r-s); padding: 5px 8px; font-size: 12px; font-family: var(--font-ui); }
/* blocchi pagina: sotto-pagina / gantt / tavola */
.pb-subpage, .pb-boardcard { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--r-m); padding: 9px 12px; }
.pb-sp-ic, .pb-bc-ic { font-size: 15px; display: inline-flex; align-items: center; color: var(--lav-2); }
.pb-bc-ic svg, .pb-sp-ic svg { width: 17px; height: 17px; }
.pb-sp-name, .pb-bc-name { font-weight: 600; color: var(--ink); }
.pb-bc-meta { font-size: 11px; color: var(--ink-faint); }
.pb-subpage button, .pb-boardcard button { margin-left: auto; background: var(--bg-3); border: 1px solid var(--line); color: var(--ink-soft); border-radius: var(--r-s); padding: 4px 10px; cursor: pointer; font-size: 12px; }
.pb-subpage button + button, .pb-boardcard button + button { margin-left: 4px; }
.pb-subpage button:hover, .pb-boardcard button:hover { border-color: var(--accent); color: var(--ink); }
.pb-subpage.empty, .pb-boardcard.empty { gap: 8px; }
.pb-sp-new { margin-left: 0 !important; }
.pb-subpage select, .pb-boardcard select { background: var(--bg-3); border: 1px solid var(--line); color: var(--ink-soft); border-radius: var(--r-s); padding: 5px 8px; font-size: 12px; font-family: var(--font-ui); }
.pb-embed { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: var(--r-m); padding: 8px; background: var(--bg-1); }
.pb-embed-h { font-size: 12px; color: var(--ink-soft); margin-bottom: 6px; font-weight: 600; }
.pb-gantt-host { overflow-x: auto; }
.icon-only { display: inline-flex; align-items: center; justify-content: center; }
/* blocco VISTA nelle pagine (istanza sincronizzata) */
.pb-view { flex: 1; min-width: 0; border: 1px dashed var(--accent); border-radius: var(--r-m); background: color-mix(in srgb, var(--accent) 7%, transparent); padding: 0; overflow: hidden; }
.pb-view.empty { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-style: dashed; }
.pb-view-bar { display: flex; align-items: center; gap: 7px; padding: 6px 10px; border-bottom: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line)); }
.pb-view-ic { display: inline-flex; width: 15px; height: 15px; color: var(--lav-2); flex: none; }
.pb-view-ic svg { width: 15px; height: 15px; }
.pb-view-name { font-size: 11.5px; font-weight: 700; color: var(--ink); text-transform: uppercase; letter-spacing: .03em; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pb-view-unlink { background: transparent; border: none; color: var(--ink-faint); cursor: pointer; font-size: 15px; line-height: 1; padding: 0 4px; }
.pb-view-unlink:hover { color: var(--koi); }
.pb-view-table, .pb-view-note { padding: 8px 10px; }
.pb-view-model { height: 280px; }
.pb-view-other { padding: 10px 12px; color: var(--ink-soft); font-size: 12px; font-style: italic; }
.pb-view-pick { flex: 1; background: var(--bg-3); border: 1px solid var(--line); color: var(--ink); border-radius: var(--r-s); padding: 5px 8px; font-size: 12px; font-family: var(--font-ui); }
.pb-view-hint { font-size: 11.5px; color: var(--ink-soft); }
.wk-view { margin: 14px 0; }
.page-body.pb-drop { outline: 2px dashed var(--accent); outline-offset: -8px; border-radius: var(--r-m); }
/* ===== PORTALE a una tavola (anteprima + clic = entra nel canvas) ===== */
.bportal { position: relative; width: 100%; height: 100%; min-height: 160px; border: 1px solid var(--line-2); border-radius: var(--r-m); overflow: hidden; cursor: pointer; background: radial-gradient(circle at 50% 35%, var(--bg-1), var(--bg-0)); transition: border-color var(--t-fast), box-shadow var(--t-fast); }
.bportal:hover { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 8px 28px rgba(0,0,0,.32); }
.bportal-empty { padding: 18px; color: var(--ink-faint); font-size: 12px; font-style: italic; }
.bportal-thumb { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: .85; }
.bportal-grad { position: absolute; inset: 0; background: linear-gradient(180deg, transparent 40%, rgba(5,7,5,.55) 78%, rgba(5,7,5,.8)); pointer-events: none; }
.bportal-info { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 10px; padding: 12px 14px; }
.bportal-ic { display: inline-flex; width: 22px; height: 22px; flex: none; color: var(--lav-2); }
.bportal-ic svg { width: 22px; height: 22px; }
.bportal-txt { display: flex; flex-direction: column; min-width: 0; }
.bportal-name { color: var(--ink); font-size: 14px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bportal-meta { color: var(--ink-faint); font-size: 11px; }
.bportal-go { margin-left: auto; color: var(--lav-2); font-size: 12px; font-weight: 600; background: var(--bg-0); border: 1px solid var(--line-2); border-radius: 20px; padding: 5px 12px; white-space: nowrap; }
.bportal:hover .bportal-go { background: var(--accent-soft); border-color: var(--accent); color: var(--ink); }
.bportal-unlink { position: absolute; top: 8px; right: 8px; background: var(--bg-0); border: 1px solid var(--line-2); color: var(--ink-soft); width: 26px; height: 26px; border-radius: 50%; font-size: 15px; line-height: 1; cursor: pointer; }
.bportal-unlink:hover { border-color: var(--koi); color: var(--koi); }
.pb-boardmini { flex: 1; min-width: 0; height: 300px; }
.wk-boardmini { height: 380px; margin: 14px 0; }
.node.boardview .nbody.bvbody { padding: 0; overflow: hidden; min-height: 0; display: flex; }
.node.boardview .bvbody .bportal, .node.boardview .bvbody .blive { border: 0; border-radius: 0; }
/* ===== PORTALE LIVE (finestra sul vero canvas figlio, nodi reali, sola lettura) ===== */
.blive { display: flex; flex-direction: column; width: 100%; height: 100%; min-height: 170px; border: 1px solid var(--line-2); border-radius: var(--r-m); overflow: hidden; background: radial-gradient(circle at 50% 35%, var(--bg-1), var(--bg-0)); }
.blive-stage { position: relative; flex: 1; min-height: 110px; overflow: hidden; cursor: grab; touch-action: none; }
.blive-stage.panning { cursor: grabbing; }
.blive-fit { font-size: 13px !important; line-height: 1; padding: 3px 8px !important; }
.blive-fit:hover { border-color: var(--accent) !important; color: var(--ink) !important; }
.blive-world { position: absolute; left: 0; top: 0; transform-origin: 0 0; pointer-events: none; }
.blive-edges { position: absolute; left: 0; top: 0; overflow: visible; }
.blive-nodes { position: absolute; left: 0; top: 0; }
.blive-nodes .node { box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.blive-nodes .node .resize, .blive-nodes .node .conn, .blive-nodes .node .node-grip, .blive-nodes .node .node-eye, .blive-nodes .node .node-lock { display: none !important; }
.blive-bar { display: flex; align-items: center; gap: 7px; padding: 6px 10px; border-top: 1px solid var(--line); background: var(--bg-2); flex: none; }
.blive-ic { display: inline-flex; width: 16px; height: 16px; color: var(--lav-2); flex: none; }
.blive-ic svg { width: 16px; height: 16px; }
.blive-name { font-weight: 700; color: var(--ink); font-size: 12.5px; }
.blive-meta { font-size: 10.5px; color: var(--ink-faint); }
.blive-sp { flex: 1; }
.blive-bar button { background: var(--bg-3); border: 1px solid var(--line); color: var(--ink-soft); border-radius: var(--r-s); padding: 3px 10px; cursor: pointer; font-size: 11px; }
.blive-open:hover { border-color: var(--accent); color: var(--ink); }
.blive-unlink:hover { border-color: var(--koi) !important; color: var(--koi) !important; }
/* ===== WIKI / SITO (vista cliente) ===== */
.wiki-modal { position: fixed; inset: 0; z-index: 200; background: rgba(5,7,5,.78); backdrop-filter: blur(5px); display: flex; align-items: center; justify-content: center; }
.wiki-panel { position: relative; width: 96vw; height: 94vh; display: flex; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--r-l); box-shadow: var(--shadow); overflow: hidden; animation: pop var(--t-med); }
.wk-nav { width: 260px; flex: none; background: var(--bg-1); border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.wk-nav-head { display: flex; align-items: center; gap: 9px; padding: 16px 16px 12px; border-bottom: 1px solid var(--line); }
.wk-logo { font-size: 18px; }
.wk-title { font-weight: 700; color: var(--ink); font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wk-nav-tree { flex: 1; overflow-y: auto; padding: 8px 6px; }
.wk-mp { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: var(--r-s); cursor: pointer; color: var(--ink-soft); font-size: 13px; font-weight: 600; }
.wk-mp:hover { background: var(--bg-3); color: var(--ink); }
.wk-mp.on { background: var(--accent-soft); color: var(--ink); }
.wk-mp-ic { font-size: 12px; }
.wk-mh { padding: 4px 8px; border-radius: var(--r-s); cursor: pointer; color: var(--ink-dim); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wk-mh:hover { color: var(--lav-2); background: var(--bg-3); }
.wk-mh1 { font-weight: 600; color: var(--ink-soft); }
.wk-nav-foot { padding: 10px 16px; border-top: 1px solid var(--line); font-size: 10.5px; color: var(--ink-faint); }
.wk-content { flex: 1; overflow-y: auto; padding: 40px 8vw 80px; }
.wk-article { max-width: 760px; margin: 0 auto; color: var(--ink); line-height: 1.62; }
.wk-page-title { font-size: 34px; font-weight: 800; margin: 0 0 22px; letter-spacing: -.5px; }
/* Wiki editabile inline */
.wk-edit-toggle { margin: 0 16px 10px; background: var(--accent-soft); border: 1px solid var(--accent); color: var(--ink); border-radius: var(--r-s); padding: 6px 10px; cursor: pointer; font-size: 12px; font-weight: 600; }
.wk-edit-toggle:hover { background: color-mix(in srgb, var(--accent) 30%, transparent); }
.wk-edit { outline: none; margin: 9px 0; line-height: 1.62; border-radius: 4px; padding: 1px 3px; }
.wk-article.editing .wk-edit:hover, .wk-article.editing .wk-edit:focus, .wk-article.editing .wk-page-title:focus { box-shadow: 0 0 0 2px var(--accent-soft); }
.wk-edit:empty::before { content: attr(data-ph); color: var(--ink-faint); }
h1.wk-edit { font-size: 25px; font-weight: 700; margin: 24px 0 8px; } h2.wk-edit { font-size: 20px; font-weight: 700; margin: 20px 0 6px; } h3.wk-edit { font-size: 16.5px; color: var(--ink-soft); font-weight: 700; }
.wk-edit-quote { border-left: 3px solid var(--accent); padding-left: 14px; color: var(--ink-soft); font-style: italic; }
.wk-edit-callout { background: var(--accent-soft); border-radius: var(--r-m); padding: 12px 14px; }
.wk-edit-bullet::before { content: "•  "; color: var(--lav-2); }
.wk-edit-todo::before { content: "☐  "; }
.wk-article.editing .wk-page-title { outline: none; }
.wk-add-blk { display: block; width: 100%; margin-top: 12px; background: transparent; border: 1px dashed var(--line-2); color: var(--ink-dim); border-radius: var(--r-m); padding: 9px; cursor: pointer; font-size: 12.5px; text-align: center; }
.wk-add-blk:hover { border-color: var(--accent); color: var(--ink); }
.wk-open-ed { margin-top: 6px; }
.wk-h { margin: 26px 0 8px; line-height: 1.3; scroll-margin-top: 20px; }
h1.wk-h { font-size: 25px; } h2.wk-h { font-size: 20px; } h3.wk-h { font-size: 16.5px; color: var(--ink-soft); }
.wk-p { margin: 9px 0; }
.wk-li { display: flex; gap: 8px; margin: 4px 0; align-items: flex-start; }
.wk-bullet, .wk-num { color: var(--lav-2); flex: none; }
.wk-tick { flex: none; }
.wk-todo.done { color: var(--ink-faint); text-decoration: line-through; }
.wk-quote { border-left: 3px solid var(--accent); margin: 12px 0; padding: 4px 0 4px 16px; color: var(--ink-soft); font-style: italic; }
.wk-callout { display: flex; gap: 10px; background: var(--accent-soft); border-radius: var(--r-m); padding: 12px 14px; margin: 12px 0; }
.wk-cic { flex: none; }
.wk-hr { border: none; border-top: 1px solid var(--line); margin: 22px 0; }
.wk-img img { max-width: 100%; border-radius: var(--r-m); margin: 12px 0; }
.wk-att, .wk-table, .wk-embed { margin: 14px 0; }
.wk-embed { border: 1px solid var(--line); border-radius: var(--r-m); padding: 10px; background: var(--bg-1); overflow-x: auto; }
.wk-embed-h { font-weight: 600; color: var(--ink-soft); font-size: 13px; margin-bottom: 8px; }
.wk-subpage, .wk-boardcard { display: flex; align-items: center; gap: 9px; border: 1px solid var(--line); border-radius: var(--r-m); padding: 11px 14px; margin: 10px 0; cursor: pointer; background: var(--bg-1); transition: border-color var(--t-fast); }
.wk-subpage:hover, .wk-boardcard:hover { border-color: var(--accent); }
.wk-subpage b, .wk-boardcard b { color: var(--ink); }
.wk-go { margin-left: auto; color: var(--lav-2); font-size: 17px; }
.wk-bc-meta { margin-left: auto; font-size: 11px; color: var(--ink-faint); }
.wk-muted { color: var(--ink-faint); font-style: italic; }
.wk-x { position: absolute; top: 14px; right: 16px; z-index: 2; background: var(--bg-3); border: 1px solid var(--line-2); color: var(--ink); width: 32px; height: 32px; border-radius: 50%; font-size: 18px; line-height: 1; cursor: pointer; }
.wk-x:hover { border-color: var(--koi); color: var(--koi); }
@media (max-width: 720px) { .wk-nav { width: 180px; } .wk-content { padding: 30px 20px 60px; } }
.page-x { background: transparent; border: none; color: var(--ink-dim); font-size: 22px; line-height: 1; cursor: pointer; }
.page-x:hover { color: var(--ink); }
/* pulsante Chat nella barra del fullscreen: coerente col tema (non più bianco) */
.page-chat-btn { display: inline-flex; align-items: center; gap: 5px; background: var(--bg-1); border: 1px solid var(--line-2); color: var(--ink-soft); border-radius: 8px; padding: 5px 11px; cursor: pointer; font-size: 12.5px; }
.page-chat-btn:hover { color: var(--ink); border-color: var(--lav-2); }
.page-chat-btn .bic svg { width: 14px; height: 14px; }
.page-body { flex: 1; overflow-y: auto; padding: 28px max(40px, (100% - 860px) / 2) 90px; }
/* anteprima dei blocchi-pagina dentro la card della Nota (oggetto universale) */
.nbody.pageprev { padding: 9px 11px; overflow: hidden; display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; color: var(--ink-soft); }
.pp-pills { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 3px; align-items: center; }
.pp-pill { font-size: 10.5px; font-weight: 700; padding: 2px 9px; border-radius: 999px; color: var(--pc, #888); background: color-mix(in srgb, var(--pc, #888) 18%, transparent); border: 1px solid color-mix(in srgb, var(--pc, #888) 45%, transparent); letter-spacing: .01em; }
.pp-av { width: 16px; height: 16px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 700; color: #0a0c09; }
.pp-due { font-size: 10px; color: var(--ink-dim); }
.pp-done { font-size: 10px; font-weight: 700; color: #5fc88f; }
/* editor della card kanban (doppio clic): la nota-Entità a tutto campo */
.kbe-modal { position: fixed; inset: 0; z-index: 220; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; animation: pop var(--t-fast); }
.kbe-panel { width: min(560px, 92vw); max-height: 88vh; overflow: auto; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: var(--shadow); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.kbe-head { display: flex; align-items: center; gap: 8px; }
.kbe-head .kbe-ic { color: var(--lav-2); display: inline-flex; }
.kbe-head .kbe-ic svg { width: 18px; height: 18px; }
.kbe-title { flex: 1; background: transparent; border: none; outline: none; color: var(--ink); font-size: 18px; font-weight: 700; }
.kbe-title::placeholder { color: var(--ink-faint); }
.kbe-x { background: transparent; border: none; color: var(--ink-dim); cursor: pointer; }
.kbe-x:hover { color: var(--ink); }
.kbe-body { min-height: 120px; outline: none; color: var(--ink-soft); font-size: 13px; line-height: 1.6; border-top: 1px solid var(--line); padding-top: 10px; }
.kbe-body:empty::before { content: attr(data-ph); color: var(--ink-faint); }
.kbe-foot { display: flex; justify-content: flex-end; border-top: 1px solid var(--line); padding-top: 10px; }
.kbe-tocanvas { display: inline-flex; align-items: center; gap: 6px; background: var(--bg-1); border: 1px solid var(--line-2); color: var(--ink-soft); border-radius: 8px; padding: 6px 12px; cursor: pointer; font-size: 12.5px; }
.kbe-tocanvas:hover { color: var(--ink); border-color: var(--lav-2); }
/* editor Stati & Priorità */
.se-panel { width: min(480px, 92vw); }
.kbe-title-txt { flex: 1; font-size: 17px; font-weight: 700; color: var(--ink); }
.se-sec { margin-top: 12px; }
.se-sec-h { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-dim); margin-bottom: 6px; }
.se-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.se-dot { width: 18px; height: 18px; border-radius: 5px; border: 1px solid rgba(255,255,255,.18); cursor: pointer; flex: none; padding: 0; }
.se-name { flex: 1; background: var(--bg-1); border: 1px solid var(--line-2); border-radius: 7px; color: var(--ink); padding: 5px 9px; outline: none; font-size: 13px; }
.se-name:focus { border-color: var(--lav-2); }
.se-del { background: transparent; border: none; color: var(--ink-faint); cursor: pointer; font-size: 16px; line-height: 1; }
.se-del:hover { color: var(--koi); }
.se-add { margin-top: 6px; background: transparent; border: 1px dashed var(--line-2); color: var(--ink-dim); border-radius: 7px; padding: 5px 10px; cursor: pointer; font-size: 12.5px; }
.se-add:hover { color: var(--ink); border-color: var(--lav-2); }
.pp-blocks { display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.pp-h1 { font-size: 14.5px; font-weight: 700; color: var(--ink); }
.pp-h2 { font-size: 13.5px; font-weight: 700; color: var(--ink); }
.pp-h3 { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.pp-text, .pp-li { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pp-quote { border-left: 2px solid var(--line-2); padding-left: 7px; color: var(--ink-dim); font-style: italic; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pp-callout { background: var(--accent-soft); border-radius: var(--r-s); padding: 3px 7px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pp-todo { color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pp-chip { display: inline-block; align-self: flex-start; font-size: 11px; background: var(--bg-3); border: 1px solid var(--line); border-radius: var(--r-s); padding: 2px 8px; color: var(--ink-soft); }
.pp-img { max-width: 100%; max-height: 80px; border-radius: 6px; object-fit: cover; }
.pp-hr { border: none; border-top: 1px solid var(--line-2); margin: 3px 0; }
.pp-empty { color: var(--ink-faint); font-style: italic; font-size: 11.5px; }
.pp-more { color: var(--ink-faint); }
/* complessità progressiva: chip opt-in Pagina / Task */
.obj-modes { display: flex; gap: 6px; }
.obj-mode { flex: 1; background: var(--bg-0); border: 1px solid var(--line); color: var(--ink-soft); border-radius: var(--r-s); padding: 7px 10px; cursor: pointer; font-size: 12.5px; }
.obj-mode:hover { border-color: var(--accent); color: var(--ink); }
.obj-mode.on { background: var(--accent-soft); border-color: var(--accent); color: var(--lav-2); font-weight: 600; }
.nbody-pills { margin-bottom: 6px; }
.pp-lab2 { font-size: 10px; padding: 1px 7px; border-radius: 999px; background: var(--bg-3); border: 1px solid var(--line-2); color: var(--ink-soft); }
/* inspector oggetto: apri pagina + label task */
.insp-openpage { width: 100%; background: var(--accent-soft); border: 1px solid var(--accent); color: var(--lav-2); border-radius: var(--r-m); padding: 10px 12px; cursor: pointer; font-size: 13px; font-weight: 600; }
.insp-openpage:hover { filter: brightness(1.1); }
.insp-tonote { width: 100%; background: transparent; border: 1px solid var(--line); color: var(--ink-dim); border-radius: var(--r-s); padding: 7px 12px; cursor: pointer; font-size: 12px; }
.insp-tonote:hover { border-color: var(--line-2); color: var(--ink); }
.pp-lab { display: inline-flex; align-items: center; gap: 3px; background: var(--bg-3); border: 1px solid var(--line-2); border-radius: 999px; padding: 1px 4px 1px 9px; font-size: 11px; color: var(--ink-soft); }
.pp-lab-x { background: transparent; border: none; color: var(--ink-dim); cursor: pointer; font-size: 13px; line-height: 1; padding: 0 2px; }
.pp-lab-x:hover { color: var(--koi); }
.pp-lab-add, .pp-assign-add { background: var(--bg-3); border: 1px solid var(--line); color: var(--ink-soft); border-radius: 50%; width: 20px; height: 20px; cursor: pointer; line-height: 1; }
.pp-lab-add:hover, .pp-assign-add:hover { border-color: var(--accent); color: var(--ink); }
.pp-labels { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
/* blocco MODELLO 3D dentro una pagina */
.pb-model { position: relative; border: 1px solid var(--line); border-radius: var(--r-m); overflow: hidden; background: var(--bg-0); }
.pb-model-img { display: block; width: 100%; max-height: 360px; object-fit: contain; }
.pb-model-bar { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-top: 1px solid var(--line); background: var(--bg-1); }
.pb-model-nm { flex: 1; font-size: 12.5px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pb-model-bar button, .pb-model-empty button { background: var(--accent-soft); border: 1px solid var(--accent); color: var(--lav-2); border-radius: var(--r-s); padding: 5px 10px; cursor: pointer; font-size: 12px; white-space: nowrap; }
.pb-model-bar button:hover, .pb-model-empty button:hover { filter: brightness(1.1); }
.pb-model-empty { display: flex; align-items: center; gap: 10px; padding: 16px; flex-wrap: wrap; }
.pb-model-stale { position: absolute; top: 8px; left: 8px; background: var(--koi); color: #1c0e0a; border-radius: 999px; padding: 2px 8px; font-size: 10px; font-weight: 700; }
/* Proprietà di pagina (stile Notion) */
.page-props { margin: 0 0 14px 44px; padding: 4px 0 10px; border-bottom: 1px solid var(--line); }
.page-props.collapsed .pp-rows { display: none; }
.pp-rows { display: flex; flex-direction: column; gap: 2px; margin-bottom: 4px; }
.pp-row { display: flex; align-items: center; gap: 10px; min-height: 30px; padding: 1px 8px; margin: 0 -8px; border-radius: 7px; transition: background .1s; }
.pp-row:hover { background: var(--bg-1); }
.pp-k { flex: 0 0 132px; color: var(--ink-faint); font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.pp-k .bic { opacity: .7; }
.pp-v { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; font-size: 13px; }
.pp-v select, .pp-v input[type="date"] { background: transparent; border: 1px solid transparent; color: var(--ink-soft); border-radius: var(--r-s); padding: 3px 6px; font-size: 12.5px; cursor: pointer; outline: none; font-weight: 600; }
.pp-v select:hover, .pp-v input[type="date"]:hover { background: var(--bg-3); border-color: var(--line); }
.pp-v input[type="date"] { color-scheme: dark; font-weight: 500; }
.pp-status { font-weight: 700 !important; }
.pp-assignees { flex-wrap: wrap; }
.pp-ava { width: 22px; height: 22px; border-radius: 50%; background: var(--ac, var(--bg-3)); color: #0a0c09; font-size: 10px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; margin-right: -4px; border: 1.5px solid var(--bg-2); }
.pp-empty { color: var(--ink-faint); font-size: 12.5px; }
.pp-assign-add { margin-left: 8px; width: 22px; height: 22px; border-radius: 50%; background: var(--bg-3); border: 1px dashed var(--line-2); color: var(--ink-dim); cursor: pointer; font-size: 13px; line-height: 1; }
.pp-assign-add:hover { border-color: var(--accent); color: var(--ink); }
.pp-toggle { background: transparent; border: none; color: var(--ink-faint); cursor: pointer; font-size: 11.5px; padding: 2px 0; }
.pp-toggle:hover { color: var(--ink-soft); }
.pp-mpick { display: flex; align-items: center; gap: 8px; }
.ctx-empty { padding: 8px 12px; color: var(--ink-faint); font-size: 12px; }
/* Elenco progetti (database di pagine) */
.pb-pagelist, .wk-pagelist { border: 1px solid var(--line); border-radius: var(--r-m); overflow: hidden; margin: 4px 0; }
.pl-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--bg-1); border-bottom: 1px solid var(--line); font-size: 13px; }
.pl-h-ic { font-size: 14px; }
.pl-count { font-size: 11px; font-weight: 700; color: var(--bg-0); background: var(--lav-2); border-radius: 9px; padding: 1px 7px; }
.pl-sp { flex: 1; }
.pl-new { background: var(--accent-soft); border: 1px solid var(--accent); color: var(--ink); border-radius: var(--r-s); padding: 4px 9px; cursor: pointer; font-size: 11.5px; font-weight: 600; }
.pl-new:hover { background: color-mix(in srgb, var(--accent) 30%, transparent); }
.pl-row { display: grid; grid-template-columns: 1fr 100px 92px 90px 72px; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); cursor: pointer; font-size: 12.5px; transition: background .12s; }
.pl-row:last-child { border-bottom: none; }
.pl-row:not(.pl-colhead):hover { background: var(--bg-3); }
.pl-colhead { cursor: default; color: var(--ink-faint); font-size: 10.5px; text-transform: uppercase; letter-spacing: .4px; background: transparent; }
.pl-colhead:hover { background: transparent; }
.pl-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.pl-pill { font-size: 10.5px; font-weight: 700; color: var(--pc, var(--ink-dim)); border: 1px solid color-mix(in srgb, var(--pc) 55%, transparent); border-radius: 9px; padding: 1px 8px; white-space: nowrap; }
.pl-pill.ghost { background: color-mix(in srgb, var(--pc) 14%, transparent); border-color: transparent; }
.pl-dash { color: var(--ink-faint); }
.pl-due { font-size: 11.5px; color: var(--ink-soft); }
.pl-due.od { color: #e05c5c; font-weight: 600; }
.pl-ava-row { display: flex; }
.pl-ava { width: 20px; height: 20px; border-radius: 50%; background: var(--ac, var(--bg-3)); color: #0a0c09; font-size: 9.5px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; margin-left: -5px; border: 1.5px solid var(--bg-2); }
.pl-ava:first-child { margin-left: 0; }
.pl-empty { padding: 20px 16px; text-align: center; color: var(--ink-dim); font-size: 12.5px; line-height: 1.6; }
.pb-row { position: relative; display: flex; align-items: flex-start; gap: 4px; padding: 2px 0; padding-left: 44px; }
.pb-ctrl { position: absolute; left: 6px; top: 2px; display: flex; gap: 1px; opacity: 0; transition: opacity .12s; }
.pb-row:hover .pb-ctrl { opacity: 1; }
.pb-add, .pb-handle { width: 18px; height: 22px; display: flex; align-items: center; justify-content: center; color: var(--ink-faint); cursor: pointer; border-radius: 4px; font-size: 13px; }
.pb-add:hover, .pb-handle:hover { background: var(--bg-4); color: var(--ink); }
.pb-handle { cursor: grab; letter-spacing: -2px; touch-action: none; }
.pb-handle:active { cursor: grabbing; }
.pb-row.pb-dragging { opacity: .4; }
.pb-dropline { height: 0; border-top: 2px solid var(--accent); border-radius: 2px; margin: 1px 0 1px 44px; box-shadow: 0 0 6px var(--accent); pointer-events: none; }
.pb-col-blocks .pb-dropline { margin-left: 22px; }
.pb-edit { flex: 1; outline: none; color: var(--ink-soft); font-size: 14.5px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; min-height: 1.5em; }
.pb-edit:empty::before { content: attr(data-ph); color: var(--ink-faint); pointer-events: none; }
.pb-h1 .pb-edit { font-size: 26px; font-weight: 700; color: var(--ink); line-height: 1.25; }
.pb-h2 .pb-edit { font-size: 21px; font-weight: 700; color: var(--ink); line-height: 1.3; }
.pb-h3 .pb-edit { font-size: 17px; font-weight: 600; color: var(--ink); }
.pb-h1, .pb-h2 { margin-top: 8px; }
.pb-marker { flex: none; color: var(--ink-dim); width: 20px; text-align: center; line-height: 1.6; font-size: 14px; }
.pb-numm { font-family: var(--font-mono); font-size: 13px; }
.pb-quote { border-left: 3px solid var(--accent); }
.pb-quote .pb-edit { color: var(--ink-soft); font-style: italic; padding-left: 10px; }
.pb-callout { background: var(--bg-3); border: 1px solid var(--line); border-radius: var(--r-m); padding: 8px 10px; margin-left: 44px; padding-left: 8px; }
.pb-callout .pb-ctrl { left: 6px; }
.pb-tcheck { flex: none; width: 17px; height: 17px; margin-top: 3px; border: 2px solid var(--ink-dim); border-radius: 4px; cursor: pointer; position: relative; }
.pb-row.checked .pb-tcheck { background: var(--moss); border-color: var(--moss); }
.pb-row.checked .pb-tcheck::after { content: "\2713"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #0a0c09; font-size: 11px; font-weight: 800; }
.pb-row.checked .pb-edit { color: var(--ink-faint); text-decoration: line-through; }
.pb-hr { flex: 1; border: none; border-top: 1px solid var(--line-2); margin: 10px 0; }
.pb-img { flex: 1; }
.pb-img img { width: 100%; max-width: 100%; height: auto; max-height: 480px; object-fit: contain; object-position: center; border-radius: var(--r-m); display: block; background: var(--bg-0); border: 1px solid var(--line); }
/* maniglia di ridimensionamento larghezza (foto, tabelle, embed, gantt, tavola, sotto-pagina) */
.pb-rz { position: absolute; top: 0; bottom: 0; right: -7px; width: 16px; cursor: ew-resize; z-index: 4; display: flex; align-items: center; justify-content: center; touch-action: none; }
.pb-rz::after { content: ""; width: 5px; height: 46px; max-height: 64%; border-radius: 3px; background: var(--line-2); opacity: 0; transition: opacity .15s, background .15s; }
.pb-img:hover > .pb-rz::after, .pb-table:hover > .pb-rz::after, .pb-att:hover > .pb-rz::after, .pb-embed:hover > .pb-rz::after, .pb-boardcard:hover > .pb-rz::after, .pb-subpage:hover > .pb-rz::after, .pb-rz.on::after { opacity: 1; }
.pb-rz:hover::after, .pb-rz.on::after { background: var(--accent); }
/* Colonne (separatori verticali) nelle pagine */
.pb-cols { flex: 1; display: flex; align-items: stretch; min-width: 0; }
.pb-col { position: relative; min-width: 0; padding: 4px 6px; border-radius: var(--r-s); display: flex; flex-direction: column; }
.pb-col:hover { background: color-mix(in srgb, var(--bg-3) 35%, transparent); }
.pb-col-blocks { display: flex; flex-direction: column; min-width: 0; }
.pb-col-blocks .pb-row { padding-left: 22px; }
.pb-col-blocks .pb-ctrl { left: -2px; flex-direction: column; gap: 0; }
.pb-col-blocks .pb-add, .pb-col-blocks .pb-handle { width: 20px; height: 18px; font-size: 12px; }
.pb-col-addblk { align-self: flex-start; margin-top: 2px; background: transparent; border: none; color: var(--ink-faint); cursor: pointer; font-size: 11px; padding: 3px 4px; border-radius: var(--r-s); opacity: 0; transition: opacity .12s; }
.pb-col:hover .pb-col-addblk { opacity: 1; }
.pb-col-addblk:hover { color: var(--ink); background: var(--bg-3); }
.pb-col-edit { outline: none; min-height: 24px; line-height: 1.55; }
.pb-col-edit:empty::before { content: attr(data-ph); color: var(--ink-faint); }
.pb-colsep { flex: 0 0 auto; width: 11px; margin: 0 1px; cursor: col-resize; position: relative; touch-action: none; }
.pb-colsep::after { content: ""; position: absolute; left: 50%; top: 2px; bottom: 2px; width: 2px; border-radius: 2px; background: color-mix(in srgb, var(--ink-faint) 55%, var(--line-2)); transform: translateX(-50%); transition: background .15s, width .15s; }
.pb-colsep:hover::after, .pb-colsep.on::after { background: var(--accent); width: 3px; }
.pb-col-del { position: absolute; top: 0; right: 2px; background: transparent; border: none; color: var(--ink-faint); cursor: pointer; font-size: 13px; line-height: 1; opacity: 0; padding: 2px 4px; }
.pb-col:hover .pb-col-del { opacity: 1; }
.pb-col-del:hover { color: var(--koi); }
.pb-col-add { align-self: center; margin-left: 6px; background: var(--bg-3); border: 1px dashed var(--line); color: var(--ink-dim); border-radius: var(--r-s); padding: 4px 9px; cursor: pointer; font-size: 11px; white-space: nowrap; }
.pb-col-add:hover { border-color: var(--accent); color: var(--ink); }
/* Colonne nella Wiki */
.wk-cols { display: flex; align-items: stretch; gap: 0; margin: 12px 0; }
.wk-col { min-width: 0; padding: 0 14px; }
.wk-col:first-child { padding-left: 0; }
.wk-colsep { flex: 0 0 1px; background: var(--line); margin: 2px 0; }
.pb-img-url { width: 100%; background: var(--bg-0); border: 1px dashed var(--line-2); color: var(--ink); border-radius: var(--r-m); padding: 12px 14px; font-size: 13px; outline: none; box-sizing: border-box; transition: border-color .12s; }
.pb-img-url:hover { border-color: var(--lav-2); }
.pb-img-url:focus { border-style: solid; border-color: var(--accent); }
.pb-att-url:hover { border-color: var(--lav-2); }
.slash-menu { max-height: 320px; overflow-y: auto; }
.slash-item { display: flex; align-items: center; gap: 9px; }
.slash-ic { width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; background: var(--bg-3); border-radius: 5px; font-size: 12px; font-family: var(--font-mono); color: var(--ink-soft); flex: none; }
.slash-ic .bic svg { width: 16px; height: 16px; }
.tw-priv { font-size: 10px; opacity: .7; }

/* ===== Account & autenticazione ===== */
.acc-btn { padding: 0 !important; }
.acc-ava { width: 24px; height: 24px; border-radius: 50%; background: var(--ac, #7f9a6f); color: #0a0c09; font-size: 10px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }
.acc-btn.logged .acc-ava { box-shadow: 0 0 0 2px var(--bg-1), 0 0 0 3px var(--ac); }
.acc-menu { min-width: 210px; }
.acc-head { display: flex; align-items: center; gap: 10px; padding: 8px 10px 6px; }
.acc-ava.big { width: 38px; height: 38px; font-size: 14px; flex: none; }
.acc-nm { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.acc-sub { font-size: 11px; color: var(--ink-dim); }
.acc-mode { padding: 2px 10px 8px; font-size: 11px; color: var(--ink-faint); }
.auth-modal { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; background: rgba(5,7,5,.6); backdrop-filter: blur(4px); }
.auth-panel { width: min(380px, 92vw); background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--r-l); box-shadow: var(--shadow); padding: 18px; animation: pop var(--t-med); }
.auth-head { display: flex; align-items: center; justify-content: space-between; font-weight: 700; font-size: 15px; color: var(--ink); margin-bottom: 12px; }
.auth-head .auth-x { background: transparent; border: none; color: var(--ink-dim); font-size: 20px; cursor: pointer; }
.auth-tabs { display: flex; gap: 4px; background: var(--bg-1); padding: 3px; border-radius: var(--r-m); margin-bottom: 12px; }
.auth-tab { flex: 1; background: transparent; border: none; color: var(--ink-dim); padding: 7px; border-radius: var(--r-s); cursor: pointer; font-size: 12.5px; }
.auth-tab.on { background: var(--bg-3); color: var(--ink); }
.auth-panel .field { margin-bottom: 10px; }
.auth-panel .field label { display: block; font-size: 11px; color: var(--ink-dim); margin-bottom: 4px; }
.auth-panel .field input { width: 100%; background: var(--bg-0); border: 1px solid var(--line-2); color: var(--ink); border-radius: var(--r-s); padding: 9px 11px; font-size: 13px; outline: none; box-sizing: border-box; }
.auth-panel .field input:focus { border-color: var(--accent); }
.auth-panel .field input:disabled { color: var(--ink-dim); }
.auth-err { color: var(--koi); font-size: 12px; min-height: 0; margin-bottom: 8px; display: none; }
.auth-err.on { display: block; }
.auth-go { width: 100%; background: var(--accent-soft); border: 1px solid var(--accent); color: var(--ink); border-radius: var(--r-m); padding: 10px; cursor: pointer; font-size: 13.5px; font-weight: 600; }
.auth-go:hover { background: color-mix(in srgb, var(--accent) 28%, transparent); }
.auth-go:disabled { opacity: .6; cursor: default; }
.auth-note { margin-top: 12px; font-size: 11px; line-height: 1.5; color: var(--ink-dim); background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--r-m); padding: 9px 11px; }
.auth-note b { color: var(--ink-soft); }
.prof-preview { display: flex; align-items: center; gap: 12px; padding: 4px 0 12px; }
.prof-preview .acc-ava.big { width: 46px; height: 46px; font-size: 20px; }
.prof-prev-nm { font-size: 15px; font-weight: 600; color: var(--ink); }
.prof-prev-nm .acc-sub { font-weight: 400; }
.ava-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 5px; }
.ava-opt { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; background: var(--bg-0); border: 1px solid var(--line); border-radius: var(--r-s); cursor: pointer; font-size: 17px; color: var(--ink-soft); padding: 0; }
.ava-opt:hover { border-color: var(--line-2); background: var(--bg-3); }
.ava-opt.on { border-color: var(--accent); background: var(--accent-soft); }
.acc-ava { font-size: 12px; }

/* ===== Notifiche ===== */
.notif-btn[data-count]:not([data-count=""])::after { content: attr(data-count); position: absolute; top: 1px; right: 0; min-width: 14px; height: 14px; padding: 0 3px; box-sizing: border-box; background: var(--koi); color: #0a0c09; font-size: 9px; font-weight: 800; line-height: 14px; text-align: center; border-radius: 8px; box-shadow: 0 0 0 2px var(--bg-1); }
.notif-panel { position: fixed; z-index: 200; width: 320px; max-height: 70vh; overflow-y: auto; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--r-l); box-shadow: var(--shadow); animation: pop var(--t-fast); }
.notif-head { padding: 11px 14px; font-weight: 700; font-size: 13.5px; color: var(--ink); border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg-2); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.notif-os { background: var(--bg-3); border: 1px solid var(--line); color: var(--ink-soft); border-radius: 12px; padding: 3px 9px; font-size: 10.5px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.notif-os:hover { border-color: var(--accent); color: var(--ink); }
.notif-os.on { background: var(--accent-soft); border-color: var(--accent); color: var(--lav-2); }
.notif-empty { padding: 28px 16px; text-align: center; color: var(--ink-dim); font-size: 12.5px; line-height: 1.6; }
.notif-list { padding: 6px; }
.notif-item { display: flex; gap: 10px; align-items: flex-start; padding: 9px 10px; border-radius: var(--r-s); cursor: pointer; }
.notif-item:hover { background: var(--bg-3); }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex: none; background: var(--ink-dim); }
.notif-item.overdue .notif-dot { background: var(--koi); }
.notif-item.due .notif-dot { background: var(--gold); }
.notif-item.assigned .notif-dot { background: var(--accent); }
.notif-item.new { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.notif-b { min-width: 0; flex: 1; }
.notif-t { font-size: 13px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notif-me { font-size: 9.5px; background: var(--accent-soft); color: var(--lav-2); border-radius: 8px; padding: 0 6px; margin-left: 4px; }
.notif-s { font-size: 11px; color: var(--ink-dim); margin-top: 1px; }
.notif-item.overdue .notif-s { color: var(--koi); }
.notif-item.mention .notif-dot { background: var(--lav); }
.notif-item.mention .notif-me { background: color-mix(in srgb, var(--lav) 30%, transparent); }

/* indicatore conversazione 💬 sull'oggetto del canvas */
.node-chat-ind { position: absolute; top: -9px; right: -9px; z-index: 6; display: inline-flex; align-items: center; gap: 1px; font-size: 10px; line-height: 1; color: var(--ink-dim); background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 3px 7px; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.4); user-select: none; }
.node-chat-ind b { font-weight: 700; font-size: 10px; }
.node-chat-ind:hover { background: var(--bg-3); color: var(--ink); }
.node-chat-ind.unread { border-color: var(--koi); color: var(--gold); background: color-mix(in srgb, var(--koi) 16%, var(--bg-2)); }
.node-chat-ind .ncd-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--koi); margin-left: 2px; box-shadow: 0 0 0 2px var(--bg-2); }

/* menzione @membro nella chat */
.chat-mention { color: var(--lav-2); background: color-mix(in srgb, var(--accent) 24%, transparent); border-radius: 5px; padding: 0 4px; font-weight: 600; }

/* ===== Ruoli · presenza · follow ===== */
#roster .rost-role { font-size: 9px; text-transform: uppercase; letter-spacing: .05em; color: var(--lav-2); background: var(--accent-soft); border-radius: 8px; padding: 1px 6px; }
#roster .rost-peer { cursor: pointer; border-radius: 10px; padding: 2px 6px; transition: background var(--t-fast); }
#roster .rost-peer:hover { background: var(--bg-3); color: var(--ink); }
#roster .rost-peer.following { background: var(--accent-soft); color: var(--ink); box-shadow: inset 0 0 0 1px var(--accent); }
#roster .rost-present, #roster .rost-unfollow { background: var(--bg-3); border: 1px solid var(--line); color: var(--ink-soft); border-radius: 12px; padding: 3px 10px; cursor: pointer; font-size: 11px; white-space: nowrap; }
#roster .rost-present:hover { background: var(--accent-soft); color: var(--ink); border-color: var(--accent); }
#roster .rost-unfollow:hover { background: rgba(207,127,58,.14); color: var(--koi); border-color: rgba(207,127,58,.35); }
#roster .rost-react { display: inline-flex; align-items: center; gap: 1px; padding-left: 8px; margin-left: 4px; border-left: 1px solid var(--line); }
#roster .rr-emoji, #roster .rr-ping { background: transparent; border: none; cursor: pointer; font-size: 14px; line-height: 1; padding: 3px 3px; border-radius: 6px; opacity: .85; }
#roster .rr-emoji:hover, #roster .rr-ping:hover { background: var(--bg-3); opacity: 1; transform: scale(1.18); }
#roster .rr-ping { margin-left: 3px; }

#followBanner { position: absolute; top: 56px; left: 50%; transform: translateX(-50%); z-index: 29; display: flex; align-items: center; gap: 12px; background: color-mix(in srgb, var(--lav) 22%, var(--bg-2)); border: 1px solid var(--accent); border-radius: 20px; padding: 6px 8px 6px 16px; box-shadow: 0 6px 22px rgba(0,0,0,.4); backdrop-filter: blur(6px); font-size: 12px; color: var(--ink); animation: pop var(--t-fast); }
#followBanner.hidden { display: none; }
#followBanner b { color: var(--ink); }
#followBanner .fb-stop { background: var(--bg-3); border: 1px solid var(--line); color: var(--ink-soft); border-radius: 12px; padding: 3px 10px; cursor: pointer; font-size: 11px; }
#followBanner .fb-stop:hover { background: rgba(207,127,58,.14); color: var(--koi); border-color: rgba(207,127,58,.35); }

#roBadge { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); z-index: 29; background: color-mix(in srgb, var(--koi) 18%, var(--bg-2)); border: 1px solid color-mix(in srgb, var(--koi) 55%, var(--line)); color: var(--gold); border-radius: 18px; padding: 6px 16px; font-size: 11.5px; box-shadow: 0 6px 22px rgba(0,0,0,.4); backdrop-filter: blur(6px); pointer-events: none; }
#roBadge.hidden { display: none; }
/* sola visualizzazione: smorza gli strumenti di creazione (resta attivo solo seleziona/mano) */
#app.read-only .tool:not([data-tool="select"]):not([data-tool="pan"]) { opacity: .38; }

/* ===== Membri · selezione ruolo ===== */
.pm-members-menu { min-width: 230px; }
.pm-mem { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: var(--r-s); }
.pm-mem .pm-mem-name { flex: 1; min-width: 0; font-size: 13px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm-mem-you { font-size: 9px; color: var(--lav-2); background: var(--accent-soft); border-radius: 7px; padding: 0 5px; }
.pm-mem-dot { color: var(--moss-2); font-size: 9px; }
.pm-mem-role { font-size: 10px; padding: 1px 7px; border-radius: 9px; background: var(--bg-1); color: var(--ink-dim); border: 1px solid var(--line); }
.pm-mem-role.role-owner { color: var(--gold); border-color: color-mix(in srgb, var(--gold) 40%, var(--line)); }
.pm-mem-role.role-admin { color: var(--lav-2); border-color: var(--accent); }
.pm-mem-role.role-guest { color: var(--ink-faint); }
.pm-role-sel { background: var(--bg-1); border: 1px solid var(--line-2); color: var(--ink-soft); border-radius: 8px; padding: 3px 6px; font-size: 11px; cursor: pointer; outline: none; }
.pm-role-sel:focus { border-color: var(--accent); }
.pm-role-sel option { background: var(--bg-3); color: var(--ink); }
.pm-mem-load { background: transparent; border: none; cursor: pointer; font-size: 13px; opacity: .65; padding: 2px 4px; border-radius: 6px; }
.pm-mem-load:hover { opacity: 1; background: var(--bg-3); }

/* ===== Carico di lavoro / contributo ===== */
.wl-panel { width: min(540px, 94vw); }
.wl-role { font-size: 10px; padding: 1px 8px; border-radius: 9px; background: var(--accent-soft); color: var(--lav-2); margin-left: 4px; }
.wl-role.role-owner { color: var(--gold); background: color-mix(in srgb, var(--gold) 16%, transparent); }
.wl-role.role-guest { color: var(--ink-faint); background: var(--bg-1); }
.wl-body { padding: 16px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; }
.wl-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.wl-stat { background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--r-m); padding: 10px 6px; text-align: center; }
.wl-stat.bad { border-color: color-mix(in srgb, var(--koi) 55%, var(--line)); background: rgba(207,127,58,.1); }
.wl-stat .wl-n { font-size: 20px; font-weight: 800; color: var(--ink); }
.wl-stat.bad .wl-n { color: var(--koi); }
.wl-stat .wl-l { font-size: 10px; color: var(--ink-dim); text-transform: uppercase; letter-spacing: .04em; margin-top: 2px; }
.wl-prog { display: flex; flex-direction: column; gap: 5px; }
.wl-prog-bar { height: 9px; background: var(--bg-1); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.wl-prog-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--moss), var(--moss-2)); border-radius: 6px; transition: width var(--t-med); }
.wl-prog-lbl { font-size: 11px; color: var(--ink-dim); }
.wl-sec { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); margin-top: 2px; }
.wl-proj { font-size: 12px; color: var(--moss-2); font-weight: 600; margin: 8px 0 3px; }
.wl-task { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border-radius: var(--r-s); cursor: pointer; }
.wl-task:hover { background: var(--bg-3); }
.wl-task.overdue { background: rgba(207,127,58,.07); }
.wl-task .wl-st { font-size: 9.5px; padding: 1px 7px; border-radius: 8px; background: color-mix(in srgb, var(--sc) 22%, transparent); color: var(--sc); border: 1px solid color-mix(in srgb, var(--sc) 45%, transparent); flex: none; }
.wl-task .wl-tt { flex: 1; min-width: 0; font-size: 13px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wl-task .wl-due { font-size: 11px; color: var(--ink-dim); }
.wl-task.overdue .wl-due { color: var(--koi); }
.wl-task .wl-hrs { font-size: 10.5px; color: var(--ink-faint); background: var(--bg-1); border-radius: 7px; padding: 1px 6px; }
.wl-empty { padding: 22px; text-align: center; color: var(--ink-dim); font-size: 13px; }
.pm-d-mail, .wl-mail, .pm-d-chat { background: var(--bg-3); border: 1px solid var(--line); color: var(--ink-soft); border-radius: var(--r-m); padding: 7px 12px; cursor: pointer; font-size: 12.5px; }
.pm-d-mail:hover, .wl-mail:hover, .pm-d-chat:hover { border-color: var(--accent); color: var(--ink); }
/* indicatore "conversazione presente" sulla riga del task */
.pm-chat-ind { display: inline-flex; align-items: center; gap: 2px; font-size: 11px; color: var(--ink-dim); background: var(--bg-1); border-radius: 9px; padding: 1px 7px; cursor: pointer; }
.pm-chat-ind b { font-weight: 700; font-size: 10px; }
.pm-chat-ind:hover { background: var(--bg-3); color: var(--ink); }
.pm-chat-ind.unread { color: var(--gold); background: color-mix(in srgb, var(--koi) 22%, transparent); }
.pm-att-ind { display: inline-flex; align-items: center; font-size: 11px; color: var(--moss-2); background: color-mix(in srgb, var(--moss) 16%, transparent); border-radius: 9px; padding: 1px 7px; }

/* ===== Allegati / embed (condivisi: task + documenti) ===== */
.att-media { position: relative; border-radius: var(--r-m); overflow: hidden; background: var(--bg-0); border: 1px solid var(--line); margin: 2px 0; }
.att-media img { display: block; width: 100%; max-height: 360px; object-fit: contain; background: #000; }
.att-media video { display: block; width: 100%; max-height: 360px; background: #000; }
.att-media audio { display: block; width: 100%; }
.att-embed, .att-pdf { aspect-ratio: 16/9; }
.att-embed iframe, .att-pdf iframe { width: 100%; height: 100%; border: 0; display: block; }
.att-pdf { aspect-ratio: 4/5; }
.att-blocked { padding: 18px; text-align: center; color: var(--ink-dim); font-size: 13px; }
.att-blocked a { color: var(--lav-2); }
.att-blocked small { color: var(--ink-faint); font-size: 11px; }
.att-file { display: flex; align-items: center; gap: 10px; background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--r-m); padding: 9px 11px; }
.att-file .att-ic { font-size: 20px; flex: none; width: 26px; text-align: center; }
.att-fmeta { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.att-name { font-size: 13px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-sub { font-size: 10.5px; color: var(--ink-dim); text-transform: uppercase; letter-spacing: .03em; }
.att-open { font-size: 11.5px; color: var(--lav-2); text-decoration: none; background: var(--accent-soft); border-radius: 8px; padding: 4px 9px; flex: none; }
.att-open:hover { background: color-mix(in srgb, var(--accent) 28%, transparent); }

/* blocchi pagina: embed / file */
.pb-att-empty { flex: 1; display: flex; gap: 6px; align-items: center; }
.pb-att-url { flex: 1; background: var(--bg-0); border: 1px dashed var(--line-2); color: var(--ink); border-radius: var(--r-m); padding: 9px 12px; font-size: 13px; outline: none; }
.pb-att-url:focus { border-style: solid; border-color: var(--accent); }
.pb-att-file { background: var(--bg-3); border: 1px solid var(--line); color: var(--ink-soft); border-radius: var(--r-m); padding: 8px 11px; cursor: pointer; font-size: 12.5px; white-space: nowrap; }
.pb-att-file:hover { border-color: var(--accent); color: var(--ink); }
.pb-att { flex: 1; min-width: 0; }
.pb-att-bar { display: flex; gap: 6px; margin-top: 5px; }
.pb-att-bar button { background: var(--bg-3); border: 1px solid var(--line); color: var(--ink-dim); border-radius: var(--r-s); padding: 3px 9px; cursor: pointer; font-size: 11px; }
.pb-att-bar button:hover { color: var(--ink); border-color: var(--line-2); }

/* allegati nel dettaglio task */
.pm-att-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.pm-att-empty-h { font-size: 12px; color: var(--ink-faint); padding: 4px 0; }
.pm-att-item { position: relative; }
.pm-att-ctrl { display: flex; gap: 5px; margin-top: 4px; }
.pm-att-ctrl button { background: var(--bg-3); border: 1px solid var(--line); color: var(--ink-dim); border-radius: var(--r-s); padding: 3px 9px; cursor: pointer; font-size: 11px; }
.pm-att-ctrl button:hover { color: var(--ink); border-color: var(--line-2); }
.pm-att-types { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 7px; }
.pm-att-types button { background: var(--bg-3); border: 1px solid var(--line); color: var(--ink-soft); border-radius: var(--r-s); padding: 6px 10px; cursor: pointer; font-size: 12px; }
.pm-att-types button:hover { border-color: var(--accent); color: var(--ink); background: var(--accent-soft); }
.md-bar .md-mode { background: var(--accent-soft); border-color: var(--accent); color: var(--lav-2); font-weight: 600; white-space: nowrap; }
.pm-att-add { display: flex; gap: 6px; margin-bottom: 4px; }
.pm-att-add .pm-att-url { flex: 1; min-width: 0; background: var(--bg-0); border: 1px solid var(--line); color: var(--ink); border-radius: var(--r-s); padding: 7px 9px; font-size: 12.5px; outline: none; }
.pm-att-add .pm-att-url:focus { border-color: var(--accent); }
.pm-att-add .pm-att-file { background: var(--bg-3); border: 1px solid var(--line); color: var(--ink-soft); border-radius: var(--r-s); padding: 0 11px; cursor: pointer; font-size: 12px; white-space: nowrap; }
.pm-att-add .pm-att-file:hover { border-color: var(--accent); color: var(--ink); }

/* ===== Modelli 3D (Blockbench) — viewer CSS-3D ===== */
.att-m3d { background: transparent; border: 0; }
.m3d-mount { width: 100%; }
.m3d-stage { position: relative; width: 100%; height: 320px; background: radial-gradient(circle at 50% 38%, var(--bg-1), var(--bg-0)); perspective: 1300px; overflow: hidden; cursor: grab; touch-action: none; border-radius: var(--r-m); border: 1px solid var(--line); user-select: none; }
.m3d-stage.dragging { cursor: grabbing; }
.m3d-world { position: absolute; left: 50%; top: 50%; transform-style: preserve-3d; will-change: transform; }
.m3d-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.m3d-cube, .m3d-box, .m3d-bone { position: absolute; left: 0; top: 0; transform-style: preserve-3d; }
.m3d-face { position: absolute; left: 0; top: 0; overflow: hidden; backface-visibility: hidden; outline: 0.5px solid rgba(0,0,0,.12); }
.m3d-tex { width: 100%; height: 100%; background-repeat: no-repeat; transform-origin: center; }
.m3d-ctrls { position: absolute; right: 8px; bottom: 8px; display: flex; gap: 4px; z-index: 3; flex-wrap: wrap; justify-content: flex-end; max-width: 92%; padding: 4px; border-radius: 11px; background: color-mix(in srgb, var(--bg-0) 62%, transparent); backdrop-filter: blur(4px); border: 1px solid var(--line); }
.m3d-ctrls button { background: color-mix(in srgb, var(--bg-2) 92%, transparent); border: 1px solid var(--line); color: var(--ink-soft); border-radius: 7px; padding: 4px 8px; font-size: 11px; cursor: pointer; }
.m3d-ctrls button:hover { color: var(--ink); border-color: var(--accent); }
.m3d-cam { background: color-mix(in srgb, var(--bg-2) 86%, transparent); border: 1px solid var(--line); color: var(--ink-soft); border-radius: 7px; padding: 4px 6px; font-size: 11px; cursor: pointer; font-family: var(--font-ui); }
.m3d-cam:hover { color: var(--ink); border-color: var(--accent); }
.m3d-cam option { background: var(--bg-2); color: var(--ink); }
.m3d-hud { position: absolute; left: 8px; top: 8px; z-index: 3; pointer-events: none; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.m3d-badge { font-size: 11px; font-weight: 600; color: var(--lav-2); background: color-mix(in srgb, var(--accent) 22%, var(--bg-2)); border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); padding: 2px 9px; border-radius: 9px; }
.m3d-info { font-size: 10.5px; color: var(--ink-dim); background: color-mix(in srgb, var(--bg-2) 70%, transparent); padding: 2px 8px; border-radius: 8px; }
.m3d-stage.m3d-notex { background-image: radial-gradient(circle at 50% 38%, var(--bg-1), var(--bg-0)), repeating-conic-gradient(rgba(255,255,255,.03) 0deg 90deg, transparent 90deg 180deg); background-size: cover, 18px 18px; }
.m3d-fail { padding: 28px; text-align: center; color: var(--ink-dim); font-size: 13px; background: var(--bg-1); border-radius: var(--r-m); border: 1px dashed var(--line-2); }
/* controlli a icone SVG */
.m3d-ctrls button svg { width: 15px; height: 15px; display: block; }
.m3d-ctrls button { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; padding: 5px 6px; }
.m3d-ctrls button.on { color: var(--ink); background: var(--accent-soft); border-color: var(--accent); }
.m3d-stage.m3d-noctrls .m3d-ctrls { display: none; }
.m3d-stage.m3d-nohud .m3d-hud { display: none; }
/* visualizzatore 3D a schermo intero (orbita + WASD) */
.m3d-fs { position: fixed; inset: 0; z-index: 250; background: rgba(4,6,5,.96); display: flex; flex-direction: column; animation: fade var(--t-fast); }
.m3d-fs-head { display: flex; align-items: center; gap: 14px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.m3d-fs-name { font-weight: 700; font-size: 15px; color: var(--ink); }
.m3d-fs-hint { flex: 1; font-size: 11.5px; color: var(--ink-faint); }
.m3d-fs-hint b { color: var(--lav-2); }
.m3d-fs-x { background: transparent; border: none; color: var(--ink-dim); font-size: 20px; line-height: 1; cursor: pointer; }
.m3d-fs-x:hover { color: var(--ink); }
.m3d-fs-body { flex: 1; min-height: 0; padding: 16px; display: flex; gap: 14px; }
.m3d-fs-main { flex: 1; min-width: 0; display: flex; }
.m3d-fs-stage { flex: 1; height: auto !important; border-radius: var(--r-l); border: 1px solid var(--line); }
.m3d-stage.m3d-locked { cursor: default; }
/* storico versioni (preview a schermo intero) */
.m3d-fs-side { flex: 0 0 280px; display: flex; flex-direction: column; background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--r-l); overflow: hidden; }
.m3d-fs-side-h { display: flex; align-items: center; gap: 8px; padding: 11px 13px; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 13px; }
.vh-snap { margin-left: auto; background: var(--accent-soft); border: 1px solid var(--accent); color: var(--ink); border-radius: var(--r-s); padding: 4px 9px; cursor: pointer; font-size: 11.5px; font-weight: 600; }
.vh-snap:hover { background: color-mix(in srgb, var(--accent) 30%, transparent); }
.vh-list { flex: 1; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.vh-item { border: 1px solid var(--line); border-radius: var(--r-m); padding: 8px 9px; cursor: pointer; transition: border-color .12s, background .12s; }
.vh-item:hover { background: var(--bg-3); }
.vh-item.on { border-color: var(--accent); background: var(--accent-soft); }
.vh-top { display: flex; align-items: center; gap: 7px; font-size: 12.5px; }
.vh-top b { color: var(--ink); }
.vh-when { color: var(--ink-faint); font-size: 11px; margin-left: 2px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vh-restore { background: transparent; border: 1px solid var(--line-2); color: var(--ink-dim); border-radius: var(--r-s); cursor: pointer; font-size: 13px; line-height: 1; padding: 2px 7px; flex: none; }
.vh-restore:hover { border-color: var(--accent); color: var(--ink); }
.vh-note { width: 100%; margin-top: 6px; background: var(--bg-0); border: 1px solid var(--line); color: var(--ink-soft); border-radius: var(--r-s); padding: 4px 7px; font-size: 11.5px; outline: none; }
.vh-note:focus { border-color: var(--accent); }
.vh-acts { display: flex; gap: 5px; margin-top: 7px; }
.vh-acts button { flex: 1; background: var(--bg-3); border: 1px solid var(--line); color: var(--ink-soft); border-radius: var(--r-s); padding: 4px 0; cursor: pointer; font-size: 13px; line-height: 1; transition: var(--t-fast); }
.vh-acts button:hover { border-color: var(--accent); color: var(--ink); background: var(--bg-4); }
.vh-chatall { background: var(--bg-3); border: 1px solid var(--line); color: var(--ink-soft); border-radius: var(--r-s); padding: 3px 8px; cursor: pointer; font-size: 13px; line-height: 1; }
.vh-chatall:hover { border-color: var(--accent); color: var(--ink); }

/* nodo "Modello 3D" sul canvas */
.node.model .nbody.mdbody { padding: 0; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.node.model .mdbody .att-media { flex: 1; min-height: 0; margin: 0; border: 0; border-radius: 0; display: flex; }
.node.model .mdbody .att-m3d { flex: 1; min-height: 0; display: flex; }
.node.model .mdbody .m3d-mount { flex: 1; min-height: 0; display: flex; }
.node.model .mdbody .m3d-stage { flex: 1; min-height: 0; height: auto; border: 0; border-radius: 0; }
.node.model .mdbody .att-file { flex: none; margin: 8px; }
.md-node-bar { display: flex; gap: 4px; flex-wrap: wrap; padding: 5px; border-top: 1px solid var(--line); background: var(--bg-1); flex: none; }
.md-node-bar button { background: var(--bg-3); border: 1px solid var(--line); color: var(--ink-soft); border-radius: var(--r-s); padding: 4px 8px; cursor: pointer; font-size: 11px; }
.md-node-bar button:hover { border-color: var(--accent); color: var(--ink); }
.mdn-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px; padding: 16px; text-align: center; color: var(--ink-dim); }
.mdn-empty-ic svg { width: 38px; height: 38px; color: var(--lav-2); opacity: .8; }
.mdn-empty span { font-size: 12.5px; }
.mdn-empty button { background: var(--accent-soft); border: 1px solid var(--accent); color: var(--lav-2); border-radius: var(--r-m); padding: 8px 12px; cursor: pointer; font-size: 12.5px; display: inline-flex; align-items: center; }
/* anteprima = screenshot della posa (reso da Blockbench) */
.node.model .mdbody.md-posed { padding: 0; }
.md-pose { position: relative; flex: 1; min-height: 0; display: flex; }
.md-pose-img { width: 100%; height: 100%; object-fit: contain; display: block; }
.md-pose-bar { position: absolute; left: 0; right: 0; bottom: 0; padding: 5px 9px; font-size: 10.5px; color: var(--ink-faint); background: linear-gradient(transparent, color-mix(in srgb, var(--bg-0) 80%, transparent)); text-align: center; pointer-events: none; }
.md-pose-bar-cta { position: absolute; left: 0; right: 0; bottom: 0; }
.node.model .mdbody.md-noview { padding: 0; }
.md-pose-empty { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 16px; text-align: center; background: radial-gradient(circle at 50% 35%, var(--bg-1), var(--bg-0)); cursor: pointer; }
.md-pose-empty .mdn-empty-ic svg { width: 34px; height: 34px; color: var(--lav-2); opacity: .85; }
.md-pose-name { font-size: 13px; font-weight: 700; color: var(--ink); }
.md-pose-hint { font-size: 11px; color: var(--ink-faint); line-height: 1.55; }
.md-pose-hint b { color: var(--ink-soft); }
/* pulsante "Apri in Blockbench" sull'anteprima (sostituisce il vecchio testo "doppio clic") */
.md-pose-open { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; padding: 0; border-radius: var(--r-s); border: 1px solid var(--line-2); background: color-mix(in srgb, var(--bg-0) 72%, transparent); color: var(--ink); font-size: 14px; line-height: 1; cursor: pointer; opacity: 0; transition: opacity var(--t-fast), border-color var(--t-fast); backdrop-filter: blur(3px); }
.node.model:hover .md-pose-open { opacity: .9; }
.md-pose-open:hover { opacity: 1; border-color: var(--accent); }
.md-pose-tag { position: absolute; left: 6px; bottom: 6px; max-width: 70%; padding: 2px 8px; border-radius: 999px; font-size: 10.5px; color: var(--ink); background: color-mix(in srgb, var(--bg-0) 78%, transparent); border: 1px solid var(--line); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; pointer-events: none; }
.md-pose-openbtn { background: var(--accent-soft); border: 1px solid var(--accent); color: var(--lav-2); border-radius: var(--r-m); padding: 8px 13px; font-size: 12.5px; cursor: pointer; font-weight: 600; }
.md-pose-openbtn:hover { filter: brightness(1.1); }
/* varianti (stessa geometria, texture diverse) */
.md-var-bar { display: flex; gap: 4px; flex-wrap: wrap; padding: 5px 6px; border-top: 1px solid var(--line); background: var(--bg-1); flex: none; align-items: center; }
.md-var-chip { background: var(--bg-3); border: 1px solid var(--line); color: var(--ink-soft); border-radius: 9px; padding: 2px 9px; cursor: pointer; font-size: 10.5px; max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.md-var-chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--ink); }
.md-var-chip:hover { color: var(--ink); }
.md-var-add { background: transparent; border: 1px dashed var(--line-2); color: var(--ink-dim); border-radius: 9px; width: 22px; height: 20px; cursor: pointer; font-size: 12px; line-height: 1; }
.md-var-add:hover { border-color: var(--accent); color: var(--ink); }
.insp-subtitle { font-size: 11px; font-weight: 700; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .4px; margin: 12px 0 6px; }
.ispvar-list { display: flex; flex-direction: column; gap: 5px; margin-bottom: 8px; }
.ispvar { display: flex; align-items: center; gap: 5px; border: 1px solid var(--line); border-radius: var(--r-s); padding: 4px 6px; }
.ispvar.on { border-color: var(--accent); background: var(--accent-soft); }
.ispvar-sel { background: transparent; border: none; color: var(--lav-2); cursor: pointer; font-size: 13px; flex: none; }
.ispvar-name { flex: 1; min-width: 0; background: transparent; border: none; color: var(--ink); font-size: 12.5px; outline: none; }
.ispvar-tex, .ispvar-del { background: transparent; border: none; cursor: pointer; font-size: 13px; flex: none; color: var(--ink-dim); padding: 0 3px; }
.ispvar-tex:hover { color: var(--ink); } .ispvar-del:hover { color: var(--koi); }
/* pulsante cattura posa + dropzone nella finestra Blockbench */
.bb-acts .bb-pose { background: var(--moss); border-color: var(--moss); color: #0a0c09; font-weight: 700; }
.bb-acts .bb-pose:hover { filter: brightness(1.08); }
.bb-head.bb-drop { outline: 2px dashed var(--accent); outline-offset: -4px; }

/* ===== Tabella / Database (condivisa: canvas · pagine · task) ===== */
.dbt-wrap { width: 100%; }
.dbt-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-m); }
.dbt { border-collapse: collapse; width: 100%; font-size: 12.5px; }
.dbt th, .dbt td { border: 1px solid var(--line); padding: 0; vertical-align: middle; }
.dbt th { background: var(--bg-1); position: sticky; top: 0; }
.dbt-h { display: flex; align-items: center; gap: 3px; padding: 2px 4px; }
.dbt-tname { font-size: 9.5px; color: var(--ink-faint); width: 14px; text-align: center; flex: none; }
.dbt-hname { flex: 1; min-width: 50px; width: 50px; background: transparent; border: none; color: var(--ink); font-weight: 600; font-size: 12px; outline: none; padding: 3px 2px; }
.dbt-hmenu { background: transparent; border: none; color: var(--ink-dim); cursor: pointer; opacity: 0; padding: 0 3px; font-size: 13px; line-height: 1; flex: none; }
.dbt th:hover .dbt-hmenu { opacity: 1; }
.dbt-addcol { width: 30px; text-align: center; color: var(--ink-dim); cursor: pointer; font-size: 16px; }
.dbt-addcol:hover { color: var(--lav-2); background: var(--bg-3); }
.dbt-cell { width: 100%; box-sizing: border-box; background: transparent; border: none; color: var(--ink); font-size: 12.5px; padding: 5px 7px; outline: none; font-family: var(--font-ui); }
.dbt-cell:focus { background: var(--accent-soft); }
.dbt-chk { width: auto; display: block; margin: 4px auto; cursor: pointer; accent-color: var(--accent); }
.dbt-sel { cursor: pointer; appearance: none; }
.dbt-sel option { background: var(--bg-3); color: var(--ink); }
.dbt-rowact { width: 24px; text-align: center; }
.dbt-delrow { background: transparent; border: none; color: var(--ink-faint); cursor: pointer; opacity: 0; font-size: 14px; line-height: 1; padding: 4px; }
.dbt tr:hover .dbt-delrow { opacity: 1; }
.dbt-delrow:hover { color: var(--koi); }
.dbt-pill { display: inline-block; margin: 4px 6px; font-size: 11px; color: var(--pc, var(--lav-2)); background: color-mix(in srgb, var(--pc, var(--accent)) 20%, transparent); border-radius: 9px; padding: 1px 8px; }
.dbt-ro { padding: 5px 7px; display: block; color: var(--ink-soft); }
.dbt-foot { display: flex; align-items: center; gap: 10px; margin-top: 5px; }
.dbt-addrow { background: var(--bg-3); border: 1px solid var(--line); color: var(--ink-soft); border-radius: var(--r-s); padding: 5px 11px; cursor: pointer; font-size: 12px; }
.dbt-addrow:hover { border-color: var(--accent); color: var(--ink); }
.dbt-count { font-size: 10.5px; color: var(--ink-faint); }
/* nodo tabella sul canvas */
.node.table .nbody.tblbody { padding: 8px; overflow: auto; }
.node.table .dbt-scroll { max-height: 100%; }
/* tabella nelle pagine + task */
.pb-table { flex: 1; min-width: 0; }
.pm-table-host { margin-bottom: 8px; }
.pm-table-add, .pm-table-rm { display: inline-flex; align-items: center; background: var(--bg-3); border: 1px solid var(--line); color: var(--ink-soft); border-radius: var(--r-s); padding: 7px 11px; cursor: pointer; font-size: 12.5px; margin-top: 6px; }
.pm-table-add:hover { border-color: var(--accent); color: var(--ink); }
.pm-table-rm:hover { border-color: var(--koi); color: var(--koi); }
/* selettore viste (tabella / bacheca / calendario) */
.dbt-views { display: flex; align-items: center; gap: 10px; margin-bottom: 7px; flex-wrap: wrap; }
.dbt-vtabs { display: inline-flex; gap: 2px; background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--r-s); padding: 2px; }
.dbt-vtab { background: transparent; border: none; color: var(--ink-dim); cursor: pointer; font-size: 11.5px; padding: 4px 9px; border-radius: 6px; font-family: var(--font-ui); }
.dbt-vtab:hover { color: var(--ink); }
.dbt-vtab.on { background: var(--accent-soft); color: var(--ink); }
.dbt-by { font-size: 11px; color: var(--ink-faint); display: inline-flex; align-items: center; gap: 5px; }
.dbt-by select { background: var(--bg-1); border: 1px solid var(--line); color: var(--ink); border-radius: var(--r-s); padding: 3px 6px; font-size: 11.5px; font-family: var(--font-ui); }
.dbt-hint { padding: 16px; font-size: 12px; color: var(--ink-soft); background: var(--bg-1); border: 1px dashed var(--line); border-radius: var(--r-m); line-height: 1.5; }
.dbt-hint b { color: var(--lav-2); }
/* chip celle (board / calendario) */
.dbc-chk { font-size: 11px; color: var(--ink-faint); }
.dbc-chk.on { color: var(--moss); }
.dbc-date { font-size: 10.5px; color: var(--ink-soft); }
.dbc-txt { font-size: 11px; color: var(--ink-soft); }
/* vista BACHECA */
/* BACHECA della tabella con la grafica del Kanban (colonne arrotondate, carte con bordo colorato) */
.dbt-board { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; align-items: stretch; }
.dbb-col { flex: 0 0 190px; background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--r-m); display: flex; flex-direction: column; min-height: 60px; max-height: 100%; }
.dbb-col.dbb-over { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 0 18px rgba(155,142,196,.18); }
.dbb-col-h { display: flex; align-items: center; gap: 7px; padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 12px; font-weight: 600; }
.dbb-col-h .dbt-pill { padding: 2px 9px; }
.dbb-col-dot { width: 9px; height: 9px; border-radius: 3px; flex: 0 0 auto; box-shadow: inset 0 0 0 1px rgba(0,0,0,.25); }
.dbb-col-menu, .dbb-col-chat { margin-left: 2px; background: transparent; border: none; color: var(--ink-faint); cursor: pointer; font-size: 13px; line-height: 1; padding: 0 2px; border-radius: 4px; opacity: 0; transition: opacity var(--t-fast), background var(--t-fast); }
.dbb-col-chat { font-size: 12px; }
.dbb-col:hover .dbb-col-menu, .dbb-col:hover .dbb-col-chat { opacity: .8; }
.dbb-col-menu:hover, .dbb-col-chat:hover { background: var(--bg-3); color: var(--ink); opacity: 1; }
.dbb-addcol { flex: 0 0 150px; align-self: flex-start; margin-top: 0; background: transparent; border: 1px dashed var(--line-2); border-radius: var(--r-m); color: var(--ink-faint); cursor: pointer; font-size: 12px; padding: 9px 10px; font-family: var(--font-ui); transition: border-color var(--t-fast), color var(--t-fast); }
.dbb-addcol:hover { border-color: var(--accent); color: var(--ink); }
.bcm-colors { display: flex; flex-wrap: wrap; gap: 5px; padding: 6px 10px 8px; max-width: 170px; }
.bcm-sw { width: 17px; height: 17px; border-radius: 4px; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0,0,0,.3); transition: transform var(--t-fast); }
.bcm-sw:hover { transform: scale(1.18); }
.dbb-none { font-size: 11.5px; color: var(--ink-faint); }
.dbb-n { margin-left: auto; font-family: var(--font-mono); font-size: 12px; color: var(--ink-faint); }
.dbb-card { position: relative; margin: 7px 7px 0; background: var(--bg-3); border: 1px solid var(--line-2); border-left: 3px solid var(--cardc, var(--accent)); border-radius: 5px; padding: 8px 10px; cursor: grab; transition: border-color var(--t-fast), box-shadow var(--t-fast); }
.dbb-card:hover { border-color: var(--accent); }
.dbb-card.dbb-dragging { opacity: .5; cursor: grabbing; box-shadow: 0 8px 22px rgba(0,0,0,.45); }
body.dbb-grabbing, body.dbb-grabbing * { cursor: grabbing !important; }
.dbb-col.dbb-over { background: color-mix(in srgb, var(--accent) 8%, var(--bg-1)); }
.dbb-title { width: 100%; box-sizing: border-box; background: transparent; border: none; color: var(--ink); font-size: 12.5px; font-weight: 600; outline: none; font-family: var(--font-ui); padding: 0 18px 4px 0; }
.dbb-fields { display: flex; flex-wrap: wrap; gap: 3px; }
.dbb-del { position: absolute; top: 4px; right: 5px; background: transparent; border: none; color: var(--ink-faint); cursor: pointer; font-size: 15px; line-height: 1; padding: 0 3px; opacity: 0; transition: opacity var(--t-fast); }
.dbb-card:hover .dbb-del { opacity: .6; }
.dbb-del:hover { color: var(--koi); opacity: 1; }
.dbb-add { margin: 0 7px 8px; background: transparent; border: 1px dashed var(--line); color: var(--ink-dim); border-radius: var(--r-s); padding: 6px; cursor: pointer; font-size: 11.5px; }
.dbb-add:hover { border-color: var(--accent); color: var(--ink); }
/* DETTAGLIO CARTA-TASK (clic su una carta della bacheca) */
.tcard-modal { position: fixed; inset: 0; z-index: 240; display: flex; align-items: center; justify-content: center; background: rgba(5,7,5,.6); backdrop-filter: blur(4px); }
.tcard-panel { width: min(560px, 94vw); max-height: 88vh; display: flex; flex-direction: column; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--r-l); box-shadow: var(--shadow); animation: pop var(--t-med); }
.tcard-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.tcard-title { flex: 1; background: transparent; border: none; color: var(--ink); font-size: 16px; font-weight: 700; outline: none; }
.tcard-x { background: transparent; border: none; color: var(--ink-dim); font-size: 22px; cursor: pointer; line-height: 1; }
.tcard-x:hover { color: var(--ink); }
.tcard-body { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.tc-props { display: flex; flex-direction: column; gap: 7px; margin-bottom: 4px; }
.tc-row { display: flex; align-items: center; gap: 10px; }
.tc-k { flex: 0 0 110px; font-size: 12px; color: var(--ink-dim); }
.tc-row input, .tc-row select { flex: 1; background: var(--bg-0); border: 1px solid var(--line); color: var(--ink); border-radius: var(--r-s); padding: 6px 9px; font-size: 12.5px; font-family: var(--font-ui); }
.tc-check { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-soft); }
.tc-sec { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-faint); padding: 12px 0 5px; display: flex; align-items: center; gap: 8px; }
.tc-subn { color: var(--ink-dim); }
.tc-desc { width: 100%; min-height: 56px; }
.tc-subs { display: flex; flex-direction: column; gap: 4px; }
.tc-sub { display: flex; align-items: center; gap: 7px; }
.tc-sub-txt { flex: 1; background: transparent; border: none; border-bottom: 1px solid transparent; color: var(--ink); font-size: 12.5px; outline: none; padding: 3px 2px; }
.tc-sub-txt:focus { border-bottom-color: var(--line-2); }
.tc-sub-del { background: transparent; border: none; color: var(--ink-faint); cursor: pointer; font-size: 14px; opacity: 0; }
.tc-sub:hover .tc-sub-del { opacity: .6; }
.tc-sub-del:hover { color: var(--koi); opacity: 1; }
.tc-sub-add { align-self: flex-start; background: transparent; border: 1px dashed var(--line); color: var(--ink-dim); border-radius: var(--r-s); padding: 4px 10px; cursor: pointer; font-size: 11.5px; margin-top: 4px; }
.tc-sub-add:hover { border-color: var(--accent); color: var(--ink); }
.tcard-foot { display: flex; gap: 8px; padding: 11px 16px; border-top: 1px solid var(--line); }
.tcard-chat { background: var(--accent-soft); border: 1px solid var(--accent); color: var(--lav-2); border-radius: var(--r-s); padding: 7px 12px; cursor: pointer; font-size: 12.5px; }
.tcard-del { margin-left: auto; background: transparent; border: 1px solid var(--line); color: var(--ink-dim); border-radius: var(--r-s); padding: 7px 12px; cursor: pointer; font-size: 12.5px; }
.tcard-del:hover { border-color: var(--koi); color: var(--koi); }
/* colonna PERSONA (assegnatari con avatar) */
.dbt-person { display: inline-flex; align-items: center; gap: 1px; }
.dbt-person.edit { cursor: pointer; }
.dbt-person-empty { color: var(--ink-faint); font-size: 13px; padding: 0 4px; }
.dbt-person.edit:hover .dbt-person-empty { color: var(--accent); }
.dbc-people { display: inline-flex; align-items: center; }
.dbc-people .pm-ava, .dbt-person .pm-ava { width: 17px; height: 17px; font-size: 9px; }
.tc-person { display: inline-flex; align-items: center; gap: 2px; cursor: pointer; flex: 1; }
.tc-person-empty { color: var(--ink-dim); font-size: 12px; }
.tc-person:hover .tc-person-empty { color: var(--accent); }
/* vista CALENDARIO */
.dbcal { border: 1px solid var(--line); border-radius: var(--r-m); padding: 8px; }
.dbcal-head { display: flex; align-items: center; justify-content: center; gap: 14px; margin-bottom: 8px; }
.dbcal-title { font-size: 13px; color: var(--ink); font-weight: 600; text-transform: capitalize; min-width: 150px; text-align: center; }
.dbcal-prev, .dbcal-next { background: var(--bg-1); border: 1px solid var(--line); color: var(--ink); border-radius: var(--r-s); cursor: pointer; width: 26px; height: 26px; font-size: 14px; }
.dbcal-prev:hover, .dbcal-next:hover { border-color: var(--accent); }
.dbcal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.dbcal-dow { text-align: center; font-size: 10px; color: var(--ink-faint); padding: 2px; }
.dbcal-cell { min-height: 58px; background: var(--bg-1); border: 1px solid var(--line); border-radius: 6px; padding: 3px; position: relative; }
.dbcal-cell.empty { background: transparent; border-color: transparent; }
.dbcal-num { font-size: 10px; color: var(--ink-faint); }
.dbcal-ev { font-size: 10px; background: var(--accent-soft); color: var(--ink); border-radius: 4px; padding: 1px 4px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dbcal-add { position: absolute; top: 2px; right: 2px; background: transparent; border: none; color: var(--ink-faint); cursor: pointer; opacity: 0; font-size: 13px; line-height: 1; padding: 0 3px; }
.dbcal-cell:hover .dbcal-add { opacity: 1; }
.dbcal-add:hover { color: var(--lav-2); }
.node.table .dbt-board { max-height: 100%; }
.node.table .gantt { overflow: auto; max-height: 100%; }
.node.table .gantt .gantt-row-lbl { font-size: 11.5px; }

/* ===== Blockbench incorporato (editor 3D ufficiale) ===== */
.bb-modal { position: fixed; inset: 0; z-index: 260; display: flex; align-items: center; justify-content: center; background: rgba(5,7,5,.7); backdrop-filter: blur(4px); }
.bb-panel { width: 99vw; height: 97vh; display: flex; flex-direction: column; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--r-l); box-shadow: var(--shadow); overflow: hidden; animation: pop var(--t-med); }
.bb-modal:fullscreen .bb-panel, .bb-modal.bb-fs .bb-panel { width: 100vw; height: 100vh; border: 0; border-radius: 0; }
.bb-modal:fullscreen { background: var(--bg-0); }
.bb-head { display: flex; align-items: center; gap: 12px; padding: 9px 14px; border-bottom: 1px solid var(--line); background: var(--bg-1); }
.bb-title { font-weight: 700; font-size: 14px; color: var(--ink); flex: none; }
.bb-note { font-size: 11.5px; color: var(--ink-dim); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* strumenti del modello nella barra in alto: Versioni/backup + Chat */
.bb-tools { display: flex; align-items: center; gap: 6px; flex: none; }
.bb-tools .bbt { background: var(--bg-3); border: 1px solid var(--line); color: var(--ink-soft); border-radius: var(--r-s); padding: 5px 10px; cursor: pointer; font-size: 12px; display: inline-flex; align-items: center; gap: 5px; position: relative; white-space: nowrap; }
.bb-tools .bbt:hover { border-color: var(--accent); color: var(--ink); }
.bb-tools .bbt b { color: var(--ink); font-weight: 700; }
.bb-tools .bbt-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--koi); display: inline-block; }
.bb-acts { display: flex; align-items: center; gap: 6px; flex: none; }
.bb-acts button { background: var(--bg-3); border: 1px solid var(--line); color: var(--ink-soft); border-radius: var(--r-s); padding: 5px 10px; cursor: pointer; font-size: 12px; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bb-acts button:hover { border-color: var(--accent); color: var(--ink); }
.bb-acts .bb-dl { background: var(--accent-soft); border-color: var(--accent); color: var(--lav-2); }
.bb-acts .bb-reimport { background: var(--accent-soft); border-color: var(--accent); color: var(--ink); display: inline-flex; align-items: center; gap: 6px; }
.bb-acts .bb-reimport svg { width: 14px; height: 14px; }
.bb-note b { color: var(--lav-2); }
.bb-acts .bb-x { font-size: 18px; line-height: 1; padding: 2px 9px; }
.bb-frame-wrap { position: relative; flex: 1; background: #1a1a1a; }
.bb-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.bb-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--ink-dim); font-size: 14px; background: var(--bg-1); z-index: 1; }

/* ===== Storico versioni allegati ===== */
/* z-index 280 > .bb-modal (260): le Versioni si aprono SOPRA Blockbench quando lanciate dalla sua barra */
.att-hist-modal { position: fixed; inset: 0; z-index: 280; display: flex; align-items: center; justify-content: center; background: rgba(5,7,5,.6); backdrop-filter: blur(4px); }
.ah-note { margin: 12px 16px 2px; padding: 9px 11px; font-size: 11.5px; line-height: 1.55; color: var(--ink-soft); background: var(--accent-soft); border: 1px solid var(--line-2); border-radius: var(--r-s); }
.ah-note b { color: var(--lav-2); }
.ah-row.ah-orig { margin: 0 8px 10px; border: 1px solid var(--moss); background: color-mix(in srgb, var(--moss) 10%, transparent); }
.ah-row.ah-orig .ah-nm em { color: var(--moss); font-style: normal; font-weight: 700; }
/* commenti + tag sulle versioni */
.ah-list .ah-row { align-items: flex-start; }
.ah-list .ah-row .ah-meta { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.ah-tags { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-top: 2px; }
.ah-tag { display: inline-flex; align-items: center; gap: 3px; background: var(--accent-soft); color: var(--lav-2); border: 1px solid var(--accent); border-radius: 999px; padding: 1px 4px 1px 8px; font-size: 10.5px; }
.ah-tag-x { background: transparent; border: none; color: var(--lav-2); cursor: pointer; font-size: 13px; line-height: 1; padding: 0 2px; opacity: .65; }
.ah-tag-x:hover { opacity: 1; color: var(--koi); }
.ah-tag-add { background: var(--bg-3); border: 1px dashed var(--line-2); color: var(--ink-dim); border-radius: 999px; padding: 1px 9px; font-size: 10.5px; cursor: pointer; }
.ah-tag-add:hover { border-color: var(--accent); color: var(--ink); }
.ah-note-edit { width: 100%; margin-top: 3px; background: var(--bg-0); border: 1px solid var(--line); color: var(--ink); border-radius: var(--r-s); padding: 5px 8px; font-size: 11.5px; }
.ah-note-edit:focus { border-color: var(--accent); outline: none; }
/* badge "foto da aggiornare" quando cambia il King */
.md-pose-stale { position: absolute; top: 6px; left: 6px; background: var(--koi); color: #1c0e0a; border-radius: 999px; padding: 2px 8px; font-size: 10px; font-weight: 700; box-shadow: 0 1px 5px rgba(0,0,0,.45); pointer-events: none; max-width: 80%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* chat AGGANCIATA alla barra speciale di Blockbench: colonna a destra, TUTTA L'ALTEZZA (comoda per discutere) */
#chatPanel.dock-bb { z-index: 281; width: 400px; max-height: none; box-shadow: var(--shadow), 0 0 0 1px var(--accent-soft); border-color: var(--accent); }
#chatPanel.dock-bb .chat-head { background: var(--accent-soft); }
#chatPanel.dock-bb .chat-list { height: auto; flex: 1 1 auto; min-height: 0; }
.bb-tools .bbt.on { border-color: var(--accent); color: var(--ink); background: var(--accent-soft); }

/* ===== HUB ADDON BEDROCK ===== */
.hub-modal { position: fixed; inset: 0; z-index: 230; display: flex; align-items: center; justify-content: center; background: rgba(5,7,5,.62); backdrop-filter: blur(4px); }
.hub-panel { width: min(880px, 96vw); height: min(86vh, 760px); display: flex; flex-direction: column; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--r-l); box-shadow: var(--shadow); overflow: hidden; animation: pop var(--t-med); }
.hub-head { display: flex; align-items: center; gap: 12px; padding: 11px 16px; border-bottom: 1px solid var(--line); background: var(--bg-1); flex: none; }
.hub-title { font-weight: 700; font-size: 15px; color: var(--ink); flex: none; }
.hub-tabs { display: flex; gap: 4px; flex: 1; min-width: 0; overflow-x: auto; }
.hub-tab { background: transparent; border: 1px solid transparent; color: var(--ink-dim); border-radius: var(--r-s); padding: 5px 10px; cursor: pointer; font-size: 12.5px; white-space: nowrap; }
.hub-tab:hover { color: var(--ink); background: var(--bg-3); }
.hub-tab.on { color: var(--ink); background: var(--accent-soft); border-color: var(--accent); }
.hub-head-actions { display: flex; gap: 6px; flex: none; }
.hub-head-actions button { background: var(--bg-3); border: 1px solid var(--line); color: var(--ink-soft); border-radius: var(--r-s); padding: 6px 11px; cursor: pointer; font-size: 12.5px; }
.hub-head-actions .hub-add { background: var(--moss); border-color: var(--moss); color: #0a0c09; font-weight: 700; }
.hub-head-actions button:hover { filter: brightness(1.08); border-color: var(--accent); color: var(--ink); }
.hub-head-actions .hub-add:hover { color: #0a0c09; }
.hub-head-actions .hub-x { font-size: 18px; line-height: 1; padding: 2px 10px; }
.hub-body { flex: 1; overflow-y: auto; padding: 14px 16px; }
/* lista asset */
.hub-list { display: flex; flex-direction: column; gap: 7px; }
.hub-item { display: flex; align-items: center; gap: 11px; padding: 11px 13px; background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--r-m); cursor: pointer; transition: border-color var(--t-fast), transform var(--t-fast); }
.hub-item:hover { border-color: var(--accent); transform: translateX(2px); }
.hub-item .hi-ic { font-size: 22px; flex: none; width: 30px; text-align: center; }
.hub-item .hi-meta { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.hub-item .hi-name { font-weight: 600; color: var(--ink); }
.hub-item .hi-sub { font-size: 11.5px; color: var(--ink-dim); }
.hub-item .hi-go { color: var(--ink-faint); font-size: 20px; flex: none; }
.hub-empty { color: var(--ink-dim); font-size: 13px; line-height: 1.6; text-align: center; padding: 34px 20px; }
/* dettaglio asset */
.hub-detail { display: flex; flex-direction: column; gap: 4px; }
.hub-d-top { display: flex; align-items: center; gap: 9px; margin-bottom: 6px; }
.hub-back { background: var(--bg-3); border: 1px solid var(--line); color: var(--ink-soft); border-radius: var(--r-s); padding: 6px 11px; cursor: pointer; font-size: 12.5px; flex: none; }
.hub-back:hover { border-color: var(--accent); color: var(--ink); }
.hub-name { flex: 1; min-width: 0; background: var(--bg-1); border: 1px solid var(--line); color: var(--ink); border-radius: var(--r-s); padding: 8px 11px; font-size: 14px; font-weight: 600; }
.hub-name-static { flex: 1; font-weight: 700; color: var(--ink); }
.hub-type { background: var(--bg-1); border: 1px solid var(--line); color: var(--ink); border-radius: var(--r-s); padding: 7px 9px; font-size: 12.5px; flex: none; }
.hub-newgeo { background: var(--moss); border: 1px solid var(--moss); color: #0a0c09; font-weight: 700; border-radius: var(--r-s); padding: 6px 11px; cursor: pointer; flex: none; }
.hub-sec { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-faint); padding: 14px 0 6px; display: flex; align-items: center; gap: 9px; }
.hub-sec button { background: var(--bg-3); border: 1px solid var(--line); color: var(--ink-soft); border-radius: var(--r-s); padding: 3px 9px; cursor: pointer; font-size: 11px; text-transform: none; letter-spacing: 0; }
.hub-sec button:hover { border-color: var(--accent); color: var(--ink); }
.hub-shared { background: var(--accent-soft); color: var(--lav-2); border: 1px solid var(--accent); border-radius: 999px; padding: 1px 8px; font-size: 10px; text-transform: none; letter-spacing: 0; }
.hub-hint { color: var(--ink-faint); font-size: 10px; text-transform: none; letter-spacing: 0; font-style: italic; }
.hub-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-soft); padding: 2px 0 4px; }
.hub-row select { flex: 1; background: var(--bg-1); border: 1px solid var(--line); color: var(--ink); border-radius: var(--r-s); padding: 7px 9px; font-size: 12.5px; }
/* slot file */
.hub-slot { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--r-s); margin: 3px 0; }
.hs-label { flex: none; width: 168px; font-size: 12px; color: var(--ink-soft); }
.hs-file { flex: 1; min-width: 0; font-size: 12px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hs-file.empty { color: var(--ink-faint); font-style: italic; }
.hs-file em { color: var(--lav-2); font-style: normal; }
.hs-acts { display: flex; gap: 3px; flex: none; }
.hs-acts button { background: var(--bg-3); border: 1px solid var(--line); color: var(--ink-soft); border-radius: var(--r-s); padding: 4px 7px; cursor: pointer; display: inline-flex; }
.hs-acts button:hover { border-color: var(--accent); color: var(--ink); }
.hs-acts svg { width: 14px; height: 14px; }
/* set PBR / geo card */
.hub-set { background: var(--bg-0); border: 1px solid var(--line); border-radius: var(--r-m); padding: 8px 10px; margin: 6px 0; }
.hs-set-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.hs-set-name, .hs-geo-name { flex: 1; background: var(--bg-1); border: 1px solid var(--line); color: var(--ink); border-radius: var(--r-s); padding: 6px 9px; font-size: 12.5px; font-weight: 600; }
.hs-set-del, .hs-geo-del { background: transparent; border: 1px solid transparent; color: var(--ink-dim); border-radius: var(--r-s); padding: 4px 6px; cursor: pointer; }
.hs-set-del:hover, .hs-geo-del:hover { color: var(--koi); border-color: var(--koi); }
.hs-set-del svg, .hs-geo-del svg { width: 14px; height: 14px; }
.hub-king { display: flex; gap: 10px; flex-wrap: wrap; }
.hub-king label { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--ink-dim); }
.hub-king input { background: var(--bg-1); border: 1px solid var(--line); color: var(--ink); border-radius: var(--r-s); padding: 7px 9px; font-size: 12px; font-family: var(--mono, monospace); }
.hub-notes { width: 100%; min-height: 70px; resize: vertical; background: var(--bg-1); border: 1px solid var(--line); color: var(--ink); border-radius: var(--r-s); padding: 9px 11px; font-size: 12.5px; line-height: 1.5; }
.ah-panel { width: min(460px, 94vw); max-height: 86vh; overflow-y: auto; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--r-l); box-shadow: var(--shadow); animation: pop var(--t-med); }
.ah-head { display: flex; align-items: center; justify-content: space-between; padding: 13px 16px; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 14px; color: var(--ink); }
.ah-x { background: transparent; border: none; color: var(--ink-dim); font-size: 21px; cursor: pointer; }
.ah-cur { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.ah-cur .ah-ic, .ah-row .ah-ic { font-size: 20px; flex: none; width: 26px; text-align: center; }
.ah-meta { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.ah-nm { font-size: 13px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ah-nm em { color: var(--lav-2); font-style: normal; font-size: 11px; }
.ah-sub { font-size: 10.5px; color: var(--ink-dim); }
.ah-acts { display: flex; gap: 4px; flex: none; }
.ah-acts button { background: var(--bg-3); border: 1px solid var(--line); color: var(--ink-soft); border-radius: var(--r-s); padding: 4px 9px; cursor: pointer; font-size: 11.5px; }
.ah-acts button:hover { border-color: var(--accent); color: var(--ink); }
.ah-sec { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); padding: 10px 16px 4px; }
.ah-list { padding: 0 8px 10px; }
.ah-row { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--r-s); }
.ah-row:hover { background: var(--bg-3); }
.ah-empty { padding: 18px 16px; text-align: center; color: var(--ink-dim); font-size: 12.5px; line-height: 1.6; }

/* ===== Universi (switcher in alto) ===== */
.universe-btn { display: flex; align-items: center; gap: 7px; max-width: 200px; padding: 5px 10px; flex: none; }
.universe-btn .uni-nm { max-width: 150px; }
.universe-btn .uni-ic { width: 18px; height: 18px; border-radius: 5px; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; background: color-mix(in srgb, var(--uc, var(--accent)) 26%, transparent); color: var(--uc, var(--lav-2)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--uc, var(--accent)) 55%, transparent); flex: none; }
.universe-btn .uni-nm { font-size: 12.5px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.universe-btn .uni-caret { width: 13px; height: 13px; color: var(--ink-dim); flex: none; }
.universe-menu { min-width: 256px; max-height: 70vh; overflow-y: auto; }
.uni-menu-title { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-faint); padding: 6px 10px 4px; }
.uni-row { display: flex; align-items: center; gap: 9px; padding: 7px 9px; border-radius: var(--r-s); cursor: pointer; }
.uni-row:hover { background: var(--accent-soft); }
.uni-row.active { background: var(--bg-3); }
.uni-row .uni-ic { width: 22px; height: 22px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; background: color-mix(in srgb, var(--uc, var(--accent)) 26%, transparent); color: var(--uc, var(--lav-2)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--uc, var(--accent)) 55%, transparent); flex: none; }
.uni-row-nm { flex: 1; min-width: 0; font-size: 13px; color: var(--ink); display: flex; align-items: center; gap: 8px; overflow: hidden; }
.uni-row.active .uni-row-nm { font-weight: 600; }
.uni-count { font-size: 10px; color: var(--ink-dim); background: var(--bg-1); border: 1px solid var(--line); border-radius: 8px; padding: 0 6px; }
.uni-acts { display: flex; gap: 2px; opacity: 0; transition: opacity var(--t-fast); flex: none; }
.uni-row:hover .uni-acts { opacity: 1; }
.uni-act { background: transparent; border: none; cursor: pointer; font-size: 12px; padding: 3px 4px; border-radius: 5px; opacity: .7; color: var(--ink-soft); display: inline-flex; align-items: center; }
.uni-act svg { width: 14px; height: 14px; }
.uni-act:hover { background: var(--bg-1); opacity: 1; color: var(--ink); }
.uni-new { color: var(--lav-2); }
.uni-new .uni-ic { background: var(--accent-soft); color: var(--lav-2); box-shadow: none; font-size: 15px; }
