/* ==========================================================================
   Ager Novus — design system MVP (self-contained, zero dipendenze CDN)
   Spirito str4t0s: sans pulito, palette terra/verde, mobile-first.
   Usato da: sito pubblico (public/) e console interna (console/).
   Per la produzione valutare migrazione a str4t0s via CDN (vedi docs/adr).
   ========================================================================== */

:root {
  /* palette */
  --bg:        #f6f4ee;   /* sabbia/carta */
  --surface:   #ffffff;
  --surface-2: #efece3;
  --ink:       #1b2a22;   /* verde quasi-nero */
  --ink-soft:  #4a574d;
  --muted:     #6f7b70;   /* salvia */
  --line:      #e3ded1;
  --line-2:    #d3ccbb;

  --green:     #2e5e3a;   /* foresta — primario */
  --green-dk:  #234a2e;
  --green-lt:  #eaf1ea;
  --clay:      #b5502e;   /* terracotta — accento/CTA */
  --clay-dk:   #97401f;
  --clay-lt:   #f6e9e2;

  --ok:        #2f855a;
  --warn:      #b45309;
  --danger:    #b3261e;
  --hot:       #b5502e;
  --warm:      #b45309;
  --cold:      #6f7b70;

  /* forma */
  --r:   14px;
  --r-s: 10px;
  --r-xs: 7px;
  --shadow:    0 1px 2px rgba(27,42,34,.05), 0 6px 20px rgba(27,42,34,.06);
  --shadow-lg: 0 12px 40px rgba(27,42,34,.12);
  --maxw: 1080px;

  /* type */
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, "Apple Color Emoji", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 .4em; font-weight: 700; }
h1 { font-size: clamp(2rem, 5vw, 3.1rem); }
h2 { font-size: clamp(1.5rem, 3.4vw, 2.1rem); }
h3 { font-size: 1.22rem; }
p { margin: 0 0 1rem; }
.lead { font-size: 1.2rem; color: var(--ink-soft); }
.small { font-size: .9rem; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }

/* ---- layout ---- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }
.section { padding: 72px 0; }
.section.tight { padding: 44px 0; }
.grid { display: grid; gap: 22px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 860px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}
.center { text-align: center; }
.eyebrow {
  display: inline-block; font-size: .8rem; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--clay); margin-bottom: 12px;
}
.divider { height: 1px; background: var(--line); border: 0; margin: 0; }

/* ---- top nav ---- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav-in { display: flex; align-items: center; justify-content: space-between; height: 62px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -.02em; font-size: 1.2rem; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand .mark {
  width: 26px; height: 26px; border-radius: 7px; flex: 0 0 auto;
  background: linear-gradient(135deg, var(--green) 0%, var(--green-dk) 100%);
  display: grid; place-items: center; color: #fff; font-size: 15px;
}
.nav-links { display: flex; align-items: center; gap: 22px; }
.nav-links a { color: var(--ink-soft); font-size: .96rem; font-weight: 500; }
.nav-links a:hover { color: var(--ink); text-decoration: none; }
@media (max-width: 680px) { .nav-links a.hide-sm { display: none; } }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  font: inherit; font-weight: 650; font-size: 1rem; line-height: 1;
  padding: 14px 22px; border-radius: 999px; border: 1px solid transparent;
  cursor: pointer; transition: transform .08s ease, box-shadow .15s ease, background .15s ease;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--clay); color: #fff; box-shadow: var(--shadow); }
.btn-primary:hover { background: var(--clay-dk); }
.btn-green { background: var(--green); color: #fff; box-shadow: var(--shadow); }
.btn-green:hover { background: var(--green-dk); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-2); }
.btn-ghost:hover { background: var(--surface); border-color: var(--muted); }
.btn-lg { padding: 17px 30px; font-size: 1.08rem; }
.btn-block { display: flex; width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---- cards ---- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 26px; box-shadow: var(--shadow);
}
.card h3 { margin-top: 0; }
.card-ico {
  width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center;
  font-size: 22px; background: var(--green-lt); margin-bottom: 14px;
}
.card.accent { border-color: var(--clay); }
.card.accent .card-ico { background: var(--clay-lt); }

/* ---- path chooser (dual: impresa/privato) ---- */
.paths { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 760px) { .paths { grid-template-columns: 1fr; } }
.path {
  position: relative; display: block; background: var(--surface);
  border: 1.5px solid var(--line-2); border-radius: var(--r);
  padding: 30px 28px; transition: border-color .15s, box-shadow .15s, transform .1s;
}
.path:hover { text-decoration: none; border-color: var(--green); box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.path .k { font-size: .82rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.path h3 { font-size: 1.5rem; margin: 8px 0 8px; color: var(--ink); }
.path p { color: var(--ink-soft); margin-bottom: 18px; }
.path .go { color: var(--green); font-weight: 700; display: inline-flex; align-items: center; gap: 6px; }
.path.b2b { border-top: 4px solid var(--green); }
.path.b2c { border-top: 4px solid var(--clay); }

/* ---- hero ---- */
.hero { padding: 84px 0 64px; position: relative; overflow: hidden; }
.hero-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 48px; align-items: center; }
@media (max-width: 900px) { .hero-grid { grid-template-columns: 1fr; gap: 30px; } }
.hero h1 { margin-bottom: 18px; }
.hero .lead { margin-bottom: 28px; max-width: 40ch; }
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; }
.hero-art {
  aspect-ratio: 4/3; border-radius: var(--r); border: 1px solid var(--line);
  background:
    radial-gradient(120% 90% at 80% 10%, #cfe0cb 0%, transparent 55%),
    linear-gradient(160deg, #3c6b45 0%, #2e5e3a 45%, #234a2e 100%);
  box-shadow: var(--shadow-lg); position: relative; overflow: hidden;
  display: grid; place-items: center;
}
.hero-art .layers { position: absolute; inset: 0; }
.hero-art .layers span { position: absolute; left: 0; right: 0; }
.hero-badge {
  position: absolute; bottom: 16px; left: 16px; right: 16px;
  background: rgba(255,255,255,.94); border-radius: 12px; padding: 12px 15px;
  font-size: .85rem; color: var(--ink); display: flex; align-items: center; gap: 10px;
  box-shadow: var(--shadow);
}
.hero-badge .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); flex: 0 0 auto; }

/* ---- stats strip ---- */
.stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 0; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--surface); }
@media (max-width:760px){ .stats { grid-template-columns: 1fr; } }
.stat { padding: 22px 24px; border-right: 1px solid var(--line); }
.stat:last-child { border-right: 0; }
@media (max-width:760px){ .stat { border-right: 0; border-bottom: 1px solid var(--line); } .stat:last-child{border-bottom:0;} }
.stat .n { font-size: 1.7rem; font-weight: 800; color: var(--green); letter-spacing: -.02em; }
.stat .l { font-size: .92rem; color: var(--muted); }

/* ---- steps (processo digitale) ---- */
.steps { counter-reset: s; display: grid; gap: 16px; }
.step { display: grid; grid-template-columns: 46px 1fr; gap: 16px; align-items: start; }
.step .num {
  counter-increment: s; width: 46px; height: 46px; border-radius: 50%;
  background: var(--green); color: #fff; display: grid; place-items: center; font-weight: 800;
}
.step .num::before { content: counter(s); }
.step h4 { margin: 4px 0 4px; font-size: 1.08rem; }
.step p { margin: 0; color: var(--ink-soft); }

/* ---- badges / pills ---- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 700;
  padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--ink-soft);
  background: var(--surface); white-space: nowrap;
}
.badge.green { background: var(--green-lt); border-color: transparent; color: var(--green-dk); }
.badge.clay  { background: var(--clay-lt); border-color: transparent; color: var(--clay-dk); }
.badge.hot   { background: #f7e6df; border-color: transparent; color: var(--clay-dk); }
.badge.warm  { background: #f7edda; border-color: transparent; color: #8a5a12; }
.badge.cold  { background: #ecefec; border-color: var(--line-2); color: var(--muted); }
.badge.ok    { background: #e4f2ea; border-color: transparent; color: var(--ok); }

/* ---- forms ---- */
.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 650; font-size: .95rem; margin-bottom: 6px; }
.field .hint { font-size: .84rem; color: var(--muted); margin: 2px 0 8px; }
.req { color: var(--clay); }
input[type=text], input[type=email], input[type=tel], input[type=number], select, textarea {
  width: 100%; font: inherit; font-size: 1rem; color: var(--ink);
  background: var(--surface); border: 1.5px solid var(--line-2); border-radius: var(--r-s);
  padding: 12px 14px; transition: border-color .12s, box-shadow .12s;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--green);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 18%, transparent);
}
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 10px; }
.choice {
  position: relative; border: 1.5px solid var(--line-2); border-radius: var(--r-s);
  padding: 12px 14px; cursor: pointer; background: var(--surface); transition: border-color .12s, background .12s;
  display: flex; gap: 10px; align-items: flex-start;
}
.choice:hover { border-color: var(--green); }
.choice input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.choice .cx { font-weight: 650; font-size: .96rem; }
.choice .cd { font-size: .82rem; color: var(--muted); }
.choice:has(input:checked) { border-color: var(--green); background: var(--green-lt); }
.choice:has(input:focus-visible) { box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 18%, transparent); }

/* dropzone */
.dropzone {
  border: 2px dashed var(--line-2); border-radius: var(--r); padding: 26px; text-align: center;
  background: var(--surface); cursor: pointer; transition: border-color .12s, background .12s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--green); background: var(--green-lt); }
.dropzone .di { font-size: 30px; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px,1fr)); gap: 8px; margin-top: 12px; }
.thumb { position: relative; aspect-ratio: 1; border-radius: var(--r-xs); overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb button { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; font-size: 13px; line-height: 1; }

.callout { background: var(--green-lt); border: 1px solid transparent; border-left: 4px solid var(--green); border-radius: var(--r-s); padding: 16px 18px; }
.callout.clay { background: var(--clay-lt); border-left-color: var(--clay); }

/* ---- footer ---- */
.footer { border-top: 1px solid var(--line); padding: 40px 0; color: var(--muted); font-size: .92rem; margin-top: 40px; }
.footer-in { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.footer a { color: var(--ink-soft); }

/* ==========================================================================
   Componenti DASHBOARD / console interna
   ========================================================================== */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-s); padding: 14px 16px; }
.kpi .k { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.kpi .v { font-size: 1.7rem; font-weight: 800; color: var(--ink); letter-spacing: -.02em; margin-top: 2px; }
.kpi .s { font-size: .82rem; color: var(--muted); }
.kpi.accent { border-left: 3px solid var(--clay); }
.kpi.green { border-left: 3px solid var(--green); }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 18px 0; }
.toolbar .grow { flex: 1; }
.chip {
  font: inherit; font-size: .85rem; font-weight: 600; padding: 6px 13px; border-radius: 999px;
  border: 1.5px solid var(--line-2); background: var(--surface); color: var(--ink-soft); cursor: pointer;
}
.chip[aria-pressed=true] { background: var(--ink); color: #fff; border-color: var(--ink); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-s); background: var(--surface); }
table.data { width: 100%; border-collapse: collapse; font-size: .92rem; min-width: 760px; }
table.data th, table.data td { text-align: left; padding: 11px 13px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data th { font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: var(--surface-2); position: sticky; top: 0; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr:hover td { background: color-mix(in srgb, var(--green-lt) 45%, transparent); }
.reff { font-family: var(--mono); font-size: .82rem; font-weight: 600; }
.flags { display: flex; gap: 4px; flex-wrap: wrap; }
.flag { font-size: .68rem; font-weight: 700; padding: 2px 7px; border-radius: 5px; background: var(--surface-2); color: var(--ink-soft); border: 1px solid var(--line); white-space: nowrap; }
.flag.pc { background: #eef3ee; color: var(--green-dk); border-color: transparent; }
.flag.td { background: #f4ece2; color: #8a5a12; border-color: transparent; }
.flag.wl { background: #e9efe9; color: var(--green-dk); border-color: transparent; }
.flag.pd { background: #eef0f3; color: #445; border-color: transparent; }
.dot-score { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.dot-score.caldo { background: var(--clay); } .dot-score.tiepido { background: var(--warn); } .dot-score.freddo { background: var(--muted); }
select.mini { font: inherit; font-size: .82rem; padding: 4px 8px; border-radius: 6px; border: 1px solid var(--line-2); background: var(--surface); }
.linkbtn { font: inherit; font-size: .85rem; color: var(--green); background: none; border: 0; cursor: pointer; padding: 0; text-decoration: underline; }

.banner-demo { background: #234a2e; color: #fff; padding: 9px 20px; font-size: .82rem; text-align: center; }
.print-hide {}
@media print { .print-hide, .nav, .banner-demo, .toolbar { display: none !important; } body { background: #fff; } }

/* ---- utility ---- */
.mt0{margin-top:0} .mb0{margin-bottom:0} .mt1{margin-top:12px} .mt2{margin-top:24px} .mt3{margin-top:36px}
.hide { display: none !important; }
.tag-wl { background: linear-gradient(135deg,#2e5e3a,#234a2e); color:#fff; padding:2px 9px; border-radius:999px; font-size:.72rem; font-weight:700; letter-spacing:.04em; }
