/* GrowthFlow: una colonna sul viola notte (due sul Mac), per ogni cliente i lavori, sotto i task. Solo tema scuro, logo bianco. */
@font-face { font-family: 'Outfit'; font-weight: 400; font-display: swap; src: url(/fonts/Outfit-Regular.ttf) format('truetype'); }
@font-face { font-family: 'Outfit'; font-weight: 500; font-display: swap; src: url(/fonts/Outfit-Medium.ttf) format('truetype'); }
@font-face { font-family: 'Outfit'; font-weight: 600; font-display: swap; src: url(/fonts/Outfit-SemiBold.ttf) format('truetype'); }

:root {
  --bg: #130B2B;
  --surface: #1E1240;
  --surface-2: #281A52;
  --fg: #F3F0FA;
  --muted: #A99FC6;
  --line: #34265F;
  --accent: #9C80FF;
  --viola: #5B35C9;
  --corallo: #FF7A59;
  --done: #7C7299;
  --danger: #FF8A6E;
  --ok: #6FD3A4;
  --font-ui: "Outfit", "Avenir Next", -apple-system, "Segoe UI", system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--font-ui); font-size: 16px; line-height: 1.45; -webkit-tap-highlight-color: transparent;
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
button, input, textarea, select { font: inherit; color: inherit; }
button, input, textarea, select, .txt, .c-head h2, .c-note { touch-action: manipulation; }
[hidden] { display: none !important; }
.wrap { max-width: 760px; margin: 0 auto; padding-block: 24px 72px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
:focus-visible { outline: 2px solid var(--corallo); outline-offset: 2px; }

header.top { display: grid; gap: 16px; padding-bottom: 22px; }
.brandrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.logo { display: block; height: 28px; width: auto; max-width: 100%; }
.top-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.utente { font-size: 14px; color: var(--muted); }
.refresh { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--fg); cursor: pointer; }
.refresh:hover { border-color: var(--accent); color: var(--accent); }
.refresh.spin svg { animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
h1 { margin: 0; font-size: clamp(26px, 5vw, 34px); font-weight: 600; letter-spacing: -.01em; line-height: 1.15; }
.meter { display: grid; gap: 6px; }
.meter-row { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.meter-row b { color: var(--fg); font-weight: 600; }
.bar { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; border-radius: 3px; background: linear-gradient(90deg, var(--viola), var(--accent) 85%, var(--corallo)); transition: width .3s ease; }
.status { font-size: 13px; color: var(--muted); min-height: 1.2em; }
.status.err { color: var(--danger); }

/* accesso */
form.login { display: grid; gap: 8px; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 22px; }
.login-intro { margin: 0 0 6px; color: var(--muted); }
form.login label { font-size: 13px; color: var(--muted); }
form.login input { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); font-size: 16px; }
form.login .btn { margin-top: 8px; min-height: 46px; }

main { display: grid; gap: 14px; }
section.client { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px 12px; min-width: 0; }
.c-head { display: flex; align-items: center; gap: 10px; padding-bottom: 6px; flex-wrap: wrap; }
.c-head h2 { margin: 0; font-size: 19px; font-weight: 600; line-height: 1.25; flex: 1 1 160px; min-width: 0; overflow-wrap: anywhere; cursor: pointer; }
.c-count { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.stato { font-size: 12.5px; font-weight: 500; border: 1px solid var(--line); background: var(--surface-2); color: var(--fg); border-radius: 6px; padding: 3px 8px; cursor: pointer; }
.stato[data-stato="Attivo"] { color: var(--ok); }
.stato[data-stato="Lead"] { color: var(--accent); }
.stato[data-stato="In pausa"], .stato[data-stato="Concluso"] { color: var(--muted); }
.collega-btn { font-size: 12.5px; border: 1px dashed var(--muted); background: none; color: var(--muted); border-radius: 6px; padding: 3px 8px; cursor: pointer; }
.collega-btn:hover { color: var(--accent); border-color: var(--accent); }
.collega { display: grid; gap: 8px; padding: 10px 12px; margin: 4px 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.collega p { margin: 0; font-size: 14px; color: var(--muted); }
.collega select { width: 100%; padding: 9px 10px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); font-size: 16px; }
.collega .acts, form.note .acts, .proposta .acts { display: flex; gap: 8px; flex-wrap: wrap; }

.c-note { margin: 0 0 8px; color: var(--muted); font-size: 14.5px; white-space: pre-wrap; overflow-wrap: anywhere; cursor: pointer; }
.note-link { border: 0; background: none; color: var(--muted); font-size: 13.5px; padding: 0 0 8px; cursor: pointer; }
.note-link:hover { color: var(--accent); }
form.note { display: grid; gap: 8px; padding: 2px 0 10px; }
form.note textarea { width: 100%; min-height: 84px; resize: vertical; padding: 9px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); font-size: 16px; line-height: 1.45; }

.lettura { margin: 0 0 10px; font-size: 13.5px; color: var(--accent); animation: pulsa 1.4s ease-in-out infinite; }
@keyframes pulsa { 50% { opacity: .45; } }
.proposta { margin: 0 0 10px; padding: 10px 12px; border: 1px solid var(--viola); border-radius: 8px; background: var(--surface-2); display: grid; gap: 8px; font-size: 14.5px; }
.proposta b { color: var(--accent); font-weight: 600; }
.proposta ul { margin: 0; padding-left: 18px; list-style: disc; }
.proposta .why { color: var(--muted); font-size: 13.5px; }

ul { list-style: none; margin: 0; padding: 0; }
li.job { border-top: 1px solid var(--line); padding: 10px 0 8px; }
.row { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start; }
.row .txt { min-width: 0; overflow-wrap: anywhere; cursor: pointer; padding-top: 1px; }
.job > .row .txt .title { font-weight: 500; }
.row .txt .desc { display: block; margin-top: 2px; font-size: 13.5px; color: var(--muted); white-space: pre-wrap; }
.row .txt .meta { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 3px; font-size: 12.5px; color: var(--muted); }
.meta .data { font-variant-numeric: tabular-nums; }
.meta .data.late { color: var(--danger); font-weight: 500; }
.meta .data.soon { color: var(--accent); font-weight: 500; }
.meta .crm { color: var(--ok); }
.meta .warn { color: var(--danger); }
.sub-count { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; padding-top: 3px; white-space: nowrap; }
li.done > .row .txt .title { color: var(--done); text-decoration: line-through; text-decoration-color: var(--line); }
li.done > .row .txt .desc { color: var(--done); }

ul.subs { margin: 4px 0 0 32px; }
li.sub { padding: 5px 0; }
li.sub .row { grid-template-columns: auto 1fr; gap: 10px; font-size: 15px; }

input[type="checkbox"] { appearance: none; -webkit-appearance: none; width: 20px; height: 20px; margin: 1px 0 0; border: 1.5px solid var(--muted); border-radius: 5px; background: transparent; cursor: pointer; display: grid; place-content: center; }
li.sub input[type="checkbox"] { width: 17px; height: 17px; border-radius: 4px; margin-top: 2px; }
input[type="checkbox"]::after { content: ""; width: 9px; height: 5px; border: solid var(--bg); border-width: 0 0 2px 2px; transform: rotate(-45deg) translate(1px, -1px); opacity: 0; }
input[type="checkbox"]:checked { background: var(--accent); border-color: var(--accent); }
input[type="checkbox"]:checked::after { opacity: 1; }
input[type="checkbox"]:disabled { cursor: default; opacity: .6; }

.add-link { border: 0; background: none; color: var(--muted); font-size: 14px; padding: 4px 0; cursor: pointer; text-align: left; }
.add-link:hover { color: var(--accent); }
.subs + .add-link, li.job > .add-link { margin-left: 32px; }
.add-link.job-add { margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--line); width: 100%; }

form.inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 4px 0; }
li.job > form.inline, .subs + form.inline { margin-left: 32px; }
form.inline input[type="text"] { flex: 1 1 220px; min-width: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); font-size: 16px; }
form.inline .data-field { order: 1; display: flex; align-items: center; gap: 8px; flex: 1 1 100%; font-size: 13.5px; color: var(--muted); flex-wrap: wrap; }
form.inline .data-field input { padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); font-size: 16px; color-scheme: dark; }
form.inline textarea.desc-input { flex: 1 1 100%; order: 1; min-width: 0; min-height: 60px; resize: vertical; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); font-size: 16px; line-height: 1.4; }
form.inline .btn { order: 2; }
.btn { font-size: 14px; font-weight: 500; padding: 8px 13px; border: 0; border-radius: 6px; background: var(--fg); color: var(--bg); cursor: pointer; white-space: nowrap; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.ghost { background: transparent; color: var(--fg); border: 1px solid var(--line); }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--line); }
.btn.danger.confirm { background: var(--danger); color: var(--bg); border-color: var(--danger); }

.new-client form.inline { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.empty { padding: 28px 18px; border: 1px dashed var(--line); border-radius: 10px; color: var(--muted); text-align: center; }
.empty b { color: var(--fg); display: block; font-weight: 500; margin-bottom: 4px; }
.hint { margin-top: 28px; font-size: 13px; color: var(--muted); }

@media (max-width: 520px) {
  section.client { padding: 14px 14px 10px; }
  ul.subs, .subs + .add-link, li.job > .add-link, li.job > form.inline, .subs + form.inline { margin-left: 22px; }
  form.inline input[type="text"] { flex-basis: 100%; }
  form.inline .btn, form.note .acts .btn, .collega .acts .btn, .proposta .acts .btn { flex: 1 1 0; }
  .c-head h2 { font-size: 18px; }
  .utente { display: none; }
}
@media (pointer: coarse) {
  input[type="checkbox"] { width: 26px; height: 26px; border-radius: 7px; margin-top: -2px; }
  li.sub input[type="checkbox"] { width: 22px; height: 22px; border-radius: 6px; margin-top: -1px; }
  input[type="checkbox"]::after { width: 11px; height: 6px; }
  .row { gap: 14px; }
  li.job { padding: 12px 0 8px; }
  li.sub { padding: 7px 0; }
  .btn { min-height: 44px; padding-inline: 16px; }
  .btn.small { min-height: 36px; }
  .refresh { width: 44px; height: 44px; }
  .add-link, .note-link { min-height: 44px; padding-block: 10px; }
  .stato, .collega-btn { min-height: 34px; padding-inline: 10px; }
  form.inline input[type="text"] { min-height: 44px; }
  ul.subs, .subs + .add-link, li.job > .add-link, li.job > form.inline, .subs + form.inline { margin-left: 40px; }
}
@media (pointer: coarse) and (max-width: 520px) {
  ul.subs, .subs + .add-link, li.job > .add-link, li.job > form.inline, .subs + form.inline { margin-left: 30px; }
}
@media (min-width: 1100px) {
  .wrap { max-width: 1200px; }
  main { display: block; columns: 2; column-gap: 16px; }
  main > * { break-inside: avoid; margin-bottom: 16px; }
  main > .new-client, main > .empty { column-span: all; }
  section.client { display: inline-block; width: 100%; }
}
/* app installata (Mac, iPhone): spazio sotto la barra di stato */
@media (display-mode: standalone) { .wrap { padding-top: 14px; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
