:root {
  --ink: #131a1f;
  --paper: #f3f5f4;
  --surface: #ffffff;
  --line: #d5dcda;
  --muted: #5c6b67;
  --accent: #1f6e68;
  --amber: #9c6a24;
  --green: #2b7a4d;
  --red: #a3453a;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.5;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 24px;
  background: var(--ink);
  color: #fff;
}
.topbar .brand { font-weight: 700; letter-spacing: 0.02em; }
.topbar .nav { display: flex; gap: 14px; margin-left: 24px; }
.topbar .nav a { color: #fff; opacity: 0.75; font-size: 13px; text-decoration: none; }
.topbar .nav a:hover { opacity: 1; text-decoration: underline; }
.topbar .who { margin-left: auto; font-size: 13px; opacity: 0.8; }
.topbar .logout { color: #fff; font-size: 13px; text-decoration: underline; }

main { max-width: 880px; margin: 0 auto; padding: 32px 20px 80px; }

h1 { font-size: 22px; margin: 8px 0 20px; display: flex; align-items: center; gap: 10px; }
h2 { font-size: 17px; margin: 40px 0 14px; color: var(--muted); }

.section-head { margin-bottom: 22px; }
.section-head h1 { margin-bottom: 6px; }
.section-head > p { max-width: 62ch; }

.count-pill {
  font-size: 13px; font-weight: 600; color: var(--muted);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 100px; padding: 1px 10px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px 20px;
  margin-bottom: 16px;
}

.empty-state {
  border: 1px dashed var(--line); border-radius: 10px;
  padding: 24px; text-align: center; margin-bottom: 20px;
}

.login-card { max-width: 380px; margin: 60px auto; text-align: center; }
.login-card input { width: 100%; padding: 10px; margin: 12px 0; border: 1px solid var(--line); border-radius: 6px; }
.login-card button { width: 100%; padding: 10px; border: none; border-radius: 6px; background: var(--accent); color: #fff; font-weight: 600; cursor: pointer; }

.proposal-head { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.badge { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; padding: 3px 8px; border-radius: 100px; background: var(--paper); border: 1px solid var(--line); color: var(--muted); }
.topic { font-family: ui-monospace, monospace; font-size: 13px; color: var(--accent); }
.op { font-family: ui-monospace, monospace; font-size: 13px; color: var(--muted); }
.status { margin-left: auto; font-size: 12px; font-weight: 600; text-transform: uppercase; }

.payload {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 12.5px;
  overflow-x: auto;
}

.decision-form { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.decision-form input { flex: 1; min-width: 180px; padding: 8px; border: 1px solid var(--line); border-radius: 6px; }
.decision-form button { padding: 8px 16px; border: none; border-radius: 6px; font-weight: 600; cursor: pointer; color: #fff; }
.decision-form .approve { background: var(--green); }
.decision-form .reject { background: var(--red); }

.decided.status-applied { border-left: 3px solid var(--green); }
.decided.status-rejected { border-left: 3px solid var(--red); }
.decided.status-approved { border-left: 3px solid var(--amber); }
.decided.status-failed { border-left: 3px solid var(--red); }

.muted { color: var(--muted); font-size: 14px; }
.error { color: var(--red); font-weight: 600; }
.success { color: var(--green); font-weight: 600; }

.mono { font-family: ui-monospace, monospace; }

.badge-role-dev-agent, .badge-role-control-agent { color: var(--accent); border-color: var(--accent); }
.badge-role-operator, .badge-role-observer { color: var(--amber); border-color: var(--amber); }
.badge-platform { color: var(--muted); }

/* Griglia degli agenti censiti: card cliccabile, non solo una riga di testo */
.agent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.agent-tile {
  display: flex; flex-direction: column; gap: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 16px 18px; text-decoration: none; color: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.agent-tile:hover { border-color: var(--accent); box-shadow: 0 2px 10px rgba(31, 110, 104, 0.10); }
.agent-tile-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.agent-tile-head strong { font-size: 15px; }
.agent-tile-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; }
.agent-tile-url { font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent-tile .open { font-size: 12.5px; color: var(--accent); margin-top: 2px; }

.agent-header { display: flex; align-items: flex-start; justify-content: space-between; }
.agent-detail-url { font-size: 12.5px; margin-top: 2px; word-break: break-all; }
.breadcrumb { margin-bottom: 6px; }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); text-decoration: underline; }

.form-card { max-width: 100%; }
.form-card-title { margin-top: 0; }

/* Form: gruppi con etichetta di sezione, un solo posto dove aggiungerne uno nuovo */
form.stacked { display: flex; flex-direction: column; gap: 14px; max-width: 520px; }
form.stacked fieldset {
  border: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px;
}
form.stacked legend {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--muted); padding: 0 0 6px; margin-bottom: 2px; border-bottom: 1px solid var(--line);
  width: 100%;
}
form.stacked label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
form.stacked input, form.stacked select, form.stacked textarea {
  padding: 9px 10px; border: 1px solid var(--line); border-radius: 6px; font: inherit; color: var(--ink);
  background: var(--surface);
}
form.stacked input:focus, form.stacked select:focus, form.stacked textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(31, 110, 104, 0.15);
}
form.stacked .field-hint { font-size: 11.5px; color: var(--muted); font-weight: 400; opacity: 0.85; }
form.stacked button {
  align-self: flex-start; padding: 10px 20px; border: none; border-radius: 6px;
  background: var(--accent); color: #fff; font-weight: 600; cursor: pointer;
}
form.stacked button:hover { background: #175853; }

.banner-success { border-color: var(--green); }
.token-reveal {
  background: var(--paper); border: 1px solid var(--line); border-radius: 6px;
  padding: 10px 12px; font-family: ui-monospace, monospace; font-size: 12.5px;
  word-break: break-all; user-select: all;
}

.message-log { display: flex; flex-direction: column; gap: 10px; margin: 16px 0 28px; }
.message-bubble {
  padding: 10px 14px; border-radius: 12px; max-width: 80%;
  box-shadow: 0 1px 2px rgba(19, 26, 31, 0.05);
}
.message-bubble.to_agent { background: var(--surface); border: 1px solid var(--line); align-self: flex-end; }
.message-bubble.from_agent { background: #eef4f2; border: 1px solid var(--line); align-self: flex-start; }
.message-bubble .meta { display: block; font-size: 11px; color: var(--muted); margin-bottom: 4px; }

@media (max-width: 520px) {
  .agent-grid { grid-template-columns: 1fr; }
}

/* Chat con gli agenti: elenco a sinistra (come una casella di posta),
   conversazione selezionata a destra — tutto nella stessa pagina. */
.chat-shell { display: flex; gap: 20px; align-items: flex-start; }
.chat-list {
  flex: 0 0 240px; max-width: 240px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px; position: sticky; top: 20px;
}
.chat-list-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.chat-list-head h1 { font-size: 16px; margin: 0; }
.new-agent-btn {
  font-size: 12px; font-weight: 600; color: #fff; background: var(--accent);
  border-radius: 100px; padding: 4px 10px; text-decoration: none; white-space: nowrap;
}
.new-agent-btn:hover { background: #175853; }
.chat-list-empty { font-size: 13px; }
.chat-list-items { display: flex; flex-direction: column; gap: 6px; }
.chat-list-item {
  display: flex; flex-direction: column; gap: 4px;
  padding: 9px 10px; border-radius: 8px; text-decoration: none; color: inherit;
  border: 1px solid transparent;
}
.chat-list-item:hover { background: var(--paper); }
.chat-list-item.active { background: #eef4f2; border-color: var(--accent); }
.chat-list-item-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.chat-list-item-head strong { font-size: 13.5px; }
.chat-list-item-meta { display: flex; align-items: center; gap: 6px; font-size: 11px; }
.chat-list-preview {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 140px; color: var(--muted);
}

.chat-pane { flex: 1 1 auto; min-width: 0; }
.chat-pane-head { margin-bottom: 8px; }
.chat-pane-title { font-size: 18px; margin: 0 0 4px; display: flex; align-items: center; gap: 8px; }
.chat-reply-form { max-width: 100%; }
.chat-empty {
  border: 1px dashed var(--line); border-radius: 10px; padding: 40px 24px; text-align: center;
}

@media (max-width: 720px) {
  .chat-shell { flex-direction: column; }
  .chat-list { position: static; max-width: 100%; flex-basis: auto; width: 100%; }
}

/* Catalogo API */
.endpoint-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 28px; }
.endpoint-card { margin-bottom: 0; }
.endpoint-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.endpoint-head .path { font-size: 13.5px; }
.auth-badge { margin-left: auto; }

.method {
  font-size: 11px; font-weight: 700; letter-spacing: 0.03em;
  padding: 3px 9px; border-radius: 5px; color: #fff;
}
.method-GET { background: var(--accent); }
.method-POST { background: var(--green); }
.method-PUT, .method-PATCH { background: var(--amber); }
.method-DELETE { background: var(--red); }

.endpoint-summary { margin: 4px 0; }
.endpoint-description { margin: 2px 0 10px; }

.curl-example, .schema-json {
  background: var(--ink); color: #e8efed; border-radius: 8px;
  padding: 12px 14px; font-family: ui-monospace, monospace; font-size: 12px;
  overflow-x: auto; white-space: pre; margin: 0;
}

.schema-details { margin-top: 10px; }
.schema-details summary { cursor: pointer; font-size: 12.5px; color: var(--accent); }
.schema-label { margin: 10px 0 4px; font-size: 11.5px; }

/* Chat in tempo reale: il registro della conversazione scorre da se' quando
   cresce, e i messaggi che arrivano mentre la chat e' aperta (le risposte
   dell'agente, via webhook) compaiono senza ricaricare la pagina. */
.message-log { max-height: 52vh; overflow-y: auto; padding-right: 6px; }

/* Modifica dei dati di un agente censito: link discreto nella testa della
   chat, pagina di modifica nello stile del form di censimento. */
.edit-agent-row { margin: 4px 0 0; }
.edit-agent-link {
  display: inline-block; font-size: 12px; color: var(--muted); text-decoration: none;
  border: 1px solid var(--line); border-radius: 12px; padding: 3px 10px;
}
.edit-agent-link:hover { color: var(--accent); border-color: var(--accent); }

/* Stato di connessione dell'agente censito: verde = handshake completato,
   rosso = qualcosa e' andato male (dettaglio accanto al nome), grigio =
   benvenuto partito, risposta attesa. L'algoritmo decide il colore, mai
   una persona. */
.status-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.status-dot.status-connected { background: var(--green); }
.status-dot.status-error { background: #b33939; }
.status-dot.status-unverified { background: var(--muted); }
.status-badge { font-size: 11px; border-radius: 10px; padding: 2px 8px; border: 1px solid var(--line); }
.status-badge.status-connected { color: var(--green); border-color: var(--green); }
.status-badge.status-error { color: #b33939; border-color: #b33939; }
.status-badge.status-unverified { color: var(--muted); }
.status-detail { font-size: 12px; margin: 4px 0 0; }
.inline-form { display: inline-block; margin: 0; }
.btn-small {
  font-size: 12px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); cursor: pointer;
}
.btn-small:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger:hover { border-color: #b33939; color: #b33939; }


/* ------------------------------------------------------------------ */
/* Progetti                                                            */
/* ------------------------------------------------------------------ */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-top: 18px; }
.project-card { display: block; text-decoration: none; color: inherit; padding: 18px; }
.project-card:hover { border-color: var(--accent); }
.project-card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.project-card-head h2 { margin: 0; font-size: 18px; }
.project-counters { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.project-last-activity { margin-top: 10px; font-size: 13px; }
.badge.status-in_corso { color: var(--green); border-color: var(--green); }
.badge.status-standby { color: var(--amber); border-color: var(--amber); }
.badge.status-terminato { color: var(--muted); }
.badge.status-annullato { color: var(--red); border-color: var(--red); }
.status-forms { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 18px; }
.status-forms button { padding: 8px 14px; border: none; border-radius: 6px; font-weight: 600; cursor: pointer; color: #fff; background: var(--accent); }
.status-forms button:disabled { opacity: 0.45; cursor: default; }
.status-forms .danger { background: var(--red); }
.detail-list { margin-top: 26px; }
.detail-list h2 { font-size: 16px; margin-bottom: 10px; }
.detail-list table { width: 100%; border-collapse: collapse; }
.detail-list td, .detail-list th { padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 14px; text-align: left; }

/* =====================================================================
   v0.10 — nuova navigazione: Welcome + Project (hub a due colonne con schede)
   ===================================================================== */
.topbar .brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.brand-mark { width: 12px; height: 12px; border-radius: 3px; background: linear-gradient(135deg, #3fbfb2, var(--accent)); box-shadow: 0 0 0 3px rgba(63,191,178,0.18); }
.topbar .nav { margin-left: 28px; gap: 4px; }
.topbar .nav a { font-size: 14px; padding: 6px 12px; border-radius: 6px; opacity: 0.8; }
.topbar .nav a:hover { text-decoration: none; background: rgba(255,255,255,0.08); opacity: 1; }
.topbar .nav a.active { background: rgba(255,255,255,0.14); opacity: 1; font-weight: 600; }
.topbar .toplink { color: #fff; font-size: 13px; opacity: 0.75; text-decoration: none; margin-left: 14px; }
.topbar .toplink:hover { opacity: 1; text-decoration: underline; }

main.wide { max-width: 1240px; }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 7px; background: var(--accent); color: #fff; font-weight: 600; font-size: 14px; text-decoration: none; border: 1px solid var(--accent); cursor: pointer; line-height: 1.2; }
.btn:hover { background: #175853; }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.ghost:hover { background: #eef4f2; }
.btn.small { padding: 5px 10px; font-size: 12.5px; border-radius: 6px; }
form.inline { display: inline; }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.attention { color: var(--amber); font-weight: 700; }
.flash { padding: 10px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); }
.flash.error { border-color: var(--red); }
.flash.success { border-color: var(--green); }
table.clean { width: 100%; border-collapse: collapse; }
table.clean th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); padding: 6px 10px; border-bottom: 1px solid var(--line); }
table.clean td { padding: 10px 10px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 14px; }
table.clean tr:last-child td { border-bottom: none; }
ul.plain { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
ul.plain.tight { gap: 3px; }
.card-title { margin: 0 0 10px; font-size: 15px; color: var(--ink); display: flex; align-items: center; gap: 10px; }
.card-title .tab-link { margin-left: auto; font-size: 12.5px; font-weight: 500; color: var(--accent); text-decoration: none; }
.card-title .tab-link:hover { text-decoration: underline; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 800px) { .two-col { grid-template-columns: 1fr; } }

/* stati progetto/proposte come badge colorati */
.badge.status-in_corso, .badge.status-connected, .badge.status-applied { color: var(--green); border-color: var(--green); background: #edf6f0; }
.badge.status-standby, .badge.status-pending, .badge.status-approved, .badge.status-unverified { color: var(--amber); border-color: var(--amber); background: #fbf4ea; }
.badge.status-terminato { color: var(--muted); border-color: var(--muted); }
.badge.status-annullato, .badge.status-rejected, .badge.status-failed, .badge.status-error { color: var(--red); border-color: var(--red); background: #faefed; }
.badge.big { font-size: 12.5px; padding: 4px 11px; }
.badge.schema { font-family: ui-monospace, monospace; text-transform: none; letter-spacing: 0; color: var(--accent); border-color: var(--accent); }
.status-dot.inline { vertical-align: middle; margin-right: 2px; }

/* ---------- Welcome ---------- */
.welcome .hero { padding: 34px 36px; margin-bottom: 18px; background: linear-gradient(160deg, #ffffff 0%, #f4faf8 100%); }
.eyebrow { margin: 0 0 8px; font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); font-weight: 700; }
.hero-title { font-size: 26px; line-height: 1.25; margin: 0 0 14px; display: block; }
.hero-title em { color: var(--accent); font-style: normal; }
.hero-lead { max-width: 74ch; font-size: 15.5px; margin: 0 0 20px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.stat-row, .kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
@media (max-width: 900px) { .stat-row, .kpi-row { grid-template-columns: repeat(2, 1fr); } }
.stat, .kpi { display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: inherit; margin: 0; padding: 16px 18px; transition: border-color .15s; }
a.stat:hover, a.kpi:hover { border-color: var(--accent); }
.stat-num, .kpi-n { font-size: 30px; font-weight: 700; line-height: 1.1; color: var(--ink); }
.kpi-n.small-n { font-size: 22px; padding-top: 6px; }
.stat-label, .kpi-l { font-size: 13.5px; font-weight: 600; }
.stat-sub, .kpi-s { font-size: 12px; color: var(--muted); }
.stat-attention { border-color: var(--amber); background: #fffaf3; }
.stat-attention .stat-num, .stat-attention .kpi-n { color: var(--amber); }
.welcome-h2 { margin: 30px 0 12px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
@media (max-width: 1000px) { .steps { grid-template-columns: repeat(2, 1fr); } }
.step { margin: 0; position: relative; padding-top: 20px; }
.step h3 { margin: 6px 0 6px; font-size: 15px; }
.step p { margin: 0; font-size: 13.5px; color: var(--muted); }
.step-n { position: absolute; top: 14px; right: 16px; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 700; font-size: 13px; display: grid; place-items: center; }
.rules { margin: 0; padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 9px; font-size: 14px; }
.rules .badge { margin-right: 6px; }
.activity table td { font-size: 13.5px; }

/* ---------- Hub progetti ---------- */
.hub { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 900px) { .hub { grid-template-columns: 1fr; } }
.hub-side { position: sticky; top: 18px; }
.hub-side-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.hub-side-head h1 { font-size: 17px; margin: 0; }
.hub-list { display: flex; flex-direction: column; gap: 8px; }
.hub-item { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; text-decoration: none; color: inherit; border-left-width: 4px; transition: border-color .15s, box-shadow .15s; }
.hub-item:hover { border-color: var(--accent); box-shadow: 0 2px 10px rgba(31,110,104,.10); }
.hub-item.active { border-color: var(--accent); background: #f2f8f6; }
.hub-item.state-in_corso { border-left-color: var(--green); }
.hub-item.state-standby { border-left-color: var(--amber); }
.hub-item.state-terminato { border-left-color: var(--muted); }
.hub-item.state-annullato { border-left-color: var(--red); }
.hub-item-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.hub-item-head strong { font-size: 14.5px; }
.hub-item-meta { display: flex; gap: 10px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.hub-main { min-width: 0; }
.hub-head { margin-bottom: 14px; }
.hub-head h1 { margin: 0; font-size: 24px; }
.hub-head > p { margin: 6px 0 0; }
.hub-title { display: flex; align-items: center; gap: 12px; }
.rule-line { margin: 8px 0 0; font-size: 13px; color: var(--muted); }
.rule-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: var(--accent); margin-right: 6px; }
.tabs { display: flex; gap: 2px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin: 18px 0 22px; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.tabs a:hover { color: var(--ink); }
.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-n { font-size: 11px; font-weight: 700; background: var(--paper); border: 1px solid var(--line); border-radius: 100px; padding: 0 7px; color: var(--muted); }
.tab-n.attention { background: #fbf4ea; border-color: var(--amber); color: var(--amber); }
.tab-intro { margin-bottom: 16px; }
.tab-intro h2 { margin: 0 0 6px; color: var(--ink); font-size: 19px; }
.tab-intro p { margin: 0; max-width: 90ch; }
.subhead { font-size: 15px; margin: 22px 0 10px; display: flex; align-items: center; gap: 8px; }
.db-card { border-left: 4px solid var(--accent); }
.db-card.db-none { border-left-color: var(--amber); }
.big-mono { font-size: 16px; font-weight: 700; }
.warn-card { border-color: var(--amber); }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-form input { flex: 1; min-width: 220px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 6px; }
.inline-form button { padding: 9px 16px; border: none; border-radius: 6px; background: var(--accent); color: #fff; font-weight: 600; cursor: pointer; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; }
@media (max-width: 800px) { .grid-2 { grid-template-columns: 1fr; } }
.agents-table td.actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.proposal .reason { margin: 6px 0 10px; font-size: 14.5px; }
.status-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.status-opt { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); }
.status-opt.current { border-color: var(--accent); background: #f2f8f6; }
.status-opt button { min-width: 96px; padding: 7px 12px; border: none; border-radius: 6px; background: var(--accent); color: #fff; font-weight: 600; cursor: pointer; }
.status-opt button.danger { background: var(--red); }
.status-opt button:disabled { opacity: .45; cursor: default; }

.tabs a.tab-chat { margin-left: auto; color: var(--accent); background: #eef4f2; border-radius: 6px 6px 0 0; }
.tabs a.tab-chat:hover { background: #e2eeeb; }

/* ---- v0.10: elenco progetti (ingresso) ---- */
.plist-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.plist-head h1 { margin: 0 0 4px; font-size: 24px; display: flex; align-items: center; gap: 10px; }
.plist-head p { margin: 0; max-width: 80ch; }
.pcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin-bottom: 20px; }
.pcard { display: flex; flex-direction: column; gap: 10px; margin: 0; text-decoration: none; color: inherit; border-left-width: 4px; transition: border-color .15s, box-shadow .15s; }
.pcard:hover { border-color: var(--accent); box-shadow: 0 3px 14px rgba(31,110,104,.12); }
.pcard.state-in_corso { border-left-color: var(--green); }
.pcard.state-standby { border-left-color: var(--amber); }
.pcard.state-terminato { border-left-color: var(--muted); }
.pcard.state-annullato { border-left-color: var(--red); }
.pcard-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pcard-head h2 { margin: 0; font-size: 18px; }
.pcard-desc { margin: 0; font-size: 13.5px; min-height: 2.6em; }
.pcard-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; border-top: 1px solid var(--line); padding-top: 10px; }
.pcard-stats div { display: flex; flex-direction: column; }
.pcard-stats .n { font-size: 22px; font-weight: 700; line-height: 1.1; }
.pcard-stats .l { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.pcard-stats .attention .n { color: var(--amber); }
.pcard-foot { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
details.details-form summary { cursor: pointer; font-weight: 700; font-size: 15px; color: var(--accent); list-style: none; }
details.details-form summary::before { content: "+ "; }
details.details-form[open] summary::before { content: "− "; }
details.details-form > *:not(summary) { margin-top: 12px; }

/* ---- v0.10: pagina progetto — testa + tab, chat a sinistra, funzioni a destra ---- */
.breadcrumb { margin: 0 0 6px; font-size: 13px; }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }
.proj-head { margin-bottom: 4px; }
.proj-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.proj-title h1 { margin: 0; font-size: 24px; }
.proj-title .rule-line { margin: 0; }
.proj-head .tabs { margin: 14px 0 0; }
.proj-body { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 22px; align-items: start; padding-top: 22px; }
@media (max-width: 900px) { .proj-body { grid-template-columns: 1fr; } }
.chat-side { position: sticky; top: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px; max-height: calc(100vh - 40px); overflow: auto; }
.chat-side-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.chat-side-head h2 { margin: 0; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.chat-side .chat-list-items { display: flex; flex-direction: column; gap: 6px; }
.chat-side .chat-list-item { position: relative; display: block; padding: 10px 12px; border-radius: 9px; border: 1px solid transparent; text-decoration: none; color: inherit; }
.chat-side .chat-list-item:hover { background: var(--paper); }
.chat-side .chat-list-item.active { background: #eef4f2; border-color: var(--accent); }
.chat-side .chat-list-item-head { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.chat-side .chat-list-item-meta { display: flex; align-items: center; gap: 8px; margin-top: 4px; font-size: 12px; color: var(--muted); min-width: 0; }
.chat-side .chat-list-preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-side .chat-list-when { margin-left: auto; font-size: 11px; white-space: nowrap; }
.chat-side .chat-list-item-head strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.proj-main { min-width: 0; }
.proj-desc { margin: 0 0 16px; }
.chat-pane-head { margin-bottom: 12px; }
.chat-pane-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 4px; font-size: 20px; }
.proj-main .message-log { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; max-height: 60vh; overflow: auto; display: flex; flex-direction: column; gap: 10px; }
.proj-main .chat-reply-form { margin-top: 12px; }


/* ---- Sezione Server (v0.10 fetta 5) ---- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.page-head h1 { margin: 0 0 6px; }
.servers-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 16px; margin-bottom: 20px; }
.server-card.inactive { opacity: 0.6; }
.server-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.server-head h2 { margin: 0; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.badge.engine { color: var(--accent); border-color: var(--accent); background: #eef4f2; text-transform: none; }
.status-dot.status-off { background: var(--muted); }
.proj-chip { display: inline-flex; gap: 6px; align-items: center; padding: 3px 8px; border: 1px solid var(--line); border-radius: 6px; text-decoration: none; color: var(--ink); margin: 2px 4px 2px 0; background: var(--paper); }
.proj-chip:hover { border-color: var(--accent); }
.server-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; margin-top: 10px; }
.server-actions .btn.danger { color: var(--red); border-color: transparent; }
.server-actions .btn.danger:hover { border-color: var(--red); background: #faefed; }
.server-actions button[disabled] { opacity: 0.45; cursor: not-allowed; }
.inline-details { display: inline-block; }
.inline-details summary { list-style: none; display: inline-flex; }
.inline-details summary::-webkit-details-marker { display: none; }
.inline-details[open] { display: block; width: 100%; }
.inline-details[open] form { margin-top: 10px; }
.form-actions { display: flex; gap: 10px; align-items: center; }

/* ---- Import da dump (v0.10 fetta 6) ---- */
form.stacked label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); }
form.stacked label.check input { width: auto; }
form.stacked input[type=file] { padding: 8px; background: var(--paper); }
.flash.small { font-size: 13px; }

/* ---- Server: tre pannelli host › istanze › dettaglio (v0.10 fetta 7) ---- */
.page-head.compact { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.page-head.compact h1 { margin-bottom: 2px; }
.srv-legend { display: flex; gap: 8px; align-items: center; }
body.page-servers main { max-width: none; width: 100%; margin: 0; padding: 18px 22px 24px; }
body.page-servers .page-head.compact { margin-bottom: 10px; }
.panes { display: grid; grid-template-columns: minmax(280px, 22%) minmax(360px, 30%) minmax(0, 1fr); gap: 14px; align-items: stretch; height: calc(100vh - 175px); min-height: 480px; }
.pane-detail form.stacked { max-width: none; }
.pane-detail .badge.eng { white-space: nowrap; }
@media (max-width: 1100px) { .panes { grid-template-columns: 1fr; height: auto; } .pane { max-height: 60vh; } }
.pane { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.pane-head { padding: 10px 12px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.pane-head h2 { margin: 0; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.pane-head h2 .count { color: var(--ink); }
.pane-head h2 .btn-small { margin-left: auto; }
.pane-list { overflow: auto; flex: 1; }
.pane-empty { padding: 36px 18px; text-align: center; }
.pad { padding: 12px; }
.search-form { margin: 0; }
.search-form input[type=search] { width: 100%; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); font: inherit; font-size: 13px; }
.seg { display: flex; gap: 4px; }
.seg a { font-size: 11px; padding: 3px 9px; border: 1px solid var(--line); border-radius: 100px; text-decoration: none; color: var(--muted); background: var(--surface); }
.seg a.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.prow { display: flex; align-items: center; gap: 9px; padding: 8px 12px; border-bottom: 1px solid var(--paper); text-decoration: none; color: inherit; }
.prow:hover { background: var(--paper); }
.prow.on { background: #e8f1ef; box-shadow: inset 3px 0 0 var(--accent); }
.prow.static { border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; }
.prow .t { flex: 1; min-width: 0; }
.prow .t b { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow .t span:not(.badge) { display: block; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prow .r { font-size: 11px; color: var(--muted); text-align: right; white-space: nowrap; line-height: 1.35; }
.prow .r .bar { width: 60px; display: block; margin-top: 3px; margin-left: auto; }
.bar { height: 6px; background: #e3e9e7; border-radius: 4px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); }
.bar.amber > i { background: var(--amber); }
.bar.red > i { background: var(--red); }
.badge.sat { color: var(--red); border-color: var(--red); background: #f7ecea; text-transform: none; }
.badge.eng { color: var(--accent); border-color: #bcd6d1; background: #edf4f2; text-transform: none; font-weight: 400; }
.host-strip { padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--paper); display: flex; flex-direction: column; gap: 5px; }
.host-strip-name { text-decoration: none; color: inherit; display: flex; align-items: center; gap: 7px; font-size: 14px; }
.host-meters { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--muted); }
.host-meters b { color: var(--ink); }
.host-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 3px; }
.host-actions button[disabled] { opacity: .45; cursor: not-allowed; }
.txt-red { color: var(--red) !important; } .txt-green { color: var(--green) !important; }
.pane-detail { padding: 16px 18px; overflow: auto; }
.pane-detail h3 { margin: 0 0 4px; font-size: 18px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pane-detail .sec { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 18px 0 8px; }
.kgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 12px 0 6px; }
.k { border: 1px solid var(--line); border-left-width: 4px; border-radius: 8px; padding: 8px 10px; background: var(--surface); display: flex; flex-direction: column; gap: 1px; }
.k .l { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.k .v { font-size: 18px; font-weight: 600; color: var(--ink); }
.k .s { font-size: 11px; color: var(--muted); }
.k.level-green { border-left-color: var(--green); } .k.level-amber { border-left-color: var(--amber); } .k.level-red { border-left-color: var(--red); }
.status-dot.level-green { background: var(--green); } .status-dot.level-amber { background: var(--amber); } .status-dot.level-red { background: var(--red); } .status-dot.level-grey { background: #b3bdb9; }
.acts { display: flex; gap: 6px; flex-wrap: wrap; }
.acts button[disabled] { opacity: .45; cursor: not-allowed; }
.edit-details { margin-top: 10px; }
.edit-details summary { list-style: none; display: inline-block; cursor: pointer; }
.edit-details[open] summary { margin-bottom: 10px; }
.form-actions { display: flex; gap: 8px; align-items: center; }
