/* Projectrack — tema scuro, blu pavone negli accenti. Nessun bianco né nero puri. */

@property --v { syntax: "<number>"; inherits: true; initial-value: 0; }

:root {
  color-scheme: dark;
  --bg: #16181c;
  --side: #1a1d21;
  --surface: #1f2328;
  --surface-2: #272c33;
  --surface-3: #313740;
  --line: #2d333a;
  --line-2: #3d444d;
  --text: #e3e1da;
  --text-2: #b4b6b8;
  --muted: #8c9096;

  --accent: #38b2c6;          /* blu pavone */
  --accent-hi: #63c8d9;
  --accent-lo: #1f7f90;
  --accent-ink: #0d1d21;
  --accent-soft: rgba(56, 178, 198, .13);
  --accent-line: rgba(56, 178, 198, .38);

  --warn: #dba95f;
  --warn-soft: rgba(219, 169, 95, .14);
  --danger: #e0877b;
  --ok: #84b998;

  /* le "piume": colori delle categorie */
  --c0: #38b2c6; --c1: #9a8bdb; --c2: #dba95f; --c3: #84b998; --c4: #dc7f72; --c5: #6a9fe0;

  --r: 16px;
  --r-s: 11px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "SF Pro Text", Roboto, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; font: 15px/1.5 var(--font); color: var(--text);
  background: radial-gradient(1100px 520px at 12% -8%, rgba(56, 178, 198, .075), transparent 62%),
              radial-gradient(900px 500px at 100% 0%, rgba(154, 139, 219, .045), transparent 60%), var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: not-allowed; opacity: .45; }
h1, h2, h3, p { margin: 0; }
:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--accent-line); }
.ic { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.rotn90 { transform: rotate(-90deg); } .rot90 { transform: rotate(90deg); } .rot45 { transform: rotate(45deg); }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); font-size: 13px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--accent)); flex: none; }
.cap { font-size: 11px; letter-spacing: .13em; text-transform: uppercase; color: var(--muted); font-weight: 600; }

/* ---------- struttura */
.app { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 26px 16px 18px;
  background: var(--side); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 10px 22px; font: 600 25px/1 var(--serif); letter-spacing: -.01em; }
.brand i { font-style: normal; color: var(--accent); }
.menu { display: grid; gap: 2px; }
.menu .cap { padding: 14px 12px 8px; }
.cap-row { display: flex; align-items: center; justify-content: space-between; padding-right: 6px !important; }
.menu a {
  display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 0 12px; border-radius: var(--r-s);
  color: var(--text-2); transition: background .18s, color .18s;
}
.menu a:hover { background: var(--surface); color: var(--text); }
.menu a.on { background: var(--accent-soft); color: var(--accent-hi); box-shadow: inset 2px 0 0 var(--accent); }
.menu a .dot { margin: 0 4px; }
.count { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.count.hot { background: var(--accent); color: var(--accent-ink); border-radius: 99px; padding: 1px 8px; }
.side-foot { padding: 12px 0 0; border-top: 1px solid var(--line); }
.me { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 10px; border-radius: var(--r-s); text-align: left; transition: background .18s; }
.me:hover { background: var(--surface); }
.avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-hi); font: 600 16px var(--serif); border: 1px solid var(--accent-line); flex: none; }
.me-name { display: grid; line-height: 1.25; font-weight: 600; min-width: 0; }
.me-name small { font-weight: 400; color: var(--muted); font-size: 12px; }

.content { min-width: 0; }
main { max-width: 1060px; margin: 0 auto; padding: 44px 48px 90px; animation: rise .45s var(--ease) both; }
.topbar { display: none; }
.tabs { display: none; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

/* ---------- intestazioni */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 28px; }
.eyebrow { display: flex; align-items: center; gap: 8px; font-size: 11.5px; letter-spacing: .15em; text-transform: uppercase; color: var(--accent); font-weight: 600; margin-bottom: 10px; }
h1 { font: 600 clamp(28px, 4vw, 40px)/1.12 var(--serif); letter-spacing: -.015em; }
.lede { color: var(--text-2); margin-top: 8px; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13.5px; margin-bottom: 16px; }
.back .ic { transform: rotate(180deg); }
.back:hover { color: var(--accent-hi); }
.section-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin: 34px 0 14px; }
.section-head h2 { font: 600 20px/1.2 var(--serif); }

/* ---------- bottoni */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 18px;
  border-radius: var(--r-s); border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text);
  font-weight: 600; font-size: 14.5px; white-space: nowrap; transition: transform .12s, background .18s, border-color .18s, box-shadow .18s;
}
.btn:hover:not(:disabled) { background: var(--surface-3); border-color: #4b535d; }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 20px -8px var(--accent); }
.btn.primary:hover:not(:disabled) { background: var(--accent-hi); border-color: var(--accent-hi); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.danger { color: var(--danger); }
.btn.danger.ghost:hover { background: rgba(224, 135, 123, .12); }
.btn.sm { min-height: 34px; padding: 0 13px; font-size: 13.5px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; color: var(--muted);
  transition: background .15s, color .15s, transform .12s;
}
.icon-btn:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.icon-btn:active:not(:disabled) { transform: scale(.9); }
.icon-btn.sm { width: 30px; height: 30px; }
.icon-btn.danger:hover:not(:disabled) { color: var(--danger); }

/* ---------- statistiche e filtri */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 26px; }
.stat { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); transition: border-color .2s, transform .2s var(--ease); }
a.stat:hover { border-color: var(--accent-line); transform: translateY(-2px); }
.stat-ic { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-hi); }
.stat.warn .stat-ic { background: var(--warn-soft); color: var(--warn); }
.stat strong { display: block; font: 600 26px/1.1 var(--serif); font-variant-numeric: tabular-nums; }
.stat span:not(.stat-ic) { color: var(--muted); font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.fchip { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 15px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); color: var(--text-2); font-size: 14px; transition: all .18s; }
.fchip:hover { border-color: var(--line-2); color: var(--text); }
.fchip.on { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-hi); }
.fchip.ghost { background: none; border-style: dashed; padding: 0 11px; }

/* ---------- schede progetto */
.group { margin-top: 30px; }
.group-title { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.group-title h2 { font: 600 19px/1 var(--serif); }
.group-title span:last-child { color: var(--muted); font-size: 13px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.card { position: relative; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); box-shadow: 0 10px 30px -22px #000; }
.pcard {
  display: flex; flex-direction: column; gap: 12px; padding: 20px 20px 16px; overflow: hidden;
  transition: transform .25s var(--ease), border-color .25s, box-shadow .25s;
}
.pcard::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: linear-gradient(90deg, var(--c), transparent 85%); opacity: .9; }
.pcard:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--c) 50%, var(--line)); box-shadow: 0 18px 36px -22px #000; }
.pcard.is-archived { opacity: .82; }
.card-top { display: flex; justify-content: space-between; align-items: center; }
.badge { font-size: 11.5px; font-weight: 600; letter-spacing: .04em; padding: 3px 10px; border-radius: 99px; background: color-mix(in srgb, var(--c) 16%, transparent); color: var(--c); }
.big-pct { font: 600 24px/1 var(--serif); font-variant-numeric: tabular-nums; }
.big-pct small, .pct small, .ring small { font-size: .55em; color: var(--muted); margin-left: 1px; }
.pcard h3 { font: 600 20px/1.25 var(--serif); }
.goal { color: var(--text-2); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.9em; }
.bar { height: 7px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.fill { height: 100%; width: calc(var(--v) * 1%); border-radius: inherit; background: linear-gradient(90deg, var(--accent-lo), var(--c, var(--accent))); transition: --v .6s var(--ease); }
.meta-row { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: 13px; }
.next { margin-top: 2px; padding: 11px 13px; border-radius: var(--r-s); background: var(--bg); border: 1px solid var(--line); }
.next .cap { font-size: 10.5px; }
.next-line { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 3px; font-weight: 500; }
.next-line span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.next-line .ic { color: var(--c); transition: transform .2s var(--ease); }
.pcard:hover .next-line .ic { transform: translateX(3px); }
.newcard { display: grid; place-content: center; justify-items: center; gap: 10px; min-height: 200px; background: transparent; border-style: dashed; border-color: var(--line-2); color: var(--muted); box-shadow: none; transition: all .2s; }
.newcard span { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: var(--surface); }
.newcard:hover { color: var(--accent-hi); border-color: var(--accent-line); background: var(--accent-soft); }

/* ---------- chip */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 1px 9px; border-radius: 99px; background: var(--surface-2); color: var(--text-2); font-size: 12px; line-height: 20px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.due.now { background: var(--accent-soft); color: var(--accent-hi); }
.chip.due.over { background: rgba(224, 135, 123, .14); color: var(--danger); }

/* ---------- pagina progetto */
.intro { display: flex; align-items: center; justify-content: space-between; gap: 28px; padding: 26px 28px; background: linear-gradient(135deg, var(--surface), color-mix(in srgb, var(--surface) 88%, var(--c, var(--accent)))); }
.card.flat { box-shadow: none; }
.goal-big { font: 400 20px/1.45 var(--serif); margin: 8px 0 14px; max-width: 46ch; }
.ring {
  --size: 132px; flex: none; width: var(--size); height: var(--size); border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--accent) calc(var(--v) * 1%), var(--surface-3) 0); transition: --v .7s var(--ease);
}
.ring > div { width: calc(var(--size) - 20px); height: calc(var(--size) - 20px); border-radius: 50%; background: var(--surface); display: grid; place-content: center; text-align: center; }
.ring strong { font: 600 34px/1 var(--serif); font-variant-numeric: tabular-nums; }
.ring span { font-size: 11px; color: var(--muted); letter-spacing: .06em; }
.project-note { margin-top: 16px; padding: 14px 18px; border-left: 2px solid var(--accent-line); color: var(--text-2); white-space: pre-wrap; }
.stages { display: grid; gap: 12px; }
.stage-wrap { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 4px; }
.stage-no { font: 600 22px/1 var(--serif); color: var(--line-2); padding-top: 19px; text-align: center; font-variant-numeric: tabular-nums; }
.stage-main { border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); transition: border-color .2s; }
.stage-wrap.open .stage-main { border-color: var(--line-2); }
.stage-head { display: flex; align-items: stretch; }
.chev { width: 40px; display: grid; place-items: center; color: var(--muted); }
.chev .ic { transition: transform .25s var(--ease); }
.stage-wrap.open .chev .ic { transform: rotate(90deg); color: var(--accent-hi); }
.chev:hover { color: var(--text); }
.kids { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .3s var(--ease); }
.stage-wrap.open .kids { grid-template-rows: 1fr; }
.kids-in { overflow: hidden; min-height: 0; margin: 0 14px 0 40px; border-left: 2px solid var(--accent-line); padding-left: 6px; }
.stage-wrap.open .kids-in { padding-bottom: 12px; margin-top: -2px; }
.kids-in .node { border-radius: 10px; }
.stage-add { margin-top: 4px; padding-left: 48px; }

/* ---------- righe attività */
.node { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 4px; min-height: 58px; transition: background .15s; }
.kids-in .node { padding-left: 8px; min-height: 52px; }
.kids-in .node:hover { background: var(--surface-2); }
.node-body { flex: 1; min-width: 0; }
.node-title { display: block; max-width: 100%; text-align: left; font-weight: 550; font-size: 15.5px; line-height: 1.35; overflow-wrap: anywhere; transition: color .15s; }
.node.stage .node-title { font-size: 16.5px; font-weight: 600; }
.node-title:hover { color: var(--accent-hi); }
.node.done .node-title { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line-2); }
.node.blocked .node-title { color: var(--text-2); }
.node.blocked { background: repeating-linear-gradient(135deg, transparent 0 9px, rgba(219, 169, 95, .035) 9px 18px); }
.node-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 4px; }
.note-line { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.crumb { display: block; font-size: 12px; color: var(--muted); letter-spacing: .02em; margin-bottom: 2px; }
.node-ctl { display: flex; align-items: center; gap: 10px; flex: none; }
.pct { font: 600 17px/1 var(--serif); font-variant-numeric: tabular-nums; min-width: 44px; text-align: right; }

.check { flex: none; width: 26px; height: 26px; margin-left: 8px; border-radius: 50%; border: 2px solid var(--line-2); display: grid; place-items: center; color: transparent; transition: all .2s var(--ease); }
.check:hover { border-color: var(--accent); }
.check:active { transform: scale(.88); }
.node.done .check, .check[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.mini-ring { flex: none; margin-left: 5px; width: 26px; height: 26px; border-radius: 50%; background: radial-gradient(circle, var(--surface) 55%, transparent 57%), conic-gradient(var(--accent) calc(var(--v) * 1%), var(--surface-3) 0); transition: --v .6s var(--ease); }
.stage-head .mini-ring { margin-left: 2px; }

.seg { display: flex; gap: 3px; padding: 4px; border-radius: 99px; background: var(--bg); border: 1px solid var(--line); }
.seg-i { width: 22px; height: 12px; border-radius: 6px; background: var(--surface-3); transition: background .2s, transform .12s; position: relative; }
.seg-i::after { content: ""; position: absolute; inset: -12px -2px; } /* area di tocco più grande */
.seg-i.on { background: linear-gradient(90deg, var(--accent-lo), var(--accent)); }
.seg-i:hover { transform: scaleY(1.25); background: var(--accent-hi); }
.sun { color: var(--muted); }
.sun.on { color: var(--warn); background: var(--warn-soft); }
.sun.on .ic { fill: currentColor; fill-opacity: .25; }

.quick { display: flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 12px; border-radius: 10px; border: 1px dashed var(--line-2); color: var(--muted); transition: border-color .2s, background .2s; }
.quick:focus-within { border-style: solid; border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent-hi); }
.quick input { flex: 1; min-width: 0; height: 40px; background: none; border: 0; outline: 0; color: var(--text); }
.quick input::placeholder { color: var(--muted); }
.kids-in .quick { margin-top: 6px; }
.quick-wide { margin-bottom: 24px; }
.quick-wide .quick { min-height: 52px; font-size: 16px; border-radius: 14px; }
.quick.busy { opacity: .6; }

.project-foot { display: flex; align-items: center; gap: 14px; margin-top: 34px; padding-top: 22px; border-top: 1px solid var(--line); }

/* ---------- Oggi, idee */
.list { display: grid; gap: 10px; }
.row-card { display: flex; align-items: center; padding: 2px 14px 2px 6px; }
.row-card .node { flex: 1; min-width: 0; }
.row-card.carried { border-style: dashed; background: transparent; }
.row-card::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 3px; background: var(--c, var(--accent)); }
.ideas .idea { display: flex; flex-direction: column; gap: 10px; padding: 20px; transition: transform .25s var(--ease), border-color .25s; }
.ideas .idea:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--c1) 50%, var(--line)); }
.idea-ic { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: color-mix(in srgb, var(--c1) 16%, transparent); color: var(--c1); }
.idea h3 { font: 600 19px/1.3 var(--serif); }
.idea p { color: var(--text-2); font-size: 14px; white-space: pre-wrap; }
.idea-actions { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 6px; }
.empty { display: grid; justify-items: center; gap: 10px; text-align: center; padding: 60px 20px; color: var(--text-2); }
.empty-ic { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 20px; background: var(--accent-soft); color: var(--accent-hi); margin-bottom: 6px; }
.empty h3 { font: 600 21px/1.3 var(--serif); color: var(--text); }
.empty p { max-width: 38ch; margin-bottom: 10px; }
.foot-note { text-align: center; color: var(--muted); font: italic 14px var(--serif); margin-top: 44px; }

/* ---------- finestra di dialogo */
dialog { width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); padding: 0; border: 1px solid var(--line-2); border-radius: 20px; background: var(--surface); color: var(--text); box-shadow: 0 40px 90px -20px #000; overflow: auto; }
dialog[open] { animation: pop .28s var(--ease); }
dialog::backdrop { background: rgba(10, 12, 15, .62); backdrop-filter: blur(4px); animation: fade .25s both; }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.98); } }
@keyframes fade { from { opacity: 0; } }
.dlg-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 22px 24px 4px; }
.dlg-head h2 { font: 600 24px/1.2 var(--serif); }
.dlg-head p { color: var(--muted); font-size: 14px; margin-top: 4px; }
.dlg-form { display: grid; gap: 16px; padding: 16px 24px 22px; }
.dlg-form label { display: grid; gap: 6px; font-size: 13.5px; font-weight: 600; color: var(--text-2); }
.opt { font-weight: 400; color: var(--muted); margin-left: 4px; }
.dlg-form input:not([type=checkbox]), .dlg-form select, .dlg-form textarea, .cat-new input {
  width: 100%; min-height: 46px; padding: 10px 14px; border-radius: var(--r-s); border: 1px solid var(--line-2);
  background: var(--bg); font-size: 16px; font-weight: 400; color: var(--text); transition: border-color .15s, box-shadow .15s;
}
.dlg-form textarea { resize: vertical; line-height: 1.5; }
.dlg-form input:focus, .dlg-form select:focus, .dlg-form textarea:focus, .cat-new input:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.dlg-form input[type=date] { color-scheme: dark; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.check-line { display: flex !important; align-items: center; gap: 12px; font-weight: 500 !important; color: var(--text) !important; cursor: pointer; min-height: 32px; }
.check-line em { color: var(--muted); font-style: normal; font-weight: 400; }
.check-line input { appearance: none; flex: none; width: 24px; height: 24px; border-radius: 7px; border: 2px solid var(--line-2); background: var(--bg); display: grid; place-items: center; cursor: pointer; transition: all .15s; }
.check-line input:checked { background: var(--accent); border-color: var(--accent); }
.check-line input:checked::after { content: ""; width: 6px; height: 11px; border: solid var(--accent-ink); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg) translate(-1px, -1px); }
.hint { color: var(--muted); font-size: 14px; }
.dlg-actions { display: flex; align-items: center; gap: 10px; margin-top: 4px; padding-top: 16px; border-top: 1px solid var(--line); }
.move { display: inline-flex; }
.cats { gap: 8px; }
.cat-row { display: flex; align-items: center; gap: 4px; }
.cat-row input { min-height: 42px !important; }
.dot-btn { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; flex: none; }
.dot-btn:hover { background: var(--surface-2); }
.dot-btn .dot { width: 16px; height: 16px; }
.cat-new { display: flex; gap: 10px; margin-top: 8px; }

/* ---------- accesso e pannello dati */
.auth-body { display: grid; place-items: center; min-height: 100dvh; }
.auth { width: 100%; padding: 24px 16px; animation: rise .5s var(--ease) both; }
.auth-card { max-width: 400px; margin: 0 auto; padding: 34px 30px 30px; box-shadow: 0 30px 80px -30px #000; }
.auth-brand { display: flex; align-items: center; gap: 14px; font: 600 32px/1 var(--serif); letter-spacing: -.01em; margin-bottom: 10px; }
.auth-brand i { font-style: normal; color: var(--accent); }
.auth-card .lede { margin: 0 0 22px; }
.auth-form { padding: 0; gap: 16px; }
.auth-form .btn { min-height: 48px; margin-top: 4px; }
.auth-error { margin-bottom: 18px; padding: 11px 14px; border-radius: var(--r-s); background: rgba(224, 135, 123, .12); border: 1px solid rgba(224, 135, 123, .4); color: var(--danger); font-size: 14px; }
.data-panel { gap: 22px; }
.data-panel section { display: grid; gap: 10px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.data-panel h3 { font: 600 17px/1.2 var(--serif); }
.data-panel .btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
.dlg-form.inner { padding: 0; gap: 12px; }
.dlg-form input[type=file] { padding: 9px 12px; font-size: 14px; }
.dlg-form input[type=file]::file-selector-button { margin-right: 12px; padding: 7px 14px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface-2); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.dlg-actions form { margin: 0; }

/* ---------- avviso */
#toast { position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); z-index: 50; display: flex; align-items: center; gap: 16px; padding: 12px 14px 12px 20px; border-radius: 14px; background: var(--surface-3); border: 1px solid var(--line-2); box-shadow: 0 18px 40px -12px #000; opacity: 0; transform: translate(-50%, 16px); pointer-events: none; transition: opacity .25s, transform .3s var(--ease); max-width: calc(100vw - 32px); }
#toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
#toast.err { border-color: rgba(224, 135, 123, .5); }
#toast button { font-weight: 700; color: var(--accent-hi); padding: 6px 12px; border-radius: 8px; }
#toast button:hover { background: var(--accent-soft); }

/* ---------- telefono */
@media (max-width: 860px) {
  .app { display: block; }
  .side { display: none; }
  .topbar { display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 20; padding: calc(10px + env(safe-area-inset-top, 0px)) 18px 10px; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
  .topbar .brand { padding: 0; font-size: 22px; }
  main { padding: 22px 16px calc(104px + var(--safe-b)); }
  .page-head { flex-direction: column; align-items: stretch; gap: 16px; margin-bottom: 22px; }
  .page-head > .btn { align-self: flex-start; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 13px; gap: 11px; }
  .stat-ic { width: 38px; height: 38px; }
  .chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px 8px; padding: 0 16px 6px; scrollbar-width: none; }
  .chips::-webkit-scrollbar { display: none; }
  .fchip { flex: none; }
  .grid { grid-template-columns: 1fr; }
  .newcard { min-height: 96px; grid-auto-flow: column; justify-content: center; }
  .newcard span { width: 38px; height: 38px; }
  .intro { align-items: flex-start; padding: 20px; gap: 16px; }
  .goal-big { font-size: 17px; margin-bottom: 12px; }
  .ring { --size: 92px; }
  .ring strong { font-size: 24px; }
  .stage-wrap { grid-template-columns: minmax(0, 1fr); }
  .stage-no { display: none; }
  .stage-add { padding-left: 0; }
  .node { flex-wrap: wrap; gap: 8px 10px; padding: 12px 10px 12px 2px; }
  .node-body { flex: 1 1 calc(100% - 52px); }
  .node-ctl { flex: 1 1 100%; justify-content: space-between; padding-left: 40px; }
  .stage-head .node-ctl { padding-left: 38px; }
  .kids-in { margin: 0 8px 0 18px; }
  .kids-in .node { padding-left: 4px; }
  .seg-i { width: 30px; height: 14px; }
  .icon-btn { width: 44px; height: 44px; }
  .icon-btn.sm { width: 36px; height: 36px; }
  .row-card { padding-right: 8px; }
  .row-card.carried { flex-wrap: wrap; padding-bottom: 12px; }
  .row-card.carried .btn { margin-left: 46px; }
  .project-foot { flex-wrap: wrap; }
  dialog { margin: auto auto 0; width: 100vw; max-width: 100vw; max-height: 92dvh; border-radius: 22px 22px 0 0; border-bottom: 0; padding-bottom: var(--safe-b); }
  dialog[open] { animation: sheet .32s var(--ease); }
  @keyframes sheet { from { transform: translateY(40px); opacity: 0; } }
  .dlg-head, .dlg-form { padding-left: 18px; padding-right: 18px; }
  .two { grid-template-columns: 1fr; }
  .dlg-actions { flex-wrap: wrap; }
  .tabs { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; inset: auto 0 0 0; z-index: 30; padding: 6px 8px calc(6px + var(--safe-b)); background: color-mix(in srgb, var(--side) 90%, transparent); backdrop-filter: blur(16px); border-top: 1px solid var(--line); }
  .tabs a { position: relative; display: grid; justify-items: center; gap: 3px; padding: 6px 0 4px; font-size: 11.5px; color: var(--muted); border-radius: 12px; }
  .tabs a.on { color: var(--accent-hi); }
  .tabs a.on::before { content: ""; position: absolute; top: -7px; width: 28px; height: 3px; border-radius: 3px; background: var(--accent); }
  .tabs .count { position: absolute; top: 0; left: calc(50% + 6px); margin: 0; font-size: 10.5px; padding: 0 6px; }
  #toast { bottom: calc(86px + var(--safe-b)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
