/* ═══════════════════════════════════════════════════════════════════════
   RetinoKitchen — veste «framed sheet» (tasteskill, seme 1869936127)
   Cornice dell'app in un grigio pietra (il top in quarzo), il lavoro su un
   foglio bianco con bordo di 1 px e nessuna ombra. Un solo colore, petrolio,
   sui dati e sulle selezioni; il pulsante principale è quasi nero.
   ═══════════════════════════════════════════════════════════════════════ */
:root {
  --ground: #f3f3f1;          /* cornice: pietra chiara */
  --surface: #ffffff;
  --raised: #f4f5f5;
  --well: #eef0f0;            /* tela di disegno e anteprime 3D */
  --active: #e6e7e6;
  --border: #e5e6e5;
  --rule: #efefee;
  --control: #cdcecd;
  --text: #131416;
  --muted: #5b5d5e;
  --faint: #66686a;
  --primary: #1b1c1e;
  --accent: #1b6c80;          /* petrolio: dati, selezione, segno del marchio */
  --accent-tint: #e3eff2;
  --positive: #1e7b4f;
  --negative: #c4242a;
  --pill-positive-bg: #dcfae5; --pill-positive-ink: #04250e;
  --pill-warning-bg: #fffbeb;  --pill-warning-ink: #92400e;
  --pill-neutral-bg: #ebedee;  --pill-neutral-ink: #353736;
  --radius-sheet: 16px;
  --radius-card: 8px;
  --radius-control: 6px;
  --inset: 8px;
  --gap: 24px;
  --pad: 24px;
  --control-height: 32px;
  --fs-title: 22px;
  --fs-section: 16px;
  --fs-body: 14px;
  --fs-small: 12px;
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-num: 'Inter', system-ui, sans-serif;     /* solo cifre: tabellari */
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); font-size: var(--fs-body); line-height: 20px;
  color: var(--text); background: var(--ground); -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
svg { display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── controlli ──────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: var(--control-height); padding: 0 12px; border-radius: var(--radius-control);
  border: 1px solid var(--control); background: var(--surface);
  font-weight: 600; font-size: 13px; line-height: 1; white-space: nowrap;
  transition: background-color .12s, border-color .12s;
}
.btn:hover { background: var(--raised); }
.btn:active { background: var(--active); }
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: #000; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary:disabled:hover { background: var(--primary); }
.ib {
  width: 32px; height: 32px; display: grid; place-items: center; flex: none;
  border: 0; border-radius: var(--radius-control); background: none; color: var(--muted);
}
.ib:hover { background: var(--active); color: var(--text); }
.ib svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ib-s { width: 28px; height: 28px; }
.ib-s svg { width: 15px; height: 15px; }
.lnk { background: none; border: 0; padding: 0; color: var(--muted); font-weight: 500; font-size: 13px; }
.lnk:hover { color: var(--text); text-decoration: none; }
.pill {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px; flex: none;
  border-radius: 4px; font-size: 12px; font-weight: 500; white-space: nowrap;
  background: var(--pill-neutral-bg); color: var(--pill-neutral-ink);
}
.pill.is-warn { background: var(--pill-warning-bg); color: var(--pill-warning-ink); }

/* ── cornice: barra in alto sul fondo, foglio bianco ────────────────── */
.shell { height: 100%; display: flex; flex-direction: column; }
.topbar { flex: none; height: 48px; display: flex; align-items: center; gap: 12px; padding: 0 16px 0 12px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }
.brand:hover { text-decoration: none; }
.brand img { width: 26px; height: 26px; }
.topnav { margin-left: auto; display: flex; gap: 20px; align-items: center; }
.sheet {
  flex: 1; min-height: 0; margin: 0 var(--inset) var(--inset) var(--inset);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sheet);
}

/* ── HOME ───────────────────────────────────────────────────────────── */
.home-sheet { overflow: auto; padding: var(--pad) 32px 28px; display: flex; flex-direction: column; }
.titlerow { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.titlerow h1 { margin: 0; font-size: var(--fs-title); line-height: 28px; font-weight: 700; letter-spacing: -0.01em; }
.sub { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.titleacts { display: flex; gap: 8px; flex: none; }
/* elenco (2/3) ed esempio (1/3): 1fr + 24 + 340 = larghezza utile del foglio */
.home-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--gap); margin-top: 20px; align-items: start; }
.home-main .plist { margin-top: 0; }
.esempio { display: flex; flex-direction: column; gap: 10px; padding: 16px; border: 1px solid var(--border); border-radius: 12px; }
.esempio h2 { margin: 0; font-size: var(--fs-section); line-height: 22px; font-weight: 600; }
.es-pianta { aspect-ratio: 4 / 3; border-radius: 8px; background: var(--well); padding: 12px; }
.es-pianta svg { width: 100%; height: 100%; }
.es-nome { font-size: 14px; font-weight: 600; }
.es-txt { margin: -6px 0 4px; color: var(--muted); font-size: 13px; line-height: 19px; }
.esempio .btn { align-self: flex-start; }
/* primo avvio (nessun progetto): metà foglio all'esempio, i passi in colonna */
.is-vuoto .home-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.is-vuoto .percorso { grid-template-columns: 1fr; }
.is-vuoto .esempio { padding: 20px; }
.vuoto-riga { margin: 0; padding: 12px 14px; border: 1px dashed var(--control); border-radius: var(--radius-card); color: var(--muted); }

.plist { width: 100%; margin-top: 20px; border-collapse: collapse; }
.plist th { height: 36px; padding: 0 12px; text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); border-bottom: 1px solid var(--border); white-space: nowrap; }
.plist th.num, .plist td.num { text-align: right; }
.plist td { padding: 12px; border-bottom: 1px solid var(--rule); vertical-align: middle; color: var(--muted); }
.plist tr { cursor: pointer; }
.plist tbody tr:hover td { background: var(--raised); }
.plist .c-nome { width: 34%; }
.plist .c-az { width: 1%; }
.plist .nome { display: flex; align-items: center; gap: 14px; min-width: 0; }
.plist .nome b { display: block; color: var(--text); font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plist .nome small { display: block; font-size: 12px; color: var(--muted); }
.plist .thumb { flex: none; width: 64px; height: 48px; border-radius: 4px; background: var(--raised); }
.plist .azioni { display: flex; align-items: center; gap: 4px; justify-content: flex-end; white-space: nowrap; }
.plist .apri { color: var(--text); font-weight: 600; font-size: 13px; padding: 0 8px; }
.plist .apri:hover { text-decoration: underline; }
.plist .ib svg { width: 16px; height: 16px; }
.plist .ib:hover { color: var(--negative); }
.nota { margin: 12px 0 0; font-size: 12px; color: var(--muted); }

.h-percorso { margin: 32px 0 0; font-size: var(--fs-section); line-height: 22px; font-weight: 600; }
.percorso { margin: 12px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0 var(--gap); }
.percorso div { padding: 12px 0; border-top: 1px solid var(--rule); }
.percorso dt { font-weight: 600; font-size: 14px; }
.percorso dd { margin: 2px 0 0; color: var(--muted); font-size: 13px; line-height: 18px; }
.sheet-foot { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: auto; padding-top: 28px; font-size: 12px; color: var(--muted); }

/* ── APP: barra del progetto e passi ────────────────────────────────── */
.bar { gap: 8px; }
.pname { display: flex; align-items: center; gap: 2px; min-width: 0; max-width: 300px; }
.pname h1 { margin: 0; font-size: 16px; line-height: 18px; font-weight: 600; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }   /* nome lungo: a capo fra le parole, mai troncato a metà */
.pname input { width: 260px; height: 30px; padding: 0 8px; border: 1px solid var(--accent); border-radius: var(--radius-control); background: var(--surface); font-weight: 600; font-size: 15px; outline: none; }
.bar .pill { margin-left: 4px; }
.tabs { flex: 1; display: flex; justify-content: center; height: 100%; }
.tabs ol { list-style: none; margin: 0; padding: 0; display: flex; gap: 24px; height: 100%; }
.tabs li { display: flex; }
.tabs button {
  position: relative; height: 100%; padding: 0 2px; border: 0; background: none;
  color: var(--muted); font-weight: 500; font-size: 14px; white-space: nowrap;
}
.tabs button:hover { color: var(--text); }
.tabs button.is-on { color: var(--text); font-weight: 600; }
.tabs button.is-on::after { content: ''; position: absolute; left: 0; right: 0; bottom: 6px; height: 2px; background: var(--text); border-radius: 1px; }
.bar-end { display: flex; align-items: center; gap: 8px; flex: none; }

.stage { flex: 1; min-height: 0; position: relative; margin: 0 var(--inset) var(--inset); }
.vuoto { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; text-align: center; gap: 8px; padding: 24px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sheet); }
.vuoto h2 { margin: 0; font-size: 18px; line-height: 24px; }
.vuoto p { margin: 0 0 8px; color: var(--muted); max-width: 440px; }

/* ── DIALOGHI ───────────────────────────────────────────────────────── */
.dlg {
  border: 1px solid var(--border); padding: 0; border-radius: 12px; background: var(--surface); color: var(--text);
  width: min(440px, calc(100vw - 32px)); box-shadow: 0 8px 24px rgba(19, 20, 22, .08);
}
.dlg::backdrop { background: rgba(19, 20, 22, .32); }
.dlg form { padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.dlg h1, .dlg h2 { margin: 0; font-size: 18px; line-height: 24px; font-weight: 700; }
.dlg-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.dlg-foot .lnk { margin-right: auto; }
.field { display: flex; flex-direction: column; gap: 8px; font-size: 14px; font-weight: 500; }
.field input {
  height: 40px; padding: 0 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 15px; font-weight: 500; background: var(--surface);
}
.field input:focus { outline: none; border-color: var(--accent); }

/* avvertenze: pannello sulla cornice, la home resta nascosta finché non si accetta */
.gate { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px; background: var(--ground); overflow: auto; }
.gate .dlg { display: block; box-shadow: none; }
.dlg-disc { width: min(600px, calc(100vw - 32px)); }
.dlg-disc form { padding: 28px 32px 24px; }
.dlg-logo { height: 28px; width: auto; align-self: flex-start; }
.disc-text { max-height: min(50vh, 440px); overflow: auto; font-size: 14px; line-height: 22px; }
.disc-text p { margin: 0 0 10px; }
.disc-text p:last-child { margin: 0; }
.disc-ver { font-size: 12px; color: var(--muted); }
.check { display: flex; gap: 10px; align-items: flex-start; padding-top: 16px; border-top: 1px solid var(--rule); font-weight: 600; cursor: pointer; }
.check input { flex: none; width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--primary); cursor: pointer; }

/* ── TOAST ──────────────────────────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 8px); opacity: 0; pointer-events: none;
  max-width: min(520px, calc(100vw - 32px)); padding: 10px 14px; border-radius: 8px;
  background: var(--primary); color: #fff; font-size: 13px; font-weight: 500;
  transition: opacity .16s, transform .16s; z-index: 50;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.toast.is-err { background: #7f1d1d; }

/* ── SMARTPHONE ─────────────────────────────────────────────────────── */
.mobile-gate { display: none; }
@media (max-width: 767px) {
  .mobile-gate {
    position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; justify-content: center;
    gap: 12px; padding: 24px 20px; background: var(--ground);
  }
  .mobile-gate .mg-logo { height: 28px; width: auto; align-self: flex-start; margin-bottom: 12px; }
  .mobile-gate h1 { margin: 0; font-size: 22px; line-height: 28px; }
  .mobile-gate p { margin: 0; color: var(--muted); font-size: 15px; line-height: 22px; }
  .mobile-gate .mg-link { font-weight: 600; }
  .shell, .dlg, .gate { display: none !important; }
}

@media (max-width: 1080px) {
  .home-grid { grid-template-columns: minmax(0, 1fr) 280px; }
  .plist th:nth-child(4), .plist td:nth-child(4) { display: none; }
  .tabs ol { gap: 16px; }
}
@media (max-width: 900px) {
  .home-grid { grid-template-columns: 1fr; }
  .esempio { flex-direction: row; flex-wrap: wrap; align-items: flex-start; }
  .es-pianta { width: 220px; }
  .plist th:nth-child(3), .plist td:nth-child(3) { display: none; }
  .bar .pill { display: none; }
  .pname { max-width: 200px; }
  .pname h1 { font-size: 15px; line-height: 17px; }
}
