:root {
  --bg: #f6f4f0; --card: #ffffff; --ink: #1d1b19; --muted: #6f6a63; --line: #e4dfd7;
  --accent: #b4442f; --accent-ink: #ffffff; --ok: #2f7d4f; --warn: #b7791f; --bad: #b4332f;
  --soft: #f1ede6; --radius: 14px;
  font-family: ui-sans-serif, -apple-system, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151412; --card: #1f1d1a; --ink: #f1ede6; --muted: #a39d94; --line: #34302b;
    --accent: #e0694f; --accent-ink: #1a0f0c; --ok: #5cbf86; --warn: #e3a94a; --bad: #ef6a5f; --soft: #2a2723;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.45; }
body.center { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
h1 { font-size: 20px; margin: 0; letter-spacing: .02em; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 12px; font-weight: 600; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.error { color: var(--bad); font-weight: 600; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.narrow { width: min(420px, 100%); }
.brand { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; }
.brand p { margin: 2px 0 0; }
.logo { width: 40px; height: 40px; border-radius: 12px; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-weight: 800; font-size: 20px; flex: none; }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0; }
input, textarea { width: 100%; margin-top: 6px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg); color: var(--ink); font: inherit; }
textarea { min-height: 90px; resize: vertical; }
button { font: inherit; padding: 9px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--soft);
  color: var(--ink); cursor: pointer; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
button.danger { color: var(--bad); }
button:disabled { opacity: .5; cursor: default; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }

header.top { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; max-width: 980px; margin: 0 auto; }
header.top .brand { margin: 0; }
main.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px 40px; display: grid; gap: 14px; }
.grid2 { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
@media (max-width: 720px) { .grid2 { grid-template-columns: 1fr; } }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 3px 10px; border-radius: 99px; background: var(--soft); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.dot.ok { background: var(--ok); } .dot.bad { background: var(--bad); } .dot.warn { background: var(--warn); }
.stat { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.stat:last-child { border-bottom: 0; }
.code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 26px; letter-spacing: .2em; font-weight: 700; }
.draft { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 10px; }
.draft .meta { font-size: 13px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; }
.draft pre { white-space: pre-wrap; word-wrap: break-word; font: inherit; background: var(--soft); padding: 10px; border-radius: 8px; margin: 8px 0 0; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tabs button.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.list { font-size: 14px; }
.list .item { padding: 8px 0; border-bottom: 1px solid var(--line); }
.list .item:last-child { border-bottom: 0; }
.list .when { color: var(--muted); font-size: 12px; }
.empty { color: var(--muted); font-style: italic; }
.warnbox { border-left: 3px solid var(--warn); padding: 8px 12px; background: var(--soft); border-radius: 6px; margin-bottom: 10px; }
.toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg);
  padding: 10px 16px; border-radius: 10px; max-width: calc(100% - 32px); display: none; }

/* ---------------------------------------------------------------- configurazione guidata */
main.setup { max-width: 560px; margin: 0 auto; padding: 28px 16px 60px; }
main.setup > .brand { margin-bottom: 22px; }
.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.step { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.step-head { width: 100%; display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 0; border-radius: 0;
  background: transparent; text-align: left; font-size: 16px; }
.step-head:disabled { opacity: 1; cursor: default; }
.step .num { width: 28px; height: 28px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: var(--soft); color: var(--muted); font-weight: 700; font-size: 14px; }
.step.open .num { background: var(--accent); color: var(--accent-ink); }
.step.done .num { background: var(--ok); color: #fff; }
.step .title { font-weight: 600; }
.step .summary { margin-left: auto; color: var(--muted); font-size: 13px; text-align: right; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; max-width: 55%; }
.step.locked { opacity: .45; }
.step-body { display: none; padding: 0 16px 16px 56px; }
.step.open .step-body { display: block; }
@media (max-width: 520px) { .step-body { padding-left: 16px; } }
.step-body form { display: grid; gap: 10px; }
.step-body input { margin: 0; }
button.wide { width: 100%; padding: 12px; }
button.ghost { background: transparent; border-color: transparent; color: var(--muted); }
button.link { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; font-size: inherit; }
.bigcode { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 38px; font-weight: 800; letter-spacing: .12em;
  text-align: center; margin: 6px 0 14px; padding: 14px; background: var(--soft); border-radius: 12px; }
.howto { margin: 0 0 12px; padding-left: 20px; }
.howto li { margin-bottom: 6px; }
.copyrow { display: flex; gap: 8px; align-items: center; margin: 4px 0 14px; }
.copyrow code { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; background: var(--soft); padding: 10px 12px;
  border-radius: 10px; font-size: 13px; }
.advanced summary { color: var(--muted); font-size: 13px; cursor: pointer; }
.advanced[open] summary { margin-bottom: 8px; }
.grid-2 { display: grid; grid-template-columns: 1fr 90px; gap: 8px; }
.note { border-left: 3px solid var(--warn); padding: 8px 12px; background: var(--soft); border-radius: 6px; margin-bottom: 10px; }
.spinner { display: inline-block; width: 12px; height: 12px; border: 2px solid var(--line); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 1s linear infinite; vertical-align: -1px; margin-right: 4px; }
@keyframes spin { to { transform: rotate(360deg); } }
.card form button.wide + button.wide { margin-top: 6px; }
a.small { font-size: 13px; color: var(--accent); }
.count:not(:empty) { background: var(--accent); color: var(--accent-ink); border-radius: 99px; padding: 1px 8px; margin-left: 6px; letter-spacing: 0; }
form.stack { display: grid; gap: 10px; }
form.stack input, form.stack textarea { margin-top: 6px; }
textarea.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; }
.sigprev iframe { width: 100%; height: 150px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
