/* ============================================================
   Monolith - sistema grafico
   Nessun CDN, nessun font remoto, nessuna immagine remota.
   Temi: scuro (predefinito) e chiaro, via attributo data-theme.
   ============================================================ */

:root {
  --bg: #0a0b0f;
  --bg-deep: #06070a;
  --surface: #12141b;
  --surface-2: #191c25;
  --surface-3: #212533;
  --line: #242836;
  --line-soft: #1b1f2a;
  --text: #eceff5;
  --text-dim: #aab3c5;
  --muted: #7f899c;
  --accent: #3ddbc0;
  --accent-2: #6d8bff;
  --accent-3: #b06bff;
  --accent-ink: #04211c;
  --ok: #3ddbc0;
  --warn: #e3b341;
  --err: #ff6b6b;
  --radius: 14px;
  --radius-sm: 9px;
  --radius-lg: 22px;
  --rail: 240px;
  --chat: 400px;
  --shadow: 0 18px 50px rgba(0, 0, 0, .45);
  --shadow-soft: 0 2px 10px rgba(0, 0, 0, .25);
  --aurora-a: rgba(61, 219, 192, .38);
  --aurora-b: rgba(109, 139, 255, .42);
  --aurora-c: rgba(176, 107, 255, .34);
  --aurora-veil: rgba(10, 11, 15, .55);
}

:root[data-theme="light"] {
  --bg: #f4f5f8;
  --bg-deep: #e9ebf1;
  --surface: #ffffff;
  --surface-2: #f6f7fa;
  --surface-3: #eceef4;
  --line: #dfe3ec;
  --line-soft: #e9ecf3;
  --text: #11141c;
  --text-dim: #3d4657;
  --muted: #6c7689;
  --accent: #0e9c86;
  --accent-2: #4360e0;
  --accent-3: #8b45d8;
  --accent-ink: #ffffff;
  --ok: #0e9c86;
  --warn: #9a6f12;
  --err: #c0392b;
  --shadow: 0 18px 45px rgba(21, 28, 45, .12);
  --shadow-soft: 0 1px 4px rgba(21, 28, 45, .08);
  --aurora-a: rgba(14, 156, 134, .30);
  --aurora-b: rgba(67, 96, 224, .26);
  --aurora-c: rgba(139, 69, 216, .22);
  --aurora-veil: rgba(244, 245, 248, .55);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, Cantarell, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
::selection { background: var(--accent-2); color: #fff; }

/* ---------------------------------------------- sfondo aurora (solo CSS) */

.aurora {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background: var(--bg-deep);
}
.aurora span {
  position: absolute;
  display: block;
  border-radius: 50%;
  filter: blur(90px);
  opacity: .85;
  animation: deriva 26s ease-in-out infinite alternate;
}
.aurora span:nth-child(1) { width: 58vw; height: 58vw; left: -12vw; bottom: -22vw; background: var(--aurora-a); }
.aurora span:nth-child(2) { width: 64vw; height: 64vw; left: 24vw; bottom: -30vw; background: var(--aurora-b); animation-delay: -8s; }
.aurora span:nth-child(3) { width: 46vw; height: 46vw; right: -10vw; bottom: -18vw; background: var(--aurora-c); animation-delay: -15s; }
.aurora::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, var(--bg-deep) 0%, transparent 55%),
    repeating-linear-gradient(90deg, rgba(255,255,255,.028) 0 1px, transparent 1px 84px),
    repeating-linear-gradient(0deg, rgba(255,255,255,.028) 0 1px, transparent 1px 84px);
}
:root[data-theme="light"] .aurora::after {
  background:
    linear-gradient(180deg, var(--bg-deep) 0%, transparent 55%),
    repeating-linear-gradient(90deg, rgba(17,20,28,.05) 0 1px, transparent 1px 84px),
    repeating-linear-gradient(0deg, rgba(17,20,28,.05) 0 1px, transparent 1px 84px);
}
@keyframes deriva {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(4vw, -5vh, 0) scale(1.12); }
}
@media (prefers-reduced-motion: reduce) {
  .aurora span { animation: none; }
  .costruzione *, .costruzione *::after { animation: none !important; }
  .thread > .msg:last-child, .pensa span { animation: none; }
}

/* ------------------------------------------------------------- impianto */

.shell { position: relative; z-index: 1; display: flex; min-height: 100vh; }
.rail {
  width: var(--rail);
  flex: 0 0 var(--rail);
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 12px;
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(14px);
}
.view { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

/* marchio */
.mark { display: flex; align-items: center; gap: 9px; padding: 6px 8px 14px; text-decoration: none; }
.mark svg { display: block; }
.mark b { font-size: 15px; letter-spacing: -.01em; font-weight: 650; }
.mark span { color: var(--muted); font-size: 11px; }

.workspace {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; margin-bottom: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  text-decoration: none;
}
.workspace .badge {
  width: 22px; height: 22px; flex: 0 0 22px;
  border-radius: 6px;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700; color: var(--accent-ink);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.workspace .chev { margin-left: auto; color: var(--muted); }

.rail nav { display: flex; flex-direction: column; gap: 1px; }
.rail nav a, .rail-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  text-decoration: none;
  font-size: 13.5px;
  border: 1px solid transparent;
  background: none;
  font-family: inherit;
  cursor: pointer;
  width: 100%;
  text-align: left;
}
.rail nav a:hover, .rail-btn:hover { background: var(--surface-2); color: var(--text); }
.rail nav a.on { background: var(--surface-3); color: var(--text); border-color: var(--line); }
.rail nav a svg, .rail-btn svg { flex: 0 0 15px; opacity: .8; }

.rail h6 {
  margin: 18px 0 6px; padding: 0 10px;
  font-size: 10.5px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase;
  color: var(--muted);
}
.recent { display: flex; flex-direction: column; gap: 1px; overflow-y: auto; }
.recent a {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: var(--radius-sm);
  color: var(--text-dim); text-decoration: none; font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.recent a:hover { background: var(--surface-2); color: var(--text); }
.recent a.on { background: var(--surface-3); color: var(--text); }
.recent .dot { width: 6px; height: 6px; border-radius: 50%; flex: 0 0 6px; background: var(--muted); }
.recent .dot.live { background: var(--accent); }
.rail .bottom { margin-top: auto; padding-top: 12px; display: flex; flex-direction: column; gap: 1px; }

/* menu dell'utente in basso a sinistra */
.utente-wrap { position: relative; }
.avatar {
  width: 28px; height: 28px; flex: 0 0 28px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 11.5px; font-weight: 700; color: var(--accent-ink);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
/* classe propria: .utente e' gia' dei messaggi dell'utente nella chat */
.pulsante-utente {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 6px 8px; border: 1px solid transparent; border-radius: var(--radius-sm);
  background: none; color: var(--text); font: inherit; font-size: 13.5px;
  cursor: pointer; text-align: left;
}
.pulsante-utente:hover, .pulsante-utente[aria-expanded="true"] { background: var(--surface-2); border-color: var(--line); }
.pulsante-utente .nome { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pulsante-utente .chev { color: var(--muted); }
.menu-utente {
  position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); z-index: 30;
  padding: 6px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); box-shadow: 0 18px 40px rgba(0, 0, 0, .35);
}
.menu-utente[hidden] { display: none; }
.menu-utente .chi { display: flex; align-items: center; gap: 10px; padding: 8px 8px 10px; }
.menu-utente .chi .avatar { width: 34px; height: 34px; flex-basis: 34px; font-size: 13px; }
.menu-utente .chi div { min-width: 0; }
.menu-utente .chi b, .menu-utente .chi small {
  display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.menu-utente .chi b { font-size: 13.5px; font-weight: 600; }
.menu-utente .chi small { font-size: 12px; color: var(--muted); }
.menu-utente .sep { height: 1px; margin: 5px 2px; background: var(--line); }
.menu-utente a, .menu-utente form > button[role=menuitem], .menu-utente .aspetto {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 7px 8px; border: 0; border-radius: var(--radius-sm);
  background: none; color: var(--text-dim); font: inherit; font-size: 13px;
  text-decoration: none; cursor: pointer; text-align: left;
}
.menu-utente a:hover, .menu-utente a.on, .menu-utente form > button[role=menuitem]:hover { background: var(--surface-2); color: var(--text); }
.menu-utente svg { flex: 0 0 15px; opacity: .8; }
.menu-utente .aspetto { cursor: default; justify-content: space-between; }
.menu-utente .aspetto > span { display: flex; align-items: center; gap: 10px; }
.menu-utente .seg { display: flex; margin: 0; padding: 2px; border: 1px solid var(--line); border-radius: 999px; }
.menu-utente .seg button {
  padding: 2px 9px; border: 0; border-radius: 999px; background: none;
  color: var(--muted); font: inherit; font-size: 11.5px; cursor: pointer;
}
.menu-utente .seg button.on { background: var(--surface-3); color: var(--text); }

/* crediti nella barra laterale */
.crediti-box {
  display: block; margin: 0 0 8px; padding: 10px 11px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text); text-decoration: none; font-size: 12.5px;
}
.crediti-box:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.crediti-box .su { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.crediti-box .su b { font-weight: 600; }
.crediti-box .su span { color: var(--muted); font-size: 11.5px; }
.crediti-box .barra { display: block; margin: 7px 0 6px; }
.crediti-box small { display: block; color: var(--muted); font-size: 11.5px; }
.crediti-box small strong { color: var(--accent); font-weight: 600; }
.barra { height: 5px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.barra i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

/* --------------------------------------------------------------- schermo */

.screen { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; }
.center-wrap {
  flex: 1 1 auto;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 40px 24px;
  gap: 22px;
}
.hello { text-align: center; }
.hello h1 {
  margin: 0;
  font-size: clamp(26px, 3.4vw, 40px);
  font-weight: 640;
  letter-spacing: -.025em;
}
.hello p { margin: 8px 0 0; color: var(--text-dim); font-size: 15px; }

/* ------------------------------------------------------------ compositore */

.composer {
  width: min(760px, 100%);
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  overflow: hidden;
  transition: border-color .15s ease;
}
.composer:focus-within { border-color: color-mix(in srgb, var(--accent-2) 55%, var(--line)); }
.composer textarea {
  width: 100%; border: 0; outline: 0; resize: none;
  background: transparent; color: var(--text);
  font: inherit; line-height: 1.6;
  padding: 18px 20px 6px;
  min-height: 82px; max-height: 280px;
}
.composer textarea::placeholder { color: var(--muted); }
.composer .bar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px 12px 14px;
}
.composer .bar .spacer { flex: 1 1 auto; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text-dim);
  font: inherit; font-size: 12.5px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.chip:hover { background: var(--surface-3); color: var(--text); }
.chip.on { border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); color: var(--text); }
/* il select dentro un chip non prende padding e larghezza dei campi dei moduli */
.chip select {
  width: auto; margin: 0; padding: 0 2px; border: 0; border-radius: 0;
  background: transparent; color: inherit; font: inherit; outline: 0; cursor: pointer;
}

.send {
  width: 34px; height: 34px; flex: 0 0 34px;
  border: 0; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-ink);
  display: grid; place-items: center; cursor: pointer;
}
.send { transition: transform .15s ease, filter .15s ease, opacity .15s ease; }
.send:not(:disabled):hover { filter: brightness(1.08); transform: translateY(-1px); }
.send:disabled { opacity: .45; cursor: not-allowed; }

.suggerimenti { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: 760px; }

/* ---------------------------------------------------------- schede progetti */

.projects { width: min(1000px, 100%); }
.projects h2 { font-size: 13px; color: var(--muted); font-weight: 600; letter-spacing: .05em; text-transform: uppercase; margin: 0 0 12px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.pcard {
  display: flex; flex-direction: column; text-decoration: none; color: inherit;
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.pcard:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent-2) 45%, var(--line));
  box-shadow: 0 14px 34px rgba(0, 0, 0, .28);
}
.pcard:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pcard .thumb {
  position: relative; display: block; aspect-ratio: 16 / 10; overflow: hidden;
  background: var(--bg-deep);
  border-bottom: 1px solid var(--line);
}
/* la pagina viene disegnata a 1200px e rimpicciolita a un quarto */
.pcard .thumb iframe {
  position: absolute; top: 0; left: 0; width: 400%; height: 400%;
  border: 0; background: #fff;
  transform: scale(.25); transform-origin: 0 0; pointer-events: none;
}
.pcard .thumb::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 70%, rgba(0, 0, 0, .12));
  pointer-events: none;
}
.pcard .vuota {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 14%, var(--surface-2)), color-mix(in srgb, var(--accent-3) 14%, var(--surface-2)));
}
.pcard .vuota small { font-size: 11.5px; color: var(--muted); }
.pcard .meta { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px 13px; min-width: 0; }
.pcard .meta b {
  font-size: 14px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pcard .meta .brief {
  font-size: 12px; color: var(--muted); line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.pcard .meta .coda { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pcard .meta .quando { font-size: 12px; color: var(--muted); }
.pcard .meta .tag { margin: 0; }

/* ------------------------------------------------------- vista progetto */

.project { flex: 1 1 auto; display: flex; min-height: 0; }
.chatpane {
  width: var(--chat); flex: 0 0 var(--chat);
  display: flex; flex-direction: column; min-height: 0;
  border-right: 1px solid var(--line);
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 84%, transparent);
  backdrop-filter: blur(14px);
}
/* maniglia per allargare o stringere la chat */
.resizer {
  flex: 0 0 6px; margin: 0 -3px; position: relative; z-index: 5;
  cursor: col-resize; touch-action: none; outline: none;
}
.resizer::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: 2px; width: 2px;
  background: transparent; transition: background .15s;
}
.resizer:hover::after, .resizer:focus-visible::after, .ridimensiona .resizer::after { background: var(--accent); }
.ridimensiona, .ridimensiona * { cursor: col-resize !important; user-select: none; }
.ridimensiona iframe { pointer-events: none; }
/* intestazione della chat alta quanto la barra della scena: le due righe si allineano */
.chathead {
  display: flex; align-items: center; gap: 8px; flex: 0 0 auto;
  min-height: 52px; padding: 0 16px; border-bottom: 1px solid var(--line);
  font-size: 13.5px; font-weight: 600;
}
.chathead > svg { flex: 0 0 auto; color: var(--accent); }
/* senza barra laterale: da qui si torna all'elenco dei progetti */
.chathead .torna {
  display: inline-flex; align-items: center; gap: 3px; flex: 0 0 auto;
  height: 32px; padding: 0 7px 0 4px; margin-left: -8px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  color: var(--muted); text-decoration: none;
}
.chathead .torna:hover { background: var(--surface-2); border-color: var(--line); color: var(--text); }
.chathead .torna svg { display: block; }
.chathead > span:not(.state) { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chathead .state { margin-left: auto; flex: 0 0 auto; font-size: 11.5px; font-weight: 500; color: var(--muted); }
.thread {
  flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain;
  padding: 20px 16px 16px; display: flex; flex-direction: column; gap: 22px;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.thread::-webkit-scrollbar { width: 10px; }
.thread::-webkit-scrollbar-thumb { border: 3px solid transparent; border-radius: 10px; background: var(--line); background-clip: padding-box; }
.msg { max-width: 100%; min-width: 0; font-size: 13.5px; line-height: 1.6; overflow-wrap: break-word; }
/* l'ultimo messaggio entra con un leggero movimento (anche dopo il ricaricamento) */
.thread > .msg:last-child { animation: entra .3s ease-out both; }
@keyframes entra { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* messaggi dell'utente: fumetto a destra, tinta dell'accento */
.msg.utente { align-self: flex-end; max-width: 86%; }
.msg.utente .body {
  padding: 9px 14px; border-radius: 16px 16px 5px 16px; color: var(--text);
  background: var(--surface-3);
  background: color-mix(in srgb, var(--accent-2) 14%, var(--surface-2));
  border: 1px solid var(--line);
  border-color: color-mix(in srgb, var(--accent-2) 26%, var(--line));
}

/* messaggi dell'agente: testata con il marchio, testo a tutta larghezza */
.msg .titolo { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 12.5px; color: var(--muted); }
.msg .titolo b { font-weight: 600; color: var(--text); }
.msg .titolo .tag { margin-left: 2px; }
.logo-ai {
  width: 24px; height: 24px; flex: 0 0 24px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2);
}
.msg.agente .body { color: var(--text-dim); color: color-mix(in srgb, var(--text) 82%, var(--text-dim)); }
.msg.agente .body strong { color: var(--text); }

/* passi fatti (spunta) o, in modalita' Pianifica, passi da fare (numerati) */
.msg .punti {
  margin: 12px 0 0; padding: 3px 0; list-style: none; counter-reset: punto;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-2);
  background: color-mix(in srgb, var(--surface-2) 70%, transparent);
}
.msg .punti li {
  position: relative; padding: 7px 12px 7px 36px;
  font-size: 12.8px; line-height: 1.5; color: var(--text-dim);
}
.msg .punti li + li { border-top: 1px solid var(--line-soft); }
.msg .punti li::before {
  content: ""; position: absolute; left: 12px; top: 9px; width: 16px; height: 16px;
  background: var(--accent);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='8' fill-opacity='.2'/%3E%3Cpath d='m4.8 8.3 2.1 2.1 4.3-4.6' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 16px 16px no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='8' fill-opacity='.2'/%3E%3Cpath d='m4.8 8.3 2.1 2.1 4.3-4.6' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 16px 16px no-repeat;
}
.msg.pianifica .punti li { counter-increment: punto; }
.msg.pianifica .punti li::before {
  content: counter(punto); -webkit-mask: none; mask: none; border-radius: 50%;
  background: var(--surface-3);
  background: color-mix(in srgb, var(--accent-2) 20%, transparent);
  color: var(--accent-2); font-size: 10px; font-weight: 700; line-height: 16px; text-align: center;
}

/* file toccati: icona del tipo e nome, aprono il file nella scheda Codice */
.msg .files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.msg .files a {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-width: 0;
  padding: 3px 9px 3px 6px; border: 1px solid var(--line); border-radius: 7px;
  background: var(--surface-2); color: var(--text-dim); text-decoration: none;
  font: 11.5px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  transition: border-color .15s, color .15s;
}
.msg .files a:hover { color: var(--text); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.msg .files a span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg .files .fi { flex: 0 0 14px; width: 14px; height: 14px; }

/* piede del messaggio: esito della compilazione a sinistra, costo a destra */
.msg-piede { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 12px; }
.msg-piede .costo { margin-left: auto; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.msg .err {
  padding: 9px 12px; border: 1px solid var(--err); border-radius: var(--radius-sm);
  border-color: color-mix(in srgb, var(--err) 35%, var(--line));
  background: color-mix(in srgb, var(--err) 8%, transparent);
  color: var(--err); font-size: 12.8px;
}

/* attesa della risposta: anello che gira e testo che luccica */
.pensa {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 7px 14px 7px 10px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface-2); font-size: 12.8px; color: var(--muted);
}
.pensa i {
  display: block; width: 14px; height: 14px; flex: 0 0 14px; border-radius: 50%;
  background: conic-gradient(from 90deg, transparent 15%, var(--accent), var(--accent-2));
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2.5px), #000 calc(100% - 2px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 2.5px), #000 calc(100% - 2px));
  animation: gira .9s linear infinite;
}
.pensa span {
  background: linear-gradient(90deg, var(--muted) 35%, var(--text) 50%, var(--muted) 65%);
  background-size: 250% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: luccica 2.2s linear infinite;
}
@keyframes gira { to { transform: rotate(360deg); } }
@keyframes luccica { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* proposte di passo successivo */
.azioni { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 12px; }
.azioni .chip {
  background: transparent; color: var(--text-dim);
  border-color: color-mix(in srgb, var(--accent) 28%, var(--line));
  transition: background .15s, border-color .15s, color .15s;
}
.azioni .chip:hover {
  color: var(--text); border-color: color-mix(in srgb, var(--accent) 60%, var(--line));
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}
.chatfoot { padding: 10px 12px 12px; border-top: 1px solid var(--line); }
.chatfoot .composer { width: 100%; border-radius: var(--radius); box-shadow: none; transition: border-color .15s ease, box-shadow .15s ease; }
.chatfoot .composer:focus-within { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-2) 16%, transparent); }
.chatfoot .composer textarea { min-height: 58px; padding: 12px 14px 4px; font-size: 13.5px; }
.chatfoot .composer .bar { padding: 6px 10px 10px; }

/* ------------------------------------------------------------- anteprima */

.stage { flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0; min-height: 0; }

/* vista progetto: la pagina resta alta quanto la finestra e ogni pannello
   (chat, anteprima, codice, Altro) scorre per conto suo */
@media (min-width: 861px) {
  /* la barra laterale resta ferma anche nelle pagine lunghe */
  .rail { position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; }
  .vista-fissa .shell { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
  .vista-fissa .rail { overflow-y: auto; }
  .vista-fissa .view { min-height: 0; }
}
.toolbar {
  display: flex; align-items: center; gap: 8px;
  min-height: 52px; padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  backdrop-filter: blur(12px);
}
.tabs { display: flex; gap: 2px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 2px; }
.tabs a {
  padding: 5px 13px; border-radius: 999px; font-size: 12.5px; color: var(--muted); text-decoration: none;
}
.tabs a.on { background: var(--surface-3); color: var(--text); }
.toolbar .spacer { flex: 1 1 auto; }
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
  font: inherit; font-size: 12.5px; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--surface-3); }
.btn.primary {
  border: 0; color: var(--accent-ink);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  font-weight: 600;
}
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.frame-wrap { flex: 1 1 auto; display: flex; justify-content: center; align-items: stretch; padding: 0; min-height: 0; background: var(--bg-deep); }
.frame-wrap.mobile { padding: 22px; }
.frame-wrap iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.frame-wrap.mobile iframe {
  width: 390px; max-width: 100%; height: 100%;
  border-radius: 26px; border: 1px solid var(--line); box-shadow: var(--shadow);
}
.vuoto { flex: 1 1 auto; display: grid; place-items: center; text-align: center; color: var(--muted); padding: 40px; }
.vuoto h3 { color: var(--text); font-weight: 600; font-size: 16px; margin: 14px 0 6px; }
.vuoto p { margin: 0; font-size: 13.5px; max-width: 380px; }

/* indirizzo pubblico sopra l'anteprima */
.indirizzo {
  display: flex; align-items: center; justify-content: center; gap: 9px; flex: 0 0 auto;
  padding: 6px 12px; border-bottom: 1px solid var(--line);
  background: var(--surface); font-size: 12px; color: var(--text-dim);
}
.indirizzo svg { opacity: .7; flex: 0 0 13px; }
.indirizzo a, .indirizzo .mono { color: var(--text-dim); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.indirizzo a:hover { color: var(--text); text-decoration: underline; }
.indirizzo .chip { margin: 0; padding: 2px 10px; font-size: 11.5px; }

/* app React: esito della compilazione in chat e avvisi sopra l'anteprima */
.msg .compilazione {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 10px 2px 8px; border: 1px solid var(--line); border-radius: 999px;
  border-color: color-mix(in srgb, var(--ok) 30%, var(--line));
  background: color-mix(in srgb, var(--ok) 8%, transparent);
  font-size: 11.5px; color: var(--text-dim);
}
.msg .compilazione > i {
  display: inline-block; width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; background: var(--ok);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent);
}
/* errore: riquadro a tutta larghezza, c'e' spazio per i dettagli */
.msg .compilazione.ko {
  display: block; flex: 1 1 100%; padding: 8px 12px; border-radius: var(--radius-sm); color: var(--err);
  border-color: color-mix(in srgb, var(--err) 35%, var(--line));
  background: color-mix(in srgb, var(--err) 7%, transparent);
}
.msg .compilazione.ko > i { margin-right: 8px; vertical-align: 1px; background: var(--err); box-shadow: 0 0 0 3px color-mix(in srgb, var(--err) 22%, transparent); }
.compilazione details, .avviso-app details { margin-top: 6px; }
.compilazione summary, .avviso-app summary { cursor: pointer; color: var(--muted); font-size: 11.5px; }
.compilazione pre, .avviso-app pre {
  margin: 6px 0 0; padding: 8px 10px; max-height: 220px; overflow: auto;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
  font: 11.5px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--text-dim); white-space: pre-wrap;
}
.avviso-app {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex: 0 0 auto;
  padding: 9px 14px; border-bottom: 1px solid var(--line); font-size: 12.5px; color: var(--text);
  background: color-mix(in srgb, var(--warn) 12%, var(--surface));
}
.avviso-app[hidden] { display: none; }
.avviso-app > div { min-width: 0; flex: 1 1 auto; }
.avviso-app .chip { margin: 0; flex: 0 0 auto; }

/* domanda di chiarimento dell'agente */
.domanda {
  position: relative; margin-top: 10px; padding: 14px;
  display: flex; flex-direction: column; gap: 8px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface);
}
.domanda > b { font-size: 13.5px; color: var(--text); padding-right: 24px; }
.domanda > small { font-size: 12px; color: var(--muted); margin-top: -4px; }
.domanda.chiusa { padding: 9px 12px; opacity: .75; }
.domanda .chiudi {
  position: absolute; top: 8px; right: 8px; width: 24px; height: 24px;
  border: 0; border-radius: 6px; background: none; color: var(--muted);
  font-size: 18px; line-height: 1; cursor: pointer;
}
.domanda .chiudi:hover { background: var(--surface-2); color: var(--text); }
.opzione {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 11px; margin: 0;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-2); cursor: pointer; transition: border-color .15s;
}
.opzione:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.opzione:has(input:checked) { border-color: var(--accent); }
.opzione input[type=radio] { margin: 2px 0 0; accent-color: var(--accent); }
.opzione span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.opzione span b { font-size: 12.8px; font-weight: 600; color: var(--text); }
.opzione span small { font-size: 12px; color: var(--muted); }
.opzione.libera { align-items: center; }
.opzione.libera input[type=text] {
  flex: 1 1 auto; min-width: 0; padding: 6px 9px; font: inherit; font-size: 12.8px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text);
}
.domanda .piede { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

/* animazione di costruzione sopra la scena */
.stage { position: relative; }
.costruzione {
  position: absolute; left: 0; right: 0; bottom: 0; top: var(--toolbar-h, 51px); z-index: 4;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: 30px; text-align: center; background: var(--bg-deep);
  animation: comparsa .3s ease both;
}
.costruzione[hidden] { display: none; }
.costruzione .cornice { position: relative; width: 140px; height: 140px; display: grid; place-items: center; margin-bottom: 14px; }
.costruzione .cornice svg { animation: respiro 2.4s ease-in-out infinite; }
.costruzione .cornice i {
  position: absolute; width: 7px; height: 7px; border-radius: 2px; background: var(--accent);
  animation: angoli 2.4s ease-in-out infinite;
}
.costruzione .cornice i:nth-child(1) { top: 0; left: 0; }
.costruzione .cornice i:nth-child(2) { top: 0; right: 0; animation-delay: .15s; }
.costruzione .cornice i:nth-child(3) { bottom: 0; left: 0; animation-delay: .45s; }
.costruzione .cornice i:nth-child(4) { bottom: 0; right: 0; animation-delay: .3s; }
.costruzione h3 { margin: 0; font-size: 22px; font-weight: 500; letter-spacing: -.01em; color: var(--text); }
.costruzione .puntini::after { content: ''; animation: puntini 1.4s steps(4) infinite; }
.costruzione em { font-style: normal; display: inline-block; width: 1.2em; text-align: left; }
.costruzione .linea {
  width: 220px; height: 2px; margin: 24px 0 22px; border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  background-size: 50% 100%; background-repeat: no-repeat;
  animation: scorrimento 1.8s ease-in-out infinite;
}
.costruzione p { margin: 0; font-size: 13.5px; color: var(--muted); min-height: 1.5em; transition: opacity .4s; }
@keyframes respiro { 0%, 100% { transform: scale(1) rotate(0); } 50% { transform: scale(1.12) rotate(8deg); } }
@keyframes angoli { 0%, 100% { transform: translate(0, 0); opacity: 1; } 50% { transform: translate(var(--dx, 0), var(--dy, 0)); opacity: .45; } }
.costruzione .cornice i:nth-child(1) { --dx: 14px; --dy: 14px; }
.costruzione .cornice i:nth-child(2) { --dx: -14px; --dy: 14px; }
.costruzione .cornice i:nth-child(3) { --dx: 14px; --dy: -14px; }
.costruzione .cornice i:nth-child(4) { --dx: -14px; --dy: -14px; }
@keyframes puntini { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }
@keyframes scorrimento { 0% { background-position: -100% 0; } 100% { background-position: 200% 0; } }
@keyframes comparsa { from { opacity: 0; } to { opacity: 1; } }

/* ------------------------------------------------------------ codice e pannelli */

.split { flex: 1 1 auto; display: flex; min-height: 0; }
/* albero dei file: cartelle <details>, rientro con --liv, guide verticali */
.filetree { width: 240px; flex: 0 0 240px; border-right: 1px solid var(--line); overflow: auto; padding: 4px 6px 16px; }
.filetree-testa {
  display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 6px;
  font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.filetree-testa span { font-weight: 500; letter-spacing: 0; }
.filetree .vuota { display: block; padding: 4px 8px; font-size: 12.5px; }
.filetree ul { list-style: none; margin: 0; padding: 0; position: relative; }
.filetree ul ul::before {
  content: ''; position: absolute; top: 0; bottom: 2px; left: calc(13px + (var(--liv) - 1) * 12px);
  border-left: 1px solid var(--line-soft);
}
.filetree:hover ul ul::before { border-left-color: var(--line); }
.filetree summary, .filetree a {
  display: flex; align-items: center; gap: 5px; height: 26px; min-width: 0;
  padding: 0 8px 0 calc(6px + var(--liv) * 12px); border-radius: 6px;
  font-size: 12.5px; color: var(--text-dim); text-decoration: none; cursor: pointer; user-select: none;
  white-space: nowrap;
}
.filetree summary { list-style: none; }
.filetree summary::-webkit-details-marker { display: none; }
.filetree summary > span, .filetree a > span { overflow: hidden; text-overflow: ellipsis; }
.filetree summary:hover, .filetree a:hover { background: var(--surface-2); color: var(--text); }
.filetree summary:focus-visible, .filetree a:focus-visible { outline: 1px solid var(--accent); outline-offset: -1px; }
.filetree a.on { background: var(--surface-3); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.filetree .chev { flex: 0 0 12px; width: 12px; height: 12px; color: var(--muted); transition: transform .12s; }
.filetree details[open] > summary .chev { transform: rotate(90deg); }
.filetree .fi { flex: 0 0 16px; }
.filetree details > summary .fi-dir.aperta, .filetree details[open] > summary .fi-dir.chiusa { display: none; }
.filetree details[open] > summary .fi-dir.aperta { display: block; }
/* colori dei tipi di file: vivi sul fondo scuro, piu' carichi su quello chiaro */
.fi-dir { color: #dcb567; }
.fi-html, .fi-xml { color: #ef7a4f; }
.fi-css { color: #54a9f0; }
.fi-js { color: #f0d64e; }
.fi-ts { color: #4a8fd8; }
.fi-react { color: #5ed3f3; }
.fi-json { color: #e5c04f; }
.fi-md { color: #6bb2de; }
.fi-svg { color: #f5a742; }
.fi-img { color: #b58be0; }
.fi-node { color: #86c35a; }
.fi-vite { color: #a98bff; }
.fi-yaml { color: #e97979; }
.fi-file { color: var(--muted); }
:root[data-theme="light"] .fi-dir { color: #c28b24; }
:root[data-theme="light"] .fi-html, :root[data-theme="light"] .fi-xml { color: #d9512c; }
:root[data-theme="light"] .fi-css { color: #1f7fd0; }
:root[data-theme="light"] .fi-js { color: #e2c32b; }
:root[data-theme="light"] .fi-ts { color: #2f74c0; }
:root[data-theme="light"] .fi-react { color: #0f9fc7; }
:root[data-theme="light"] .fi-json { color: #b8900f; }
:root[data-theme="light"] .fi-md { color: #2f86bd; }
:root[data-theme="light"] .fi-svg { color: #d9820f; }
:root[data-theme="light"] .fi-img { color: #8c55c8; }
:root[data-theme="light"] .fi-node { color: #4f9a2a; }
:root[data-theme="light"] .fi-vite { color: #7b5cf0; }
:root[data-theme="light"] .fi-yaml { color: #cf4a4a; }
.code { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; overflow: hidden; margin: 0; background: var(--bg-deep); }
.code > pre { flex: 1 1 auto; overflow: auto; padding: 16px 18px; }
.code .monaco { display: none; flex: 1 1 auto; min-height: 0; }
.code.pronto > pre { display: none; }
.code.pronto .monaco { display: block; }
.editorbar {
  display: flex; align-items: center; gap: 10px; flex: 0 0 auto;
  padding: 7px 10px 7px 16px; border-bottom: 1px solid var(--line);
  font-size: 12px; color: var(--text-dim); background: var(--surface);
}
.editorbar .stato { color: var(--muted); font-size: 11.5px; }
.editorbar .btn { margin-left: auto; }
.editorbar .stato.modificato { color: var(--accent); }
.editorbar .stato.errore { color: #ff6b6b; }
.code pre { margin: 0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; line-height: 1.65; color: var(--text-dim); white-space: pre; }

.panel-scroll { flex: 1 1 auto; overflow-y: auto; padding: 26px 30px 60px; }
.sheet { max-width: 880px; margin: 0 auto; }
.sheet.larga { max-width: 1140px; }
.piano-form { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 4px; }
.piano-form select, .piano-form input { width: auto; padding: 4px 8px; font-size: 12px; }
.piano-form input[name=extra] { width: 72px; }

/* pagina piani */
.due-colonne { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 14px; align-items: stretch; }
.due-colonne > .panel { margin: 0; }
@media (max-width: 900px) { .due-colonne { grid-template-columns: 1fr; } }
.uso-testa { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.uso-testa b { font-size: 14px; }
.uso-testa small { font-size: 11.5px; color: var(--muted); }
.andamento-box { position: relative; height: 70px; }
.andamento { display: block; width: 100%; height: 70px; overflow: visible; }
.andamento .base { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.andamento .linea { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.andamento .area { fill: var(--accent); opacity: .12; }
.andamento .mirino { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.andamento-box .punto {
  position: absolute; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 2px var(--surface); pointer-events: none;
}
.andamento-box .suggerimento {
  position: absolute; bottom: calc(100% + 6px); transform: translateX(-50%); white-space: nowrap;
  padding: 4px 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface);
  font-size: 11.5px; color: var(--text); pointer-events: none; box-shadow: 0 6px 18px rgba(0,0,0,.25);
}
.assi { display: flex; justify-content: space-between; margin-top: 5px; font-size: 11px; color: var(--muted); }
.uso-tabella { width: 100%; margin-top: 14px; border-collapse: collapse; font-size: 12.5px; }
.uso-tabella th, .uso-tabella td { padding: 5px 0; text-align: left; font-weight: 500; }
.uso-tabella th { color: var(--text); text-transform: none; letter-spacing: 0; font-size: 12.5px; }
.uso-tabella td { color: var(--text-dim); }
.uso-tabella tr > :last-child { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.uso-tabella a { color: var(--text-dim); text-decoration: none; }
.uso-tabella a:hover { color: var(--text); text-decoration: underline; }
.utilizzo .saldo { font-size: 13px; color: var(--muted); }
.utilizzo .saldo b { font-size: 20px; color: var(--text); font-weight: 600; margin-right: 4px; }
.riserve { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 18px; margin-top: 14px; }
.riserve span { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-dim); margin-bottom: 6px; }
.riserve em { font-style: normal; color: var(--text); font-variant-numeric: tabular-nums; }
.riserve small { display: block; margin-top: 5px; font-size: 11.5px; color: var(--muted); }
.periodo {
  display: inline-flex; gap: 2px; margin: 26px 0 14px; padding: 3px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
}
.periodo button {
  padding: 5px 13px; border: 0; border-radius: 999px; background: none;
  color: var(--muted); font: inherit; font-size: 12.5px; cursor: pointer;
}
.periodo button.on { background: var(--surface-3); color: var(--text); }
.periodo em { font-style: normal; color: var(--accent); margin-left: 4px; }
.piani { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px; }
.piano {
  display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); background: color-mix(in srgb, var(--surface) 86%, transparent); overflow: hidden;
}
.piano.evidenza { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.piano .testa { display: flex; flex-direction: column; gap: 10px; padding: 18px; border-bottom: 1px solid var(--line); }
.piano h3 { margin: 0; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.piano .testa > p { margin: 0; min-height: 3em; font-size: 12.5px; color: var(--muted); }
.piano .prezzo b { display: block; font-size: 30px; font-weight: 600; letter-spacing: -.02em; }
.piano .prezzo b.piccolo { font-size: 20px; padding: 8px 0 3px; color: var(--text-dim); }
.piano .prezzo small { font-size: 11.5px; color: var(--muted); }
.piano select { margin: 0; }
.piano .btn { justify-content: center; }
.piano ul { list-style: none; margin: 0; padding: 16px 18px 20px; display: flex; flex-direction: column; gap: 8px; }
.piano li { display: flex; gap: 8px; align-items: flex-start; font-size: 12.8px; color: var(--text-dim); }
.piano li svg { flex: 0 0 13px; margin-top: 3px; color: var(--accent); }
.sheet h1 { font-size: 21px; margin: 0 0 4px; letter-spacing: -.02em; }
.sheet .sub { color: var(--muted); margin: 0 0 22px; font-size: 14px; }
.sheet h2 { font-size: 15px; margin: 26px 0 10px; }

.panel {
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
  backdrop-filter: blur(10px);
}
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 11px; }
.card { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; }
.card .k { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.card .v { font-size: 19px; margin-top: 5px; }

.riga { display: flex; align-items: center; gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--line-soft); }
.riga:last-child { border-bottom: 0; }
.riga .lab { flex: 1 1 auto; }
.riga .lab b { display: block; font-size: 13.5px; font-weight: 600; }
.riga .lab small { color: var(--muted); font-size: 12px; }

label { display: block; margin: 14px 0 5px; font-size: 12.5px; color: var(--muted); }
input[type=text], input[type=password], input[type=number], input[type=date], select, textarea {
  width: 100%; padding: 9px 11px;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  font: inherit; font-size: 13.5px; outline: 0;
}
input:focus, select:focus, textarea:focus { border-color: color-mix(in srgb, var(--accent-2) 55%, var(--line)); }
textarea { min-height: 100px; resize: vertical; }
input[type=file] { color: var(--muted); font-size: 13px; }
button { font-family: inherit; }
form .row { display: flex; gap: 14px; flex-wrap: wrap; }
form .row > * { flex: 1 1 210px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
tr:hover td { background: var(--surface-2); }

.flash { padding: 11px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; border: 1px solid var(--line); font-size: 13.5px; white-space: pre-wrap; }
.flash.ok { background: var(--surface-2); background: color-mix(in srgb, var(--ok) 14%, transparent); border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.flash.err { background: var(--surface-2); background: color-mix(in srgb, var(--err) 12%, transparent); border-color: color-mix(in srgb, var(--err) 45%, var(--line)); }
.flash.warn { background: var(--surface-2); background: color-mix(in srgb, var(--warn) 12%, transparent); border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }

.tag { display: inline-block; font-size: 10.5px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.tag.si { border-color: color-mix(in srgb, var(--ok) 55%, var(--line)); color: var(--ok); }
.tag.no { border-color: color-mix(in srgb, var(--err) 55%, var(--line)); color: var(--err); }
.tag.live { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); color: var(--accent); }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.note { border-left: 2px solid var(--accent); padding: 3px 0 3px 12px; color: var(--muted); font-size: 12.5px; margin: 12px 0; }
.sep { height: 1px; background: var(--line); margin: 18px 0; }

/* -------------------------------------------------------------- onboarding */

.solo { min-height: 100vh; display: grid; place-items: center; padding: 30px; position: relative; z-index: 1; }
.solo .box { width: min(460px, 100%); text-align: center; }
.solo h1 { font-size: 23px; margin: 18px 0 6px; letter-spacing: -.02em; }
.solo p { color: var(--text-dim); margin: 0 0 22px; font-size: 14px; }
.scelte { display: flex; gap: 14px; justify-content: center; margin-bottom: 22px; }
.scelta { cursor: pointer; }
.scelta input { position: absolute; opacity: 0; pointer-events: none; }
.scelta .prev {
  width: 150px; height: 96px; border-radius: 11px; border: 2px solid var(--line);
  overflow: hidden; display: block; padding: 8px; text-align: left;
}
.scelta .prev.chiaro { background: #f4f5f8; }
.scelta .prev.scuro { background: #0d0f15; }
.scelta .prev i { display: block; height: 6px; border-radius: 3px; margin-bottom: 5px; }
.scelta .prev.chiaro i { background: #d5d9e3; }
.scelta .prev.scuro i { background: #2a2f3d; }
.scelta .prev i.a { width: 38%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.scelta .prev i.b { width: 82%; }
.scelta .prev i.c { width: 64%; }
.scelta input:checked + .prev { border-color: var(--accent); }
.scelta small { display: block; margin-top: 7px; font-size: 12.5px; color: var(--text-dim); }
.passi { display: flex; gap: 6px; justify-content: center; margin-top: 26px; }
.passi i { width: 6px; height: 6px; border-radius: 999px; background: var(--line); display: block; }
.passi i.on { width: 18px; background: var(--accent); }

/* ------------------------------------------------------------------ varie */

.pill-live { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--accent); }
.pill-live i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); display: block; }
.hide { display: none !important; }

@media (max-width: 1040px) {
  :root { --chat: 340px; }
}
@media (max-width: 860px) {
  .rail { display: none; }
  .project { flex-direction: column; }
  .chatpane { width: 100%; flex: 1 1 auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .resizer { display: none; }
  .filetree { width: 170px; flex: 0 0 170px; }
}
