/* ==========================================================
   Organice Studio — gestionale Professional Organizer
   Palette: #E7E3DF · #C8CCC8 · #AD9C8A · #7C929E · #6D4D34
   ========================================================== */
:root {
  /* palette di riferimento */
  --linen: #E7E3DF;
  --mist: #C8CCC8;
  --taupe: #AD9C8A;
  --slate: #7C929E;
  --walnut: #6D4D34;

  /* superfici */
  --bg: #F6F3EF;
  --paper: #FDFCFA;
  --panel: #F1EDE8;
  --line: #E4DED7;
  --line-strong: #D5CDC4;

  /* testo */
  --ink: #3E3833;
  --ink-soft: #6B625B;
  --muted: #9A9089;

  /* tinte per i riquadri (derivate dalla palette) */
  --tint-sand: #F0E8DF;
  --tint-sage: #E4E7E2;
  --tint-rose: #EDE4E0;
  --tint-sky: #E2E8EB;
  --tint-bark: #EBE1D8;

  --accent: var(--walnut);
  --accent-soft: #8A6A50;
  --ok: #7D8F78;
  --warn: #B88A5A;
  --danger: #A8654F;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(62, 56, 51, .04), 0 6px 18px rgba(62, 56, 51, .05);
  --shadow-lg: 0 20px 50px rgba(62, 56, 51, .18);

  --font-sans: 'Raleway', 'Helvetica Neue', Arial, sans-serif;
  --font-serif: 'Cormorant Garamond', Georgia, serif;
  --font-script: 'Allura', 'Snell Roundhand', cursive;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
/* Comportamento da app su iPhone/iPad: niente zoom col doppio tocco, niente rimbalzo
   della pagina, niente riquadro grigio al tocco */
html, body { touch-action: manipulation; overscroll-behavior: none; }
* { -webkit-tap-highlight-color: transparent; }
.nav a, .btn, .chip, .tile, .tabs a, .step, .icon-btn, .quick button, .quick a { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { font-weight: 400; margin: 0; color: var(--ink); }
p { margin: 0 0 .6em; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--tint-sand); }

.svg-icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding: 26px 18px 22px;
  overflow-y: auto;
}
.brand { text-decoration: none; display: flex; align-items: center; gap: 10px; padding: 0 6px 20px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.brand-logo { width: 46px; height: 46px; flex: none; margin-left: -4px; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-size: 17px; font-weight: 400; letter-spacing: .01em; color: var(--ink); line-height: 1.2; white-space: nowrap; }
.brand-sub { font-size: 8.5px; letter-spacing: .14em; line-height: 1.5; text-transform: uppercase; color: var(--muted); margin-top: 3px; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: 10px;
  text-decoration: none; color: var(--ink-soft); font-size: 13.5px;
  transition: background .15s, color .15s;
}
.nav a .svg-icon { color: var(--taupe); }
.nav a:hover { background: rgba(255,255,255,.55); color: var(--ink); }
.nav a.active { background: var(--paper); color: var(--ink); box-shadow: var(--shadow); }
.nav a.active .svg-icon { color: var(--walnut); }
.nav .nav-count { margin-left: auto; font-size: 11px; background: var(--tint-sand); color: var(--walnut); border-radius: 20px; padding: 1px 8px; }
.nav-label { font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); padding: 16px 12px 6px; }

.sidebar-quote { margin-top: auto; padding: 28px 10px 0; text-align: center; color: var(--ink-soft); }
.sidebar-quote p { font-family: var(--font-serif); font-style: italic; font-size: 16px; line-height: 1.4; margin: 10px 0 0; }
.sprig { width: 34px; height: 52px; margin: 0 auto; stroke: var(--taupe); fill: none; stroke-width: 1.1; }

.main { min-width: 0; }
.topbar { display: none; }
.view { max-width: 1180px; margin: 0 auto; padding: 34px 40px 80px; }

/* ---------- page head ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 26px; flex-wrap: wrap; }
.page-head h1 { font-size: 34px; font-weight: 300; letter-spacing: -.01em; line-height: 1.15; }
.page-head .lead { font-family: var(--font-serif); font-size: 18px; color: var(--ink-soft); margin: 6px 0 0; }
.eyebrow, .section-label {
  font-size: 10.5px; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-soft); font-weight: 500; margin: 0 0 8px;
}
.section-label { display: flex; align-items: center; gap: 10px; margin: 30px 0 14px; }
.section-label .spacer { flex: 1; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); text-decoration: none; margin-bottom: 12px; }
.back-link:hover { color: var(--ink); }
.back-link .svg-icon { width: 15px; height: 15px; }

/* ---------- cards ---------- */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 18px; }
.grid > .card { margin-top: 0; }
.card-title { display: flex; align-items: center; gap: 10px; font-size: 10.5px; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-soft); font-weight: 500; margin: 0 0 16px; }
.card-title .svg-icon { color: var(--taupe); width: 17px; height: 17px; }
.card-title .actions { margin-left: auto; display: flex; gap: 8px; letter-spacing: normal; text-transform: none; }
.card-sub { font-family: var(--font-serif); font-size: 16px; color: var(--ink-soft); margin: -8px 0 16px; }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }

/* intro card stile "central place" */
.intro {
  display: flex; align-items: center; gap: 20px;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 24px; box-shadow: var(--shadow);
}
.intro-badge { width: 52px; height: 52px; border-radius: 50%; background: var(--taupe); display: grid; place-items: center; flex: none; }
.intro-badge .svg-icon { color: #fff; width: 24px; height: 24px; }
.intro p { font-family: var(--font-serif); font-size: 17px; line-height: 1.45; margin: 0; color: var(--ink-soft); }
.intro strong { font-weight: 500; color: var(--ink); }

.date-card { border: 1px solid var(--line-strong); border-radius: 12px; padding: 12px 18px; background: var(--paper); text-align: center; min-width: 190px; box-shadow: var(--shadow); }
.date-card .eyebrow { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0; }
.date-card .eyebrow .svg-icon { width: 15px; height: 15px; color: var(--taupe); }
.date-card .date { font-family: var(--font-serif); font-size: 18px; margin-top: 3px; }
.date-card .script { font-family: var(--font-script); font-size: 22px; color: var(--slate); line-height: 1; }

/* stat */
.stat { padding: 18px 20px; }
.stat .num { font-size: 30px; font-weight: 300; line-height: 1.1; color: var(--ink); }
.stat .lbl { font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }
.stat .hint { font-family: var(--font-serif); color: var(--ink-soft); font-size: 15px; margin-top: 6px; }

/* ---------- tiles (categorie) ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 14px; }
.tile {
  border-radius: 12px; padding: 22px 14px 16px; text-align: center; text-decoration: none;
  border: 1px solid rgba(0,0,0,.025); display: flex; flex-direction: column; align-items: center;
  transition: transform .18s, box-shadow .18s; cursor: pointer; background: var(--tint-sand);
}
.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.tile .svg-icon { width: 38px; height: 38px; stroke-width: 1.1; color: var(--walnut); margin-bottom: 12px; }
.tile .t-name { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink); font-weight: 500; }
.tile .t-step { font-family: var(--font-serif); font-style: italic; color: var(--ink-soft); font-size: 14px; }
.tile .t-count { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.tile .t-open { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--ink-soft); margin-top: 8px; }
.tile .t-open .svg-icon { width: 13px; height: 13px; margin: 0; stroke-width: 1.5; color: var(--ink-soft); }
.tint-sand { background: var(--tint-sand); }
.tint-sage { background: var(--tint-sage); }
.tint-rose { background: var(--tint-rose); }
.tint-sky  { background: var(--tint-sky); }
.tint-bark { background: var(--tint-bark); }

/* ---------- liste ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.list li:last-child { border-bottom: 0; }
.list .svg-icon { color: var(--taupe); width: 16px; height: 16px; }
.list .meta { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }
.list a { text-decoration: none; }
.list a:hover { color: var(--walnut); }
.quick a, .quick button { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; background: none; text-align: left; padding: 8px 0; cursor: pointer; font-family: var(--font-serif); font-size: 16px; color: var(--ink); text-decoration: none; }
.quick a:hover, .quick button:hover { color: var(--walnut); }
.quick .svg-icon { color: var(--taupe); }

.empty { text-align: center; padding: 34px 20px; color: var(--muted); }
.empty .svg-icon { width: 34px; height: 34px; color: var(--mist); margin: 0 auto 10px; stroke-width: 1.1; }
.empty p { font-family: var(--font-serif); font-size: 17px; color: var(--ink-soft); }

/* table */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); font-weight: 500; padding: 8px 10px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
.table td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.row-link { cursor: pointer; }
.table tr.row-link:hover td { background: #FAF7F3; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table input, .table select { min-width: 0; }

/* ---------- badge / chip ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; padding: 2px 9px; border-radius: 20px; background: var(--tint-sand); color: var(--walnut); white-space: nowrap; letter-spacing: .02em; }
.badge .svg-icon { width: 12px; height: 12px; }
.badge.sage { background: var(--tint-sage); color: #56634F; }
.badge.sky { background: var(--tint-sky); color: #4F6672; }
.badge.rose { background: var(--tint-rose); color: #8A5A4A; }
.badge.ghost { background: transparent; border: 1px solid var(--line-strong); color: var(--ink-soft); }
.badge.ok { background: #E3EADF; color: #4F6448; }
.badge.warn { background: #F3E6D6; color: #8A5E2E; }

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { text-decoration: none; border: 1px solid var(--line-strong); background: var(--paper); border-radius: 20px; padding: 5px 13px; font-size: 12.5px; cursor: pointer; color: var(--ink-soft); transition: all .15s; }
.chip:hover { border-color: var(--taupe); color: var(--ink); }
.chip.on { background: var(--walnut); color: #fff; border-color: var(--walnut); }

/* ---------- bottoni ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line-strong); background: var(--paper); color: var(--ink);
  padding: 9px 16px; border-radius: 10px; font-size: 13px; font-weight: 500; cursor: pointer;
  text-decoration: none; transition: all .15s; white-space: nowrap; letter-spacing: .01em;
}
.btn .svg-icon { width: 16px; height: 16px; }
.btn:hover { border-color: var(--taupe); background: #fff; }
.btn.primary { background: var(--walnut); border-color: var(--walnut); color: #fff; }
.btn.primary:hover { background: #5C3F2A; }
.btn.soft { background: var(--tint-sand); border-color: transparent; color: var(--walnut); }
.btn.soft:hover { background: #E9DDD0; }
.btn.slate { background: var(--slate); border-color: var(--slate); color: #fff; }
.btn.slate:hover { background: #6B808C; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-soft); }
.btn.ghost:hover { background: var(--panel); }
.btn.danger { color: var(--danger); }
.btn.sm { padding: 6px 11px; font-size: 12px; border-radius: 8px; }
.btn.sm .svg-icon { width: 14px; height: 14px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.icon-btn { border: 0; background: none; padding: 6px; border-radius: 8px; cursor: pointer; color: var(--muted); display: inline-grid; place-items: center; }
.icon-btn:hover { background: var(--panel); color: var(--ink); }
.icon-btn .svg-icon { width: 16px; height: 16px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------- form ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .form-grid.cols-4 { grid-template-columns: 1fr 1fr; } }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label, .label { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft); font-weight: 500; }
.field .help { font-size: 12px; color: var(--muted); font-family: var(--font-serif); font-size: 14px; }
.input, input:not([type]), input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], input[type=date], input[type=time], input[type=search], select, textarea {
  width: 100%; background: #fff; border: 1px solid var(--line-strong); border-radius: 9px;
  padding: 9px 12px; font-size: 14px; outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 84px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--taupe); box-shadow: 0 0 0 3px rgba(173, 156, 138, .18); }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239A9089' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; }
.check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 13.5px; }
.check input { width: 16px; height: 16px; accent-color: var(--walnut); }
.inline-input { border: 0; border-bottom: 1px dashed transparent; border-radius: 0; padding: 2px 0; background: transparent; box-shadow: none !important; }
.inline-input:hover, .inline-input:focus { border-bottom-color: var(--line-strong); }
.search { position: relative; }
.search .svg-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 16px; height: 16px; }
.search input { padding-left: 34px; min-width: 240px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 18px; }
.toolbar .spacer { flex: 1; }

/* ---------- stepper 9 fasi ---------- */
.stepper { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 0; margin: 4px 0 22px; position: relative; }
.step { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 7px; cursor: pointer; position: relative; padding: 0 2px; text-decoration: none; }
.step::before { content: ""; position: absolute; top: 15px; left: -50%; right: 50%; height: 1px; background: var(--line-strong); z-index: 0; }
.step:first-child::before { display: none; }
.step.done::before, .step.current::before { background: var(--taupe); }
.step .dot { width: 31px; height: 31px; border-radius: 50%; display: grid; place-items: center; background: var(--paper); border: 1px solid var(--line-strong); font-size: 12px; color: var(--muted); position: relative; z-index: 1; transition: all .15s; }
.step .dot .svg-icon { width: 15px; height: 15px; }
.step.done .dot { background: var(--taupe); border-color: var(--taupe); color: #fff; }
.step.current .dot { background: var(--walnut); border-color: var(--walnut); color: #fff; box-shadow: 0 0 0 4px rgba(109, 77, 52, .14); }
.step .s-name { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); line-height: 1.3; }
.step.current .s-name { color: var(--ink); font-weight: 600; }
.step:hover .dot { border-color: var(--taupe); }

.progress { height: 5px; background: var(--line); border-radius: 5px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--taupe); border-radius: 5px; }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line-strong); margin-bottom: 24px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { padding: 10px 14px; text-decoration: none; font-size: 13px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; align-items: center; gap: 7px; }
.tabs a .svg-icon { width: 15px; height: 15px; }
.tabs a:hover { color: var(--ink); }
.tabs a.active { color: var(--ink); border-bottom-color: var(--walnut); font-weight: 500; }

/* ---------- progetti ---------- */
.project-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.project-card { text-decoration: none; display: flex; flex-direction: column; gap: 10px; transition: transform .15s, box-shadow .15s; }
.project-card:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(62,56,51,.09); }
.project-card h3 { font-size: 18px; font-weight: 400; }
.project-card .who { font-family: var(--font-serif); font-size: 16px; color: var(--ink-soft); }
.project-card .foot { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); }

.head-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }

/* matrice */
.matrix { display: grid; grid-template-columns: 26px 1fr 1fr; grid-template-rows: 1fr 1fr 26px; gap: 10px; }
.matrix .axis-y { grid-row: 1 / 3; writing-mode: vertical-rl; transform: rotate(180deg); text-align: center; font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.matrix .axis-x { grid-column: 2 / 4; text-align: center; font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.quad { border-radius: 12px; padding: 14px 16px; min-height: 150px; }
.quad h4 { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.quad h4 .svg-icon { width: 16px; height: 16px; color: var(--walnut); }
.quad .q-desc { font-family: var(--font-serif); font-style: italic; color: var(--ink-soft); font-size: 14px; margin: 2px 0 10px; }
.quad .q-items { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.quad .q-item { background: rgba(255,255,255,.75); border-radius: 20px; padding: 3px 6px 3px 11px; font-size: 12.5px; display: inline-flex; align-items: center; gap: 2px; }
.quad .q-item button { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 0 3px; font-size: 14px; line-height: 1; }
.quad input { background: rgba(255,255,255,.8); font-size: 13px; padding: 7px 10px; }

/* gallery */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.photo { position: relative; border-radius: 10px; overflow: hidden; background: var(--panel); aspect-ratio: 4 / 3; }
.photo img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }
.photo .cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 10px 7px; background: linear-gradient(transparent, rgba(40,32,26,.6)); color: #fff; font-size: 11.5px; display: flex; justify-content: space-between; align-items: center; }
.photo .cap button { background: rgba(255,255,255,.2); border: 0; color: #fff; border-radius: 6px; cursor: pointer; padding: 2px 5px; }
.upload-tile { border: 1.5px dashed var(--line-strong); border-radius: 10px; aspect-ratio: 4 / 3; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--muted); cursor: pointer; font-size: 12.5px; text-align: center; padding: 10px; background: rgba(255,255,255,.4); }
.upload-tile:hover { border-color: var(--taupe); color: var(--ink); }
.upload-tile input { display: none; }
.upload-tile .svg-icon { width: 26px; height: 26px; stroke-width: 1.2; }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.compare figure { margin: 0; }
.compare figcaption { font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); margin-top: 6px; text-align: center; }

/* kanban */
.kanban { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.kcol { background: var(--panel); border-radius: 12px; padding: 12px; min-height: 160px; transition: background .15s; }
.kcol.drag-over { background: var(--tint-sand); }
.kcol h4 { font-size: 10.5px; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-soft); font-weight: 600; display: flex; justify-content: space-between; margin: 2px 4px 10px; }
.kcard { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; cursor: grab; box-shadow: 0 1px 2px rgba(0,0,0,.03); }
.kcard:active { cursor: grabbing; }
.kcard.dragging { opacity: .4; }
.kcard .k-title { font-size: 13.5px; }
.kcard .k-meta { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 11.5px; color: var(--muted); flex-wrap: wrap; }
.kcard .k-actions { display: flex; gap: 2px; margin-left: auto; }

.task-form { grid-template-columns: 2fr 1fr 1fr 1fr auto; align-items: end; margin-bottom: 18px; }
@media (max-width: 760px) { .task-form { grid-template-columns: 1fr 1fr; } .task-form .field:first-child { grid-column: 1 / -1; } }

/* gantt */
.gantt { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.gantt-inner { min-width: 100%; display: grid; }
.g-row { display: grid; grid-template-columns: 190px 1fr; border-bottom: 1px solid var(--line); min-height: 38px; align-items: center; }
.g-row:last-child { border-bottom: 0; }
.g-label { padding: 6px 12px; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-right: 1px solid var(--line); height: 100%; display: flex; align-items: center; position: sticky; left: 0; background: #fff; z-index: 1; }
.g-track { position: relative; height: 100%; display: grid; }
.g-days { display: grid; font-size: 10px; color: var(--muted); text-align: center; }
.g-days span { padding: 6px 0; border-left: 1px solid var(--line); }
.g-days span.we { background: #FAF8F5; }
.g-days span.today { color: var(--walnut); font-weight: 700; }
.g-bar { height: 20px; border-radius: 6px; align-self: center; font-size: 10.5px; color: #fff; padding: 0 8px; display: flex; align-items: center; overflow: hidden; white-space: nowrap; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--ink-soft); margin-top: 12px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* checklist */
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.checklist li:last-child { border-bottom: 0; }
.checklist li.done .txt { text-decoration: line-through; color: var(--muted); }
.checklist .txt { flex: 1; }
.checklist .meta { color: var(--muted); font-size: 12px; }
.checklist input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--walnut); flex: none; }
.add-row { display: flex; gap: 8px; margin-top: 12px; }
.add-row input { flex: 1; }

/* timer */
.timer { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.timer .clock { font-size: 44px; font-weight: 300; font-variant-numeric: tabular-nums; letter-spacing: .02em; color: var(--ink); }
.timer .pulse { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: pulse 1.4s infinite; display: inline-block; margin-right: 8px; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
.sig-thumb { height: 34px; width: auto; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; }

/* stelle */
.rating { display: inline-flex; gap: 2px; }
.rating button { border: 0; background: none; cursor: pointer; padding: 2px; color: var(--line-strong); }
.rating button.on { color: var(--taupe); }
.rating .svg-icon { width: 22px; height: 22px; }
.rating button.on .svg-icon { fill: currentColor; }
.q-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.q-row:last-child { border-bottom: 0; }
.q-row span { font-family: var(--font-serif); font-size: 16.5px; }

/* totali */
.totals { margin-left: auto; max-width: 360px; width: 100%; }
.totals .t-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 13.5px; color: var(--ink-soft); }
.totals .t-row.grand { border-top: 1px solid var(--line-strong); margin-top: 6px; padding-top: 12px; font-size: 18px; color: var(--ink); }
.totals .t-row span:last-child { font-variant-numeric: tabular-nums; }

.big-total { font-size: 34px; font-weight: 300; }
.note { background: var(--tint-sky); border-radius: 10px; padding: 11px 14px; font-size: 13px; color: #4F6672; display: flex; gap: 10px; align-items: flex-start; }
.note .svg-icon { flex: none; margin-top: 2px; width: 16px; height: 16px; }
.note.warm { background: var(--tint-sand); color: var(--walnut); }
.serif { font-family: var(--font-serif); font-size: 16.5px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }
.mt { margin-top: 18px; }
.mt-s { margin-top: 10px; }
.mb-0 { margin-bottom: 0; }
.nowrap { white-space: nowrap; }
.flex { display: flex; align-items: center; gap: 10px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.hide { display: none !important; }
.leaf-deco { width: 90px; height: 90px; stroke: var(--taupe); fill: none; stroke-width: 1; opacity: .8; }

/* agenda */
.agenda-day { display: grid; grid-template-columns: 92px 1fr; gap: 18px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.agenda-day:last-child { border-bottom: 0; }
.agenda-date { text-align: center; }
.agenda-date .d { font-size: 28px; font-weight: 300; line-height: 1; }
.agenda-date .m { font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }
.agenda-date.past .d { color: var(--danger); }
.agenda-items { display: flex; flex-direction: column; gap: 8px; }
.agenda-item { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 10px; text-decoration: none; }
.agenda-item .svg-icon { color: var(--walnut); }
.agenda-item .a-title { font-size: 13.5px; }
.agenda-item .a-sub { font-size: 12px; color: var(--ink-soft); }
.agenda-item:hover { filter: brightness(.98); }

/* portfolio */
.portfolio { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 18px; }
.quote-block { font-family: var(--font-serif); font-style: italic; font-size: 17px; color: var(--ink-soft); border-left: 2px solid var(--taupe); padding-left: 14px; margin: 12px 0 0; }

/* ---------- modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(48, 40, 34, .35); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 20px; z-index: 100; animation: fade .18s ease; }
.modal { background: var(--paper); border-radius: 18px; width: min(640px, 100%); max-height: calc(100vh - 40px); overflow: auto; box-shadow: var(--shadow-lg); animation: rise .22s ease; }
.modal.wide { width: min(880px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px 0; }
.modal-head h3 { font-size: 21px; font-weight: 300; }
.modal-body { padding: 18px 24px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 0 24px 22px; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

.sig-pad { width: 100%; height: 220px; background: #fff; border: 1px dashed var(--line-strong); border-radius: 12px; touch-action: none; cursor: crosshair; display: block; }
.sig-line { font-size: 11px; color: var(--muted); text-align: center; margin-top: 6px; letter-spacing: .1em; text-transform: uppercase; }
/* logo nelle impostazioni */
.logo-setting { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.logo-preview { width: 112px; height: 112px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); display: grid; place-items: center; padding: 12px; flex: none; }
.logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.brand-logo, .topbar-logo, .login-logo { object-fit: contain; }

/* tour guidato */
.tour { position: fixed; inset: 0; z-index: 170; }
.tour-spot { position: fixed; border-radius: 14px; box-shadow: 0 0 0 9999px rgba(40, 33, 28, .55); transition: all .25s ease; pointer-events: none; outline: 2px solid rgba(255,255,255,.7); }
.tour.centered .tour-spot { top: 50%; left: 50%; width: 0; height: 0; outline: 0; }
.tour-card { position: fixed; background: var(--paper); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 18px 20px 16px; transition: top .25s ease, left .25s ease; }
.tour.centered .tour-card { top: 50% !important; left: 50% !important; transform: translate(-50%, -50%); width: min(420px, calc(100vw - 32px)) !important; }
.tour-card h3 { font-size: 19px; font-weight: 400; margin: 10px 0 6px; }
.tour-card p { font-family: var(--font-serif); font-size: 16.5px; color: var(--ink-soft); margin: 0 0 14px; line-height: 1.45; }
.tour-progress { display: flex; gap: 5px; }
.tour-progress i { width: 18px; height: 4px; border-radius: 4px; background: var(--line-strong); }
.tour-progress i.done { background: var(--taupe); }
.tour-progress i.on { background: var(--walnut); width: 28px; }
.tour-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tour-actions .spacer { flex: 1; }
.tour.docked:not(.centered) .tour-card { left: 50% !important; transform: translateX(-50%); bottom: calc(12px + env(safe-area-inset-bottom, 0px)); top: auto !important; width: min(520px, calc(100vw - 24px)) !important; }

/* visualizzatore foto */
.viewer { position: fixed; inset: 0; z-index: 180; background: #1C1714; display: flex; flex-direction: column; animation: fade .18s ease; color: #fff; }
.viewer-bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top, 0px)); }
.viewer-title { flex: 1; font-size: 14px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer-stage { flex: 1; min-height: 0; display: grid; place-items: center; overflow: hidden; touch-action: none; cursor: zoom-in; padding: 8px; }
.viewer-stage.zoomed { cursor: grab; }
.viewer-stage.zoomed:active { cursor: grabbing; }
.viewer-stage img { max-width: 100%; max-height: 100%; border-radius: 6px; transform-origin: center center; will-change: transform; -webkit-user-select: none; user-select: none; -webkit-user-drag: none; pointer-events: none; }
.viewer-stage img.anim { transition: transform .22s ease; }
.viewer-tools { display: flex; justify-content: center; gap: 10px; padding: 12px; padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
.viewer-btn { min-width: 44px; height: 44px; border-radius: 22px; border: 1px solid rgba(255,255,255,.22); background: rgba(255,255,255,.1); color: #fff; font-size: 20px; line-height: 1; cursor: pointer; display: inline-grid; place-items: center; padding: 0 12px; font-family: var(--font-sans); }
.viewer-btn.wide { font-size: 13px; padding: 0 18px; }
.viewer-btn .svg-icon { width: 20px; height: 20px; }
.viewer-btn:hover { background: rgba(255,255,255,.18); }

/* accesso e sincronizzazione */
body.locked .app { display: none; }
#login-root:empty { display: none; }
#login-root { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--bg); }
.login-card { width: min(400px, 100%); background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: 34px 30px 26px; box-shadow: var(--shadow); text-align: center; }
.login-logo { width: 96px; height: 96px; display: block; margin: -8px auto 0; }
.login-card h1 { font-size: 26px; font-weight: 300; margin: 6px 0 2px; }
.login-card .lead { font-family: var(--font-serif); font-size: 17px; color: var(--ink-soft); margin-bottom: 22px; }
.login-card form { display: flex; flex-direction: column; gap: 14px; text-align: left; }
.login-error { color: var(--danger); font-size: 13px; min-height: 1em; margin: 0; }
.sync-status { display: flex; align-items: center; gap: 8px; margin: 18px 10px 0; font-size: 11.5px; color: var(--muted); text-decoration: none; }
.sync-status:empty { display: none; }
.sync-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--mist); flex: none; }
.sync-status.ok i { background: var(--ok); }
.sync-status.busy i { background: var(--warn); animation: pulse 1.2s infinite; }
.sync-status.off i { background: var(--danger); }

/* anteprima documenti */
.doc-overlay { position: fixed; inset: 0; z-index: 150; background: #F1EDE8; display: flex; flex-direction: column; animation: fade .18s ease; }
.doc-bar { display: flex; align-items: center; gap: 8px; padding: 10px 16px; background: var(--paper); border-bottom: 1px solid var(--line); }
.doc-bar .doc-title { flex: 1; font-size: 14px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-overlay iframe { flex: 1; width: 100%; border: 0; background: #F1EDE8; }

/* toast */
#toast-root { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 30px; font-size: 13px; box-shadow: var(--shadow-lg); animation: rise .2s ease; display: flex; align-items: center; gap: 8px; }
.toast .svg-icon { width: 16px; height: 16px; color: var(--mist); }

/* ---------- dispositivi touch ---------- */
/* Sotto i 16px iPhone e iPad ingrandiscono la pagina quando si tocca un campo */
@media (pointer: coarse) {
  input, select, textarea, .input { font-size: 16px !important; }
}
/* Aperto dalla schermata Home: rispetta notch e barra della Home */
@supports (padding: env(safe-area-inset-top)) {
  .sidebar { padding-top: calc(26px + env(safe-area-inset-top)); padding-bottom: calc(22px + env(safe-area-inset-bottom)); padding-left: calc(18px + env(safe-area-inset-left)); }
  .view { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
  #toast-root { bottom: calc(22px + env(safe-area-inset-bottom)); }
  .doc-bar { padding-top: calc(10px + env(safe-area-inset-top)); }
}

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stepper .s-name { font-size: 8.5px; letter-spacing: .04em; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 270px; z-index: 50; transform: translateX(-100%); transition: transform .25s ease; box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(48,40,34,.3); z-index: 40; }
  .topbar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 30; background: rgba(246, 243, 239, .92); backdrop-filter: blur(8px); padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top, 0px)); padding-left: calc(16px + env(safe-area-inset-left, 0px)); padding-right: calc(16px + env(safe-area-inset-right, 0px)); border-bottom: 1px solid var(--line); }
  .topbar .icon-btn .svg-icon { width: 22px; height: 22px; color: var(--ink); }
  .topbar-title { font-size: 16px; }
  .topbar-logo { width: 30px; height: 30px; }
  .view { padding: 22px 16px 70px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .page-head h1 { font-size: 27px; }
  .stepper { grid-template-columns: repeat(9, 74px); overflow-x: auto; padding-bottom: 6px; }
  .kanban { grid-template-columns: 1fr; }
  .search input { min-width: 0; }
}
@media (max-width: 560px) {
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: 1fr 1fr; }
  .card { padding: 18px 16px; }
  .intro { flex-direction: column; text-align: center; }
  .agenda-day { grid-template-columns: 60px 1fr; gap: 10px; }
  .matrix { grid-template-columns: 1fr; grid-template-rows: none; }
  .matrix .axis-y, .matrix .axis-x { display: none; }
  .g-row { grid-template-columns: 120px 1fr; }
  .portfolio { grid-template-columns: 1fr; }
}
