/* NIL plancia, versione chiara (30 ott 2026 sera): barra a sinistra con selettore di progetto, card bianche,
   viste kanban / timeline / tabella / calendario. Riferimenti di Egon: Tasklify, Schedule, DrewHub. */
:root {
  --bg: #efeeea; --panel: #f8f8f6; --card: #fff; --line: #e6e5e0; --line2: #d9d8d2;
  --ink: #18181a; --text: #3b3b3f; --muted: #7b7b80; --faint: #a6a6aa;
  --dark: #141416; --hover: #e7e6e1; --sel: #fff;
  --yellow: #ffd400; --yellow-s: #fff6cc; --yellow-t: #8a6d00;
  --red: #e5484d; --red-s: #fdecec; --red-t: #c4302f;
  --green: #30a46c; --green-s: #e6f6ec; --green-t: #23784e;
  --purple: #6e56cf; --purple-s: #efebfc; --purple-t: #5b45b5;
  --blue: #3e7bfa; --blue-s: #e8f0fe; --blue-t: #2c5fc9;
  --grey-s: #efefed; --grey-t: #5f5f63;
  --c-nil: #ffd400; --c-cli: #f2777a; --c-post: #9fb2c8;
  --r: 12px; --r-s: 8px;
  --shadow: 0 1px 2px rgba(20,20,22,.04), 0 1px 1px rgba(20,20,22,.03);
  --side-w: 256px;
  --f: Inter, -apple-system, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, Menlo, Consolas, monospace;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--f); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
b, strong { color: var(--ink); font-weight: 600; }
h1, h2, h3 { color: var(--ink); text-wrap: balance; margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
img, video { max-width: 100%; }
.muted { color: var(--muted); }
.ico { display: inline-flex; width: 18px; height: 18px; flex-shrink: 0; }
.ico svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- barra laterale ---------- */
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; padding: 18px 14px 14px; border-right: 1px solid var(--line); }
.ws-wrap { position: relative; margin-bottom: 12px; }
.ws, .usercard { width: 100%; display: flex; align-items: center; gap: 10px; padding: 6px; border: 0; background: transparent; border-radius: var(--r-s); cursor: pointer; text-align: left; font: inherit; color: var(--muted); }
.ws:hover, .usercard:hover { background: var(--hover); }
.ws-logo { width: 38px; height: 38px; border-radius: 10px; background: var(--dark) center / cover no-repeat; color: var(--yellow); display: grid; place-items: center; font-weight: 700; font-size: 15px; letter-spacing: .04em; flex-shrink: 0; box-shadow: 0 2px 6px rgba(0,0,0,.18); }
.ws-logo.img { background-color: #fff; color: transparent; border: 1px solid var(--line); }
.ws-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.ws-text b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-text small { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-menu { position: absolute; z-index: 80; left: 0; right: 0; top: calc(100% + 4px); background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 12px 30px rgba(0,0,0,.12); padding: 6px; max-height: 60vh; overflow-y: auto; }
.ws-menu.up { top: auto; bottom: calc(100% + 4px); }
.mi { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-s); text-decoration: none; color: var(--text); cursor: pointer; border: 0; background: none; width: 100%; font: inherit; text-align: left; }
.mi:hover, .mi.on { background: var(--hover); color: var(--ink); }
.mi small { color: var(--muted); margin-left: auto; font-size: 12px; }
.mi-h { font-size: 11px; color: var(--muted); padding: 8px 10px 4px; text-transform: uppercase; letter-spacing: .06em; }
.mi-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.mini-logo { width: 22px; height: 22px; border-radius: 6px; background: var(--dark) center / cover no-repeat; color: var(--yellow); font-size: 10px; font-weight: 700; display: grid; place-items: center; flex-shrink: 0; }
.mini-logo.img { background-color: #fff; border: 1px solid var(--line); color: transparent; }

.search { position: relative; display: flex; align-items: center; gap: 8px; background: var(--hover); border-radius: var(--r-s); padding: 0 10px; margin-bottom: 14px; color: var(--muted); }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; padding: 10px 0; color: var(--ink); outline: none; }
.search kbd { font: 12px var(--f); background: var(--card); border: 1px solid var(--line); border-radius: 5px; padding: 0 6px; color: var(--muted); }
.search-res { position: absolute; z-index: 90; left: 0; right: 0; top: calc(100% + 4px); background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 12px 30px rgba(0,0,0,.12); padding: 6px; max-height: 60vh; overflow-y: auto; }

.nav-h { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); padding: 10px 8px 6px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a, .nav button { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-s); color: var(--text); text-decoration: none; font: 500 14px var(--f); border: 0; background: none; cursor: pointer; text-align: left; width: 100%; }
.nav a:hover, .nav button:hover { background: var(--hover); color: var(--ink); }
.nav a.on { background: var(--sel); color: var(--ink); box-shadow: var(--shadow), 0 0 0 1px var(--line); }
.nav a span.t { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav .add { color: var(--muted); font-weight: 400; font-size: 13px; }
.badge-n { background: var(--red); color: #fff; border-radius: 5px; font-size: 11px; font-weight: 600; padding: 0 6px; line-height: 18px; }
.side-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); position: relative; }
.usercard { background: var(--card); border: 1px solid var(--line); padding: 8px; }

/* avatar */
.av { width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 12px; font-weight: 600; color: #fff; background: #8b8b90; flex-shrink: 0; border: 2px solid var(--card); }
.av.sm { width: 24px; height: 24px; font-size: 10px; }
.av.p-egon { background: #e0a800; } .av.p-matteo { background: #3e7bfa; } .av.p-emi { background: #e5486f; }
.avs { display: flex; }
.avs .av { margin-left: -8px; }
.avs .av:first-child { margin-left: 0; }

/* ---------- parte centrale ---------- */
.main { min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 12px; padding: 14px 24px; min-height: 64px; }
.crumbs { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; min-width: 0; flex: 1; white-space: nowrap; overflow: hidden; }
.crumbs a { text-decoration: none; color: var(--muted); }
.crumbs a:hover { color: var(--ink); }
.crumbs b { color: var(--ink); font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.top-right { display: flex; align-items: center; gap: 12px; }
.iconbtn.side-open { display: none; }
.chips .pill { white-space: normal; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px 0 0 0; border-right: 0; border-bottom: 0; flex: 1; padding: 28px 28px 60px; min-width: 0; }
.page { max-width: 1240px; margin: 0 auto; }

/* bottoni */
.btn { display: inline-flex; align-items: center; gap: 8px; font: 500 14px var(--f); padding: 9px 14px; border-radius: var(--r-s); border: 1px solid var(--line2); background: var(--card); color: var(--ink); cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn:hover { border-color: #bdbcb5; }
.btn.dark { background: var(--dark); border-color: var(--dark); color: #fff; }
.btn.dark:hover { background: #2a2a2e; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--hover); color: var(--ink); }
.btn.danger:hover { border-color: var(--red); color: var(--red-t); }
.btn:disabled { opacity: .5; cursor: default; }
.btn .ico { width: 16px; height: 16px; }
.iconbtn { width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: var(--r-s); border: 1px solid var(--line); background: var(--card); color: var(--text); cursor: pointer; }
.iconbtn:hover { color: var(--ink); border-color: var(--line2); }
.iconbtn .ico { width: 16px; height: 16px; }
.status { font-size: 13px; color: var(--muted); }
.status.err { color: var(--red-t); }
.status.ok { color: var(--green-t); }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* pill di stato */
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; padding: 2px 8px; border-radius: 6px; white-space: nowrap; }
.pill .ico { width: 13px; height: 13px; }
.pill.red { background: var(--red-s); color: var(--red-t); }
.pill.green { background: var(--green-s); color: var(--green-t); }
.pill.purple { background: var(--purple-s); color: var(--purple-t); }
.pill.yellow { background: var(--yellow-s); color: var(--yellow-t); }
.pill.blue { background: var(--blue-s); color: var(--blue-t); }
.pill.grey { background: var(--grey-s); color: var(--grey-t); }
.tag { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 3px 8px; border-radius: 6px; }

/* ---------- intestazioni di pagina ---------- */
.ph { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.ph h1 { font-size: 26px; font-weight: 600; letter-spacing: -.01em; }
.ph p { margin: 4px 0 0; color: var(--muted); font-size: 15px; max-width: 760px; }

/* banner novità */
.banner { display: flex; align-items: center; gap: 12px; background: var(--hover); border-radius: var(--r); padding: 10px 10px 10px 12px; margin-bottom: 18px; }
.banner .spark { width: 32px; height: 32px; border-radius: 8px; background: linear-gradient(135deg, #ffd400, #ff8a00); color: #111; display: grid; place-items: center; flex-shrink: 0; }
.banner .spark .ico { width: 17px; height: 17px; }
.banner p { margin: 0; flex: 1; color: var(--muted); }
.banner p b { margin-right: 4px; }

/* card dei numeri */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); min-width: 0; display: flex; flex-direction: column; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.kpi-ic { width: 34px; height: 34px; border-radius: 9px; background: var(--dark); color: #fff; display: grid; place-items: center; }
.kpi-ic .ico { width: 17px; height: 17px; }
.kpi-ic.y { background: var(--yellow); color: #111; }
.kpi-more { font-size: 13px; color: var(--text); display: inline-flex; align-items: center; gap: 2px; background: none; border: 0; cursor: pointer; font-family: inherit; padding: 0; }
.kpi-more:hover { color: var(--ink); }
.kpi-more .ico { width: 15px; height: 15px; }
.kpi-v { font-size: 26px; font-weight: 600; color: var(--ink); line-height: 1.15; letter-spacing: -.01em; }
.kpi-v.txt { font-size: 17px; line-height: 1.3; }
.kpi-l { color: var(--muted); font-size: 13.5px; margin-top: 4px; }
.bar { height: 6px; border-radius: 3px; background: var(--grey-s); margin-top: 10px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--green); border-radius: 3px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

/* ---------- viste delle attività ---------- */
.board { margin-top: 26px; }
.board-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding-bottom: 14px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.seg { display: inline-flex; background: var(--hover); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { display: inline-flex; align-items: center; gap: 7px; border: 0; background: transparent; padding: 7px 12px; border-radius: 8px; font: 500 14px var(--f); color: var(--muted); cursor: pointer; }
.seg button .ico { width: 16px; height: 16px; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow), 0 0 0 1px var(--line); }
.filters { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.chipf { border: 1px solid var(--line); background: var(--card); border-radius: 20px; padding: 5px 12px; font: 500 13px var(--f); color: var(--text); cursor: pointer; }
.chipf:hover { border-color: var(--line2); }
.chipf.on { background: var(--dark); border-color: var(--dark); color: #fff; }
select.chipf { appearance: none; padding-right: 12px; }

/* kanban */
.kanban { display: grid; grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: 16px; align-items: start; overflow-x: auto; padding-bottom: 6px; }
.col { min-width: 0; border-radius: var(--r); padding: 2px; transition: background .15s; }
.col.over { background: var(--hover); }
.col-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.col-pill { display: inline-flex; align-items: center; gap: 7px; padding: 5px 10px; border-radius: 20px; font-weight: 500; color: var(--ink); background: var(--grey-s); }
.col-pill .ico { width: 15px; height: 15px; }
.col-pill .n { background: var(--card); border-radius: 10px; font-size: 11px; padding: 0 7px; color: var(--text); }
.col-pill.s-in_corso { background: var(--yellow-s); } .col-pill.s-in_corso .ico { color: var(--yellow-t); }
.col-pill.s-in_revisione { background: var(--purple-s); } .col-pill.s-in_revisione .ico { color: var(--purple-t); }
.col-pill.s-fatto { background: var(--green-s); } .col-pill.s-fatto .ico { color: var(--green-t); }
.cards { display: flex; flex-direction: column; gap: 10px; min-height: 40px; }
.tcard { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; box-shadow: var(--shadow); cursor: grab; transition: box-shadow .15s, transform .15s; }
.tcard:hover { box-shadow: 0 4px 14px rgba(0,0,0,.07); }
.tcard.dragging { opacity: .5; transform: rotate(2deg); }
.tcard.drop-before { box-shadow: 0 -3px 0 var(--ink); }
.tc-top { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; margin-bottom: 8px; min-width: 0; }
.tc-top .g { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: inline-flex; align-items: center; gap: 5px; min-width: 0; }
.tc-top .ico { width: 14px; height: 14px; }
.tc-t { font-weight: 600; color: var(--ink); font-size: 14.5px; line-height: 1.3; }
.tc-s { color: var(--muted); font-size: 13px; margin-top: 2px; }
.datechip { display: inline-flex; align-items: center; gap: 6px; background: var(--grey-s); border-radius: 6px; padding: 3px 8px; font-size: 12.5px; margin-top: 10px; color: var(--text); }
.datechip .ico { width: 13px; height: 13px; }
.datechip.tbd { background: transparent; border: 1px dashed var(--line2); color: var(--muted); }
.tc-f { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px solid var(--line); margin-top: 12px; padding-top: 10px; font-size: 12.5px; color: var(--muted); }
.tc-f .left { display: flex; align-items: center; gap: 8px; }
.tc-f .ico { width: 14px; height: 14px; }
.addcard { width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 10px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 9px; font: 500 13.5px var(--f); color: var(--ink); cursor: pointer; }
.addcard:hover { border-color: var(--line2); }
.addcard .ico { width: 15px; height: 15px; }

/* timeline */
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--muted); margin-bottom: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.dia { width: 10px; height: 10px; background: var(--red); transform: rotate(45deg); display: inline-block; }
.gantt-scroll { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; box-shadow: var(--shadow); }
.gantt { display: grid; min-width: 880px; row-gap: 6px; font-size: 13px; color: var(--ink); }
.g-wk { font-size: 12px; color: var(--muted); border-left: 1px solid var(--line); padding: 0 0 10px 6px; grid-row: 1; }
.g-wk b { display: block; font-weight: 600; color: var(--ink); }
.g-sec { grid-column: 1 / -1; font-size: 11px; font-weight: 600; letter-spacing: .06em; color: var(--muted); text-transform: uppercase; padding-top: 10px; border-top: 1px solid var(--line); }
.g-lab { grid-column: 1; align-self: center; padding-right: 10px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-lab:hover { text-decoration: underline; }
.g-lab.done { color: var(--muted); text-decoration: line-through; }
.g-bar { height: 24px; align-self: center; font-size: 11.5px; line-height: 24px; font-weight: 500; color: #1a1a1a; padding: 0 8px; white-space: nowrap; overflow: hidden; border-radius: 6px; cursor: pointer; }
.g-bar.tbd { opacity: .45; }
.g-bar.done { opacity: .35; }
.g-dia { width: 14px; height: 14px; background: var(--red); transform: rotate(45deg); align-self: center; justify-self: center; cursor: pointer; border-radius: 2px; }
.g-dia.tbd { background: transparent; border: 2px solid var(--red); }
.g-today { border-left: 2px solid var(--ink); opacity: .5; }

/* tabella */
.tablewrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.t th, table.t td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
table.t th { font-size: 12px; font-weight: 500; color: var(--muted); background: #fbfbfa; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr { cursor: pointer; }
table.t tbody tr:hover td { background: #fafaf8; }
table.t td.main-c { color: var(--ink); font-weight: 500; white-space: normal; min-width: 220px; }
table.t select { font: inherit; border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; background: var(--card); }

/* calendario a settimana */
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.cal-head h2 { font-size: 22px; font-weight: 600; }
.cal { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); overflow-x: auto; }
.cal-grid { display: grid; grid-template-columns: repeat(5, minmax(150px, 1fr)) repeat(2, minmax(90px, .55fr)); min-width: 900px; }
.cal-d { text-align: center; padding: 10px 6px; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--line); border-left: 1px solid var(--line); }
.cal-d:first-child, .cal-c:first-child { border-left: 0; }
.cal-d.today span { background: var(--dark); color: #fff; padding: 3px 10px; border-radius: 6px; }
.cal-c { border-left: 1px solid var(--line); min-height: 420px; padding: 8px; display: flex; flex-direction: column; gap: 6px; background-image: linear-gradient(var(--line) 1px, transparent 1px); background-size: 100% 70px; background-position: 0 69px; }
.cal-c.we { background-color: #fafaf8; }
.cal-c.today { background-color: #fffdf3; }
.ev { border-radius: 8px; padding: 7px 9px; font-size: 12.5px; line-height: 1.35; cursor: pointer; background: var(--yellow-s); color: #4d3d00; border-left: 3px solid var(--c-nil); }
.ev b { display: block; color: inherit; font-weight: 600; }
.ev small { opacity: .8; }
.ev.cli { background: var(--red-s); color: #7a2224; border-left-color: var(--c-cli); }
.ev.post { background: var(--blue-s); color: #23406e; border-left-color: var(--c-post); }
.ev.dec { background: var(--purple-s); color: #3e2e85; border-left-color: var(--purple); }
.ev.tbd { opacity: .6; border-left-style: dashed; }
.ev.done { opacity: .45; text-decoration: line-through; }
.ev .ok-pill { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; background: #fff; border-radius: 10px; padding: 1px 8px; font-size: 11px; color: var(--green-t); text-decoration: none; }
.ev .ok-pill .ico { width: 11px; height: 11px; }

/* ---------- home: progetti a card ---------- */
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.pcard { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 20px; box-shadow: var(--shadow); display: flex; flex-direction: column; text-decoration: none; color: inherit; min-height: 260px; transition: box-shadow .15s; }
.pcard:hover { box-shadow: 0 8px 24px rgba(0,0,0,.07); }
.pc-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 16px; }
.pc-ic { width: 44px; height: 44px; border-radius: 50%; background: var(--yellow-s) center / 70% no-repeat; color: var(--yellow-t); display: grid; place-items: center; font-weight: 700; }
.pc-ic.img { background-color: #fff; border: 1px solid var(--line); color: transparent; }
.pcard h3 { font-size: 18px; font-weight: 600; line-height: 1.3; white-space: pre-line; }
.pcard p { margin: 6px 0 0; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pc-f { margin-top: auto; border-top: 1px solid var(--line); padding-top: 14px; display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
.pc-f small { display: block; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.pc-f b { font-size: 18px; }
.pc-f span.sub2 { color: var(--muted); font-size: 13px; margin-left: 6px; }
.pc-go { width: 36px; height: 36px; border-radius: 50%; background: var(--grey-s); display: grid; place-items: center; color: var(--muted); flex-shrink: 0; }
.pcard:hover .pc-go { color: var(--ink); }
.pcard.new { border-style: dashed; background: transparent; box-shadow: none; align-items: center; justify-content: center; color: var(--faint); cursor: pointer; font: 500 16px var(--f); gap: 12px; }
.pcard.new .pc-go { width: 52px; height: 52px; background: var(--hover); }
.pcard.new:hover { color: var(--ink); }

/* ---------- progress, domande, pagine di testo ---------- */
.two-col { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.box { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; box-shadow: var(--shadow); min-width: 0; }
.box h3 { font-size: 15px; font-weight: 600; margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sticky { position: sticky; top: 16px; }
.entry { position: relative; padding: 0 0 22px 22px; border-left: 2px solid var(--line); margin-left: 6px; }
.entry::before { content: ""; position: absolute; left: -7px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--card); border: 2px solid var(--line2); }
.entry.first::before { background: var(--yellow); border-color: var(--yellow); }
.entry:last-child { padding-bottom: 4px; }
.entry .date { font-weight: 600; color: var(--ink); }
.entry .who { color: var(--muted); margin-left: 8px; font-size: 13px; }
.entry ul { margin: 6px 0 0; padding-left: 18px; }
.entry li { margin-bottom: 3px; }
.entry .change { display: inline-block; margin-top: 8px; background: var(--yellow-s); color: #4d3d00; border-radius: 6px; padding: 4px 10px; font-size: 13px; }
.entry .by { font-size: 12px; color: var(--faint); margin-top: 6px; display: flex; gap: 10px; }
.entry .del { font: 12px var(--f); color: var(--faint); background: none; border: 0; text-decoration: underline; cursor: pointer; padding: 0; }
.entry .del:hover { color: var(--red-t); }
.nexts { list-style: none; margin: 0; padding: 0; }
.nexts li { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.nexts li:last-child { border-bottom: 0; }
.nexts li .t { flex: 1; min-width: 0; color: var(--ink); }
.nexts li small { display: block; color: var(--muted); }
.qrow { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.qrow:last-child { border-bottom: 0; }
.qrow .q { flex: 1; min-width: 0; }
.qrow .q b { display: block; font-weight: 500; }
.qrow .ans { color: var(--green-t); font-size: 13px; margin-top: 3px; }
.qrow.risolta .q b { color: var(--muted); text-decoration: line-through; }
.composer textarea, .composer input { width: 100%; }
.feedlist { list-style: none; margin: 0; padding: 0; }
.feedlist li { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.feedlist li:last-child { border-bottom: 0; }
.feedlist time { display: block; color: var(--faint); font-size: 12px; }
.team { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.team .box { display: flex; gap: 14px; align-items: center; }
.team .av { width: 46px; height: 46px; font-size: 16px; }
code.k { font: 12.5px var(--mono); background: var(--grey-s); padding: 2px 6px; border-radius: 5px; word-break: break-all; }

/* testo libero (markdown) */
.md { color: var(--text); font-size: 15px; line-height: 1.6; }
.md > *:first-child { margin-top: 0; }
.md h3 { font-size: 18px; font-weight: 600; margin: 28px 0 8px; }
.md h4 { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 0 6px; }
.md p { margin: 0 0 12px; }
.md ul, .md ol { margin: 0 0 14px; padding-left: 20px; }
.md li { margin-bottom: 4px; }
.md blockquote { margin: 12px 0; background: var(--yellow-s); border-radius: var(--r-s); padding: 10px 14px; color: #4d3d00; }
.md blockquote p:last-child { margin: 0; }
.md blockquote strong { color: #3a2e00; }
.md mark { background: var(--red-s); color: var(--red-t); font-weight: 500; padding: 0 4px; border-radius: 4px; }
.md table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 0 0 16px; border: 1px solid var(--line); border-radius: var(--r-s); }
.md th, .md td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.md th { font-size: 12px; font-weight: 500; color: var(--muted); background: #fbfbfa; }
.md td:first-child { color: var(--ink); font-weight: 500; }
.md img, .md video { display: block; width: 100%; background: #000; border-radius: var(--r-s); }
.md .imgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.md .imgs.two { grid-template-columns: 1fr 1fr; }
.md .imgs.three { grid-template-columns: repeat(3, 1fr); }
.md .imgs img { aspect-ratio: 16/9; object-fit: cover; }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 28px 0; }
.md code { font: 13px var(--mono); background: var(--grey-s); padding: 1px 5px; border-radius: 4px; }
.md a { color: var(--blue-t); }
.empty { border: 1px dashed var(--line2); border-radius: var(--r); padding: 22px; color: var(--muted); text-align: center; }
.by-line { font-size: 12px; color: var(--faint); margin-top: 14px; }

/* editor di testo */
.editor { display: grid; gap: 12px; }
.editor .split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.editor textarea { min-height: 420px; font: 13.5px/1.6 var(--mono); resize: vertical; }
.editor .prev { border: 1px dashed var(--line2); border-radius: var(--r-s); padding: 14px; max-height: 70vh; overflow: auto; }
.editor.drag textarea { border-color: var(--ink); }
.hint { font-size: 12.5px; color: var(--muted); }
input[type=text], input[type=date], input[type=password], input:not([type]), textarea, select.f {
  width: 100%; background: var(--card); color: var(--ink); border: 1px solid var(--line2); border-radius: var(--r-s); padding: 9px 11px; font: 14px/1.45 var(--f); }
input:focus, textarea:focus, select.f:focus { outline: none; border-color: var(--ink); }
.search input { border: 0; padding: 10px 0; background: transparent; }

/* finestre */
dialog { background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 16px; padding: 0; width: min(880px, calc(100vw - 24px)); max-height: calc(100vh - 40px); box-shadow: 0 30px 80px rgba(0,0,0,.2); }
dialog.narrow { width: min(560px, calc(100vw - 24px)); }
dialog::backdrop { background: rgba(20,20,22,.35); }
.dlg-head { position: sticky; top: 0; z-index: 2; background: var(--card); display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.dlg-head h3 { font-size: 17px; font-weight: 600; }
.dlg-body { padding: 18px 20px 20px; display: grid; gap: 14px; }
.dlg-foot { position: sticky; bottom: 0; background: var(--card); padding: 12px 20px; border-top: 1px solid var(--line); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.dlg-foot .sp { flex: 1; }
.fl { display: grid; gap: 5px; font-size: 13px; color: var(--muted); }
.fl.ck { display: flex; align-items: center; gap: 8px; color: var(--text); }
.fl.ck input { width: auto; }
.fgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
fieldset { border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; margin: 0; min-width: 0; }
legend { font-size: 12px; font-weight: 600; color: var(--ink); padding: 0 6px; }
.lrow { display: grid; gap: 6px; align-items: center; margin-bottom: 6px; }
.lrow input, .lrow select { padding: 6px 8px; font-size: 13.5px; width: 100%; border: 1px solid var(--line2); border-radius: 6px; font-family: var(--f); background: var(--card); }
.lrow .x { font: 15px/1 var(--f); width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--muted); cursor: pointer; }
.lrow .x:hover { color: var(--red-t); border-color: var(--red); }
.lhead { font-size: 11.5px; color: var(--muted); }
.mini { font: 500 12.5px var(--f); padding: 5px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--text); cursor: pointer; }
.mini:hover { border-color: var(--line2); color: var(--ink); }
.imgpick { display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; align-items: center; }
.imgpick .th { width: 64px; height: 64px; border-radius: 12px; background: var(--grey-s) center / contain no-repeat; border: 1px solid var(--line); }

/* accesso */
.login { max-width: 420px; margin: 12vh auto 0; }
.login .ws-logo { width: 52px; height: 52px; font-size: 19px; margin-bottom: 18px; }
.login h1 { font-size: 26px; font-weight: 600; margin-bottom: 6px; }

/* ---------- telefono ---------- */
@media (max-width: 960px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-col, .editor .split { grid-template-columns: 1fr; }
  .sticky { position: static; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 100; left: 0; top: 0; width: min(300px, 86vw); background: var(--bg); transform: translateX(-102%); transition: transform .2s; }
  .app.open .side { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); }
  .iconbtn.side-open { display: inline-grid; }
  .top { padding: 10px 16px; min-height: 56px; }
  .top .avs { display: none; }
  .top .btn.dark span:last-child { display: none; }
  .panel { border-radius: 14px 14px 0 0; border-right: 1px solid var(--line); padding: 20px 16px 48px; }
  .ph h1 { font-size: 22px; }
  .kanban { grid-template-columns: repeat(4, 82vw); scroll-snap-type: x mandatory; }
  .col { scroll-snap-align: start; }
  .seg button span.l { display: none; }
  .lrow { grid-template-columns: 1fr 1fr !important; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
  .lhead { display: none !important; }
  .banner { flex-wrap: wrap; }
  .md table { display: block; overflow-x: auto; }
}
@media (max-width: 480px) {
  .kpis { grid-template-columns: 1fr; }
}
