.page {
  max-width: 1100px;
  margin: 0 auto;
}

.page-title {
  font-size: 22px;
  margin-bottom: 6px;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 24px;
}

.section {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
}

.section h2 {
  font-size: 16px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section h3 {
  font-size: 14px;
  color: var(--text-dim);
  margin: 16px 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-dim);
  letter-spacing: 0.3px;
}

.field input,
.field select,
.field textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 4px;
  font-family: "SF Mono", Monaco, monospace;
  font-size: 13px;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 2px solid var(--blue);
  border-color: var(--blue);
}

.field .hint {
  font-size: 11px;
  color: var(--text-muted);
}

.field .hint.required { color: var(--yellow); }
.field .hint.error { color: var(--red); }

/* Stato errore sul campo (border rosso + msg sotto) */
.field.has-error input,
.field.has-error select,
.field.has-error textarea {
  border-color: var(--red);
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.3);
}
.field.has-warning input,
.field.has-warning select,
.field.has-warning textarea {
  border-color: var(--yellow);
}
.field-error-msg {
  font-size: 11px;
  color: var(--red);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}
.field-warning-msg {
  font-size: 11px;
  color: var(--yellow);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}
.field-error-msg::before { content: "✗"; }
.field-warning-msg::before { content: "⚠"; }

/* Sticky banner readiness in alto */
.readiness-banner {
  position: sticky;
  top: 0;
  z-index: 50;
  margin: -24px -32px 16px -32px;
  padding: 10px 32px;
  background: rgba(239, 68, 68, 0.12);
  border-bottom: 1px solid rgba(239, 68, 68, 0.4);
  color: var(--text);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 14px;
  backdrop-filter: blur(8px);
}
.readiness-banner.ready {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.4);
}
.readiness-banner .badge-count {
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 3px;
  background: rgba(0,0,0,0.3);
}
.readiness-banner .btn-jump {
  margin-left: auto;
  background: rgba(255,255,255,0.1);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.15);
  padding: 4px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}
.readiness-banner .btn-jump:hover { background: rgba(255,255,255,0.18); }

/* Highlight temporaneo del campo "scrollato" */
.field.flash {
  animation: flash-bg 1.4s ease-out;
}
@keyframes flash-bg {
  0%   { background: rgba(239, 68, 68, 0.0); }
  20%  { background: rgba(239, 68, 68, 0.25); }
  100% { background: rgba(239, 68, 68, 0.0); }
}

/* Diagramma architetturale */
.arch-diagram {
  width: 100%;
  height: auto;
  display: block;
  background: #0b1220;
  border-radius: 6px;
}
.arch-diagram .node-bg { fill: #1e293b; stroke: #475569; stroke-width: 1.5; }
.arch-diagram .node-bg.managed { stroke: #10b981; stroke-width: 2; }
.arch-diagram .node-bg.external { stroke: #64748b; stroke-dasharray: 4 3; }
.arch-diagram .node-label { fill: #f1f5f9; font-size: 13px; font-weight: 600; font-family: -apple-system, sans-serif; }
.arch-diagram .node-sublabel { fill: #94a3b8; font-size: 10px; font-family: -apple-system, sans-serif; }
.arch-diagram .node-badge { font-size: 9px; font-weight: 600; }
.arch-diagram .node-badge.managed { fill: #10b981; }
.arch-diagram .node-badge.external { fill: #94a3b8; }
.arch-diagram .edge { stroke: #475569; stroke-width: 1.4; fill: none; }
.arch-diagram .edge-managed { stroke: #10b981; stroke-width: 1.6; }
.arch-diagram .edge-label { fill: #cbd5e1; font-size: 10px; font-family: -apple-system, sans-serif; }
.arch-diagram .arrow { fill: #475569; }
.arch-diagram .arrow-managed { fill: #10b981; }

.legend {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-dim);
  flex-wrap: wrap;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}
.legend-swatch {
  width: 16px;
  height: 12px;
  border: 1.5px solid var(--text-dim);
  border-radius: 2px;
}
.legend-swatch.managed { border-color: var(--green); border-width: 2px; }
.legend-swatch.external { border-style: dashed; }
.legend-swatch.edge { border: none; height: 2px; background: var(--text-dim); }
.legend-swatch.edge-managed { border: none; height: 2px; background: var(--green); }

details.collapsible {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 16px;
}
details.collapsible > summary {
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
details.collapsible > summary::before {
  content: "▶";
  font-size: 11px;
  color: var(--text-dim);
  transition: transform 0.15s;
}
details.collapsible[open] > summary::before {
  transform: rotate(90deg);
}
details.collapsible > .body {
  margin-top: 16px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin: 12px 0;
}
.kpi {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 14px;
}
.kpi .label { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.4px; }
.kpi .value { font-size: 18px; font-weight: 600; color: var(--text); margin-top: 4px; }
.kpi .sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.kpi.ok .value { color: var(--green); }
.kpi.warn .value { color: var(--yellow); }
.kpi.err .value { color: var(--red); }

/* Choice cards (wizard) — grandi, cliccabili, hover evidente */
.choice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 18px;
}
.choice-card {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 22px 24px;
  cursor: pointer;
  text-align: left;
  transition: all 0.12s ease;
  font-family: inherit;
  color: var(--text);
}
.choice-card:hover {
  background: var(--bg-card);
  border-color: var(--blue);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}
.choice-card .choice-icon {
  font-size: 28px;
  margin-bottom: 12px;
}
.choice-card .choice-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.choice-card .choice-subtitle {
  font-size: 13px;
  color: var(--cyan);
  margin-bottom: 14px;
  font-weight: 500;
}
.choice-card .choice-divider {
  height: 1px;
  background: var(--border);
  margin: 0 0 14px 0;
}
.choice-card .choice-desc {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.55;
  flex: 1;
}
.choice-card .choice-tags {
  display: flex;
  gap: 6px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.choice-card .choice-tag {
  font-size: 10px;
  padding: 3px 8px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.choice-card .choice-tag.recommended {
  background: rgba(16,185,129,0.15);
  color: var(--green);
  border-color: rgba(16,185,129,0.4);
}

/* Wizard generale: testi più grandi e arie più ampie */
.wizard h1.page-title {
  font-size: 26px;
  margin-bottom: 8px;
}
.wizard p.page-subtitle {
  font-size: 14px;
}
.wizard .section {
  padding: 24px 28px;
}
.wizard .section p {
  font-size: 14px;
  line-height: 1.6;
}
.wizard ol li, .wizard ul li {
  font-size: 14px;
  line-height: 1.7;
}

.btn {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
}

.btn:hover { background: var(--bg-hover); }
.btn.primary { background: var(--blue); border-color: var(--blue); }
.btn.primary:hover { background: #2563eb; }
.btn.danger { background: var(--red); border-color: var(--red); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-row {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.console-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  text-decoration: none;
  color: var(--cyan);
  margin-right: 6px;
  margin-bottom: 6px;
}

.console-link:hover {
  background: var(--bg-hover);
}

.snippet {
  background: #020617;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 16px;
  font-family: "SF Mono", Monaco, monospace;
  font-size: 12.5px;
  color: #cbd5e1;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.5;
  position: relative;
}

.snippet .copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 4px 10px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 11px;
}

.snippet .copy-btn:hover { background: var(--bg-hover); color: var(--text); }
.snippet .copy-btn.copied { background: var(--green); color: white; }

.callout {
  border-left: 3px solid var(--yellow);
  background: rgba(245, 158, 11, 0.08);
  padding: 12px 16px;
  margin: 12px 0;
  border-radius: 4px;
  font-size: 13px;
}

.callout.info { border-color: var(--blue); background: rgba(59, 130, 246, 0.08); }
.callout.warning { border-color: var(--yellow); background: rgba(245, 158, 11, 0.08); }
.callout.danger { border-color: var(--red); background: rgba(239, 68, 68, 0.08); }

.checklist { list-style: none; padding-left: 0; }
.checklist li {
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.checklist li:last-child { border-bottom: none; }
.checklist li::before {
  content: "☐ ";
  color: var(--text-muted);
  margin-right: 6px;
}
.checklist li.done::before {
  content: "☑ ";
  color: var(--green);
}
