/* ========== AxonCloud — Cloud ========== */
/* Base uguale al Panel (stessi colori e componenti), più le parti del Cloud in fondo. */

:root {
  --bg: #070a12;
  --bg-elev: #0a0e18;
  --bg-deep: #05070d;
  --surface: #0f1420;
  --surface-2: #111827;
  --border: #1c2436;
  --border-strong: #253046;

  --text: #e6eaf2;
  --text-strong: #ffffff;
  --text-muted: #8b93a7;
  --text-subtle: #5b6479;
  --text-faint: #4b5468;
  --label: #c4cad8;

  --cyan: #06b6d4;
  --cyan-soft: #67e8f9;
  --violet: #8b5cf6;
  --violet-soft: #c4b5fd;
  --gradient: linear-gradient(90deg, var(--cyan), var(--violet));

  --ok: #22c55e;
  --ok-text: #86efac;
  --warn: #f59e0b;
  --warn-text: #fcd34d;
  --err: #ef4444;
  --err-text: #fca5a5;

  --radius-sm: 8px;
  --radius: 9px;
  --radius-md: 14px;

  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --ease: 160ms ease;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
svg { display: block; flex-shrink: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--cyan-soft); outline-offset: 2px; }
.mono { font-family: var(--mono); }
.muted { color: var(--text-muted); }
.subtle { color: var(--text-subtle); }

.glow {
  position: fixed; width: 620px; height: 620px; top: -300px; right: -160px;
  border-radius: 50%; background: rgba(139, 92, 246, .12); filter: blur(160px);
  pointer-events: none; z-index: 0;
}

/* ---------- Layout ---------- */
.app { position: relative; z-index: 1; display: flex; min-height: 100vh; }

.sidebar {
  position: sticky; top: 0;
  width: 232px; height: 100vh; flex-shrink: 0;
  display: flex; flex-direction: column;
  padding: 20px 14px;
  background: rgba(10, 14, 24, .85);
  border-right: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 22px; }
.brand svg { width: 30px; height: 30px; }
.brand__name { font-size: 15px; font-weight: 700; color: var(--text-strong); line-height: 1.2; }
.brand__sub { font-size: 10px; font-weight: 600; letter-spacing: .12em; color: var(--cyan-soft); }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  color: var(--text-muted); font-weight: 500;
  transition: background var(--ease), color var(--ease);
}
.nav a svg { width: 17px; height: 17px; }
.nav a:hover { color: var(--text); background: rgba(255, 255, 255, .03); }
.nav a.is-active { color: var(--text-strong); font-weight: 600; background: rgba(139, 92, 246, .12); border-color: rgba(139, 92, 246, .3); }
.nav a.is-active svg { color: var(--violet-soft); }
.nav__badge {
  margin-left: auto; padding: 1px 6px; border-radius: 5px;
  font-size: 10px; font-weight: 600; color: var(--cyan-soft); background: rgba(6, 182, 212, .12);
}

.sidebar__foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; }
.me { display: flex; align-items: center; gap: 10px; padding: 0 8px 10px; }
.me__name { font-weight: 600; color: var(--text-strong); }
.me__role { font-size: 11px; font-weight: 500; color: var(--violet-soft); }
.sidebar__link {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border: 0; border-radius: var(--radius-sm); background: none;
  color: var(--text-muted); font-weight: 500; cursor: pointer; text-align: left;
}
.sidebar__link svg { width: 16px; height: 16px; }
.sidebar__link:hover { color: var(--text); background: rgba(255, 255, 255, .03); }

main.main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 20px; padding: 28px 32px; }
.page { display: flex; flex-direction: column; gap: 16px; flex: 1; min-height: 0; }

.head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.head h1 { margin: 0; font-size: 22px; font-weight: 700; color: var(--text-strong); letter-spacing: -.01em; }
.head p { margin: 2px 0 0; font-size: 12px; color: var(--text-muted); }

/* ---------- Avatar ---------- */
.avatar {
  width: 32px; height: 32px; flex-shrink: 0;
  display: grid; place-items: center; border-radius: 50%;
  font-size: 12px; font-weight: 700; color: var(--text-strong);
  background: rgba(139, 92, 246, .2); border: 1px solid rgba(139, 92, 246, .4);
}
.avatar--lg { width: 42px; height: 42px; font-size: 15px; }
.avatar--c1 { background: rgba(6, 182, 212, .2); border-color: rgba(6, 182, 212, .4); }
.avatar--c2 { background: rgba(34, 197, 94, .2); border-color: rgba(34, 197, 94, .4); }
.avatar--c3 { background: rgba(245, 158, 11, .2); border-color: rgba(245, 158, 11, .4); }

/* ---------- Card, pill, badge ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 16px 18px; }
.card__title { margin: 0 0 8px; font-size: 15px; font-weight: 600; color: var(--text-strong); display: flex; justify-content: space-between; align-items: center; }
.card__title a { font-size: 12px; font-weight: 500; color: var(--cyan-soft); }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px 3px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 500; white-space: nowrap; border: 1px solid;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill--ok   { color: var(--ok-text);   background: rgba(34, 197, 94, .1);  border-color: rgba(34, 197, 94, .3); }
.pill--warn { color: var(--warn-text); background: rgba(245, 158, 11, .1); border-color: rgba(245, 158, 11, .3); }
.pill--err  { color: var(--err-text);  background: rgba(239, 68, 68, .1);  border-color: rgba(239, 68, 68, .3); }
.pill--off  { color: var(--text-muted); background: rgba(139, 147, 167, .08); border-color: rgba(139, 147, 167, .25); }
.pill--lg { padding: 6px 12px; font-size: 12px; }

.badge { display: inline-block; padding: 2px 7px; border-radius: 6px; font-size: 11px; font-weight: 600; border: 1px solid; }
.badge--admin { color: var(--violet-soft); background: rgba(139, 92, 246, .12); border-color: rgba(139, 92, 246, .3); }
.badge--user  { color: var(--text-muted); background: rgba(139, 147, 167, .1); border-color: rgba(139, 147, 167, .25); }
.badge--ok    { color: var(--ok-text); background: rgba(34, 197, 94, .1); border-color: rgba(34, 197, 94, .3); }
.badge--err   { color: var(--err-text); background: rgba(239, 68, 68, .1); border-color: rgba(239, 68, 68, .3); }
.tag { padding: 1px 5px; border-radius: 4px; font-size: 9px; font-weight: 600; color: var(--text-muted); background: rgba(139, 147, 167, .12); }

/* ---------- Pulsanti ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 30px; padding: 0 10px;
  border: 1px solid var(--border-strong); border-radius: 7px;
  background: var(--bg-elev); color: var(--text);
  font-size: 12px; font-weight: 500; white-space: nowrap; cursor: pointer;
  transition: border-color var(--ease), background var(--ease), opacity var(--ease);
}
.btn svg { width: 13px; height: 13px; }
.btn:hover { background: var(--surface-2); border-color: #33405a; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn--md { height: 36px; padding: 0 12px; font-size: 13px; border-radius: var(--radius); }
.btn--ok  { color: var(--ok-text);  background: rgba(34, 197, 94, .1);  border-color: rgba(34, 197, 94, .35); }
.btn--ok:hover  { background: rgba(34, 197, 94, .16); border-color: rgba(34, 197, 94, .5); }
.btn--err { color: var(--err-text); background: rgba(239, 68, 68, .08); border-color: rgba(239, 68, 68, .35); }
.btn--err:hover { background: rgba(239, 68, 68, .14); border-color: rgba(239, 68, 68, .55); }
.btn--warn { color: var(--warn-text); background: rgba(245, 158, 11, .06); border-color: rgba(245, 158, 11, .3); }
.btn--primary { border: 0; background: var(--gradient); color: #fff; font-weight: 600; }
.btn--primary:hover { background: var(--gradient); filter: brightness(1.08); }
.btn--ghost { background: transparent; }
.btn--block { width: 100%; }

/* ---------- Campi ---------- */
.input, .select {
  height: 36px; padding: 0 12px;
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--text-strong);
  font-size: 13px; outline: none;
  transition: border-color var(--ease), box-shadow var(--ease);
}
.input::placeholder { color: var(--text-subtle); }
.input:focus, .select:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(6, 182, 212, .2); }
.input--error { border-color: var(--err); }
.select { padding-right: 30px; appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238b93a7' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span:first-child { font-size: 12px; font-weight: 500; color: var(--label); }
.field small { font-size: 11px; color: var(--text-subtle); }
.field small.is-error { color: var(--err-text); }
.field .input, .field .select { width: 100%; background: var(--bg-elev); }
.input-wrap { position: relative; display: flex; }
.input-wrap .input { padding-right: 70px; }
.input-wrap__btns { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); display: flex; gap: 2px; }
.input-wrap__btns button { width: 28px; height: 28px; display: grid; place-items: center; border: 0; border-radius: 6px; background: none; color: var(--text-muted); cursor: pointer; }
.input-wrap__btns button:hover { color: var(--text); background: rgba(255, 255, 255, .05); }
.input-wrap__btns svg { width: 15px; height: 15px; }
.input-suffix { position: relative; }
.input-suffix::after { content: attr(data-suffix); position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 12px; color: var(--text-muted); pointer-events: none; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.search { position: relative; flex: 1; min-width: 200px; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; color: var(--text-subtle); }
.search .input { width: 100%; padding-left: 34px; }
.labeled { display: flex; align-items: center; gap: 8px; height: 36px; padding-left: 12px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); }
.labeled > span { font-size: 12px; color: var(--text-subtle); }
.labeled .select { height: 34px; border: 0; background-color: transparent; padding-left: 0; font-family: var(--mono); font-weight: 500; }
.labeled .select:focus { box-shadow: none; }

.seg { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); }
.seg button { height: 28px; padding: 0 10px; border: 0; border-radius: 6px; background: none; color: var(--text-muted); font-size: 12px; font-weight: 500; cursor: pointer; }
.seg button.is-active { background: var(--border-strong); color: var(--text-strong); }

.live-btn { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border-radius: var(--radius); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-muted); font-size: 13px; font-weight: 500; cursor: pointer; }
.live-btn::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--text-faint); }
.live-btn.is-on { color: var(--ok-text); background: rgba(34, 197, 94, .08); border-color: rgba(34, 197, 94, .35); }
.live-btn.is-on::before { background: var(--ok); }

.statusbar { display: flex; justify-content: space-between; gap: 16px; font-size: 12px; color: var(--text-subtle); }
.statusbar button { border: 0; background: none; color: var(--cyan-soft); font-size: 12px; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.note { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-subtle); }
.note svg { width: 13px; height: 13px; }

/* ---------- Barre ---------- */
.bar { height: 6px; border-radius: 3px; background: var(--border); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 3px; background: var(--cyan); transition: width .4s ease; }
.bar--sm { height: 4px; }
.bar.is-violet > i { background: var(--violet); }
.bar.is-ok > i { background: var(--ok); }
.bar.is-warn > i { background: var(--warn); }
.bar.is-err > i { background: var(--err); }

/* ---------- Dashboard ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat { display: flex; flex-direction: column; gap: 12px; }
.stat__label { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 500; color: var(--text-muted); }
.stat__label svg { width: 15px; height: 15px; }
.stat__value { display: flex; align-items: baseline; gap: 6px; font-family: var(--mono); }
.stat__value b { font-size: 26px; font-weight: 700; color: var(--text-strong); line-height: 1; }
.stat__value span { font-size: 13px; color: var(--text-muted); }
.stat__detail { font-family: var(--mono); font-size: 11px; color: var(--text-subtle); }

.dash-row { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; align-items: start; }
.svc-list { display: flex; flex-direction: column; }
.svc { display: flex; align-items: center; gap: 12px; padding: 10px; border-top: 1px solid var(--border); }
.svc__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.svc__dot.is-off { background: var(--err); }
.svc__dot.is-warn { background: var(--warn); }
.svc__name { width: 210px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.svc__name b { display: flex; align-items: center; gap: 6px; font-family: var(--mono); font-weight: 500; color: var(--text-strong); }
.svc__name small { font-family: var(--mono); font-size: 11px; color: var(--text-subtle); }
.svc__state { width: 64px; font-weight: 500; }
.svc__num { width: 70px; font-family: var(--mono); font-size: 12px; color: var(--text-muted); }
.svc__act { margin-left: auto; }
.is-ok-text { color: var(--ok-text); }
.is-err-text { color: var(--err-text); }
.is-warn-text { color: var(--warn-text); }

.kv { display: flex; flex-direction: column; }
.kv div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--border); font-size: 12px; }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; font-family: var(--mono); font-weight: 500; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Tabelle ---------- */
.table-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); overflow: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  position: sticky; top: 0;
  padding: 10px 12px; text-align: left; white-space: nowrap;
  font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-subtle);
  background: var(--bg-elev); border-bottom: 1px solid var(--border);
}
.table td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; height: 46px; }
.table tr:last-child td { border-bottom: 0; }
.table th:first-child, .table td:first-child { padding-left: 20px; }
.table th:last-child, .table td:last-child { padding-right: 16px; }
.table .num { font-family: var(--mono); font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.table .actions { display: flex; gap: 6px; justify-content: flex-end; }
.table tr.is-err td { background: rgba(239, 68, 68, .04); }
.table tr.is-selected td { background: rgba(139, 92, 246, .08); }
.table tr.is-selected td:first-child { box-shadow: inset 2px 0 0 rgba(139, 92, 246, .6); }
.table tr.is-click { cursor: pointer; }
.table tr.is-click:hover td { background: rgba(255, 255, 255, .02); }
.table .cmd { font-family: var(--mono); font-size: 12px; max-width: 0; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table .empty { text-align: center; color: var(--text-subtle); padding: 28px; }
.svc-name { display: flex; align-items: center; gap: 6px; font-family: var(--mono); font-weight: 500; color: var(--text-strong); }
.svc-name svg { width: 12px; height: 12px; color: var(--text-subtle); }
.locked { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-faint); }
.locked svg { width: 12px; height: 12px; }
.minibar { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 12px; }
.minibar .bar { width: 48px; }
.user-cell { display: flex; align-items: center; gap: 10px; }
.user-cell b { display: block; font-weight: 600; color: var(--text-strong); }
.user-cell small { display: block; font-family: var(--mono); font-size: 11px; color: var(--text-subtle); }

/* ---------- Log ---------- */
.logview {
  flex: 1; min-height: 300px; overflow: auto;
  padding: 14px 0;
  background: var(--bg-deep); border: 1px solid var(--border); border-radius: var(--radius-md);
  font-family: var(--mono); font-size: 12px; line-height: 1.6;
}
.logline { display: flex; gap: 14px; padding: 1px 18px; white-space: pre-wrap; word-break: break-word; }
.logline time { flex-shrink: 0; color: var(--text-faint); }
.logline b { flex-shrink: 0; width: 36px; font-size: 11px; font-weight: 700; color: var(--text-muted); }
.logline.is-warn { background: rgba(245, 158, 11, .04); color: var(--warn-text); }
.logline.is-warn b { color: var(--warn); }
.logline.is-err { background: rgba(239, 68, 68, .07); color: var(--err-text); }
.logline.is-err b { color: var(--err); }
.logwait { display: flex; align-items: center; gap: 8px; padding: 8px 18px 0; color: var(--text-subtle); }
.logwait::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }

/* ---------- Terminale ---------- */
.term { flex: 1; min-height: 360px; display: flex; flex-direction: column; background: var(--bg-deep); border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.term:fullscreen { border-radius: 0; }
.term__bar { display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 16px; background: var(--bg-elev); border-bottom: 1px solid var(--border); font-family: var(--mono); font-size: 12px; }
.term__bar .svc__dot { flex-shrink: 0; }
.term__bar .actions { margin-left: auto; display: flex; gap: 8px; }
.term__screen { position: relative; flex: 1; min-height: 0; padding: 12px 6px 6px 14px; }
.term__screen .xterm { height: 100%; }
.term__msg { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(5, 7, 13, .85); }
.term__msg div { display: flex; flex-direction: column; align-items: center; gap: 12px; color: var(--text-muted); }

.lock-wrap { flex: 1; display: grid; place-items: center; padding: 24px; background: var(--bg-deep); border: 1px solid var(--border); border-radius: var(--radius-md); }
.lock-card { width: 100%; max-width: 420px; display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 32px; text-align: center; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; }
.lock-card h2 { margin: 0; font-size: 20px; color: var(--text-strong); }
.lock-card p { margin: 0; color: var(--text-muted); }
.lock-card > a:last-child { font-size: 12px; font-weight: 500; color: var(--cyan-soft); }
.icon-box { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 14px; color: var(--cyan-soft); background: rgba(6, 182, 212, .12); border: 1px solid rgba(6, 182, 212, .35); }
.icon-box svg { width: 22px; height: 22px; }
.icon-box--err { color: var(--err-text); background: rgba(239, 68, 68, .12); border-color: rgba(239, 68, 68, .35); }
.btn--big { height: 46px; font-size: 14px; border-radius: 10px; }

/* ---------- Utenti ---------- */
.users { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; flex: 1; }
.users__list { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.drawer { position: sticky; top: 28px; display: flex; flex-direction: column; gap: 18px; padding: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); }
.drawer__head { display: flex; align-items: center; gap: 12px; }
.drawer__head div { flex: 1; min-width: 0; }
.drawer__head b { display: block; font-size: 16px; color: var(--text-strong); }
.drawer__head small { display: block; font-family: var(--mono); font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; }
.drawer__meta { font-size: 11px; color: var(--text-subtle); margin-top: -8px; }
.drawer__empty { color: var(--text-subtle); text-align: center; padding: 40px 0; }
.drawer hr { width: 100%; border: 0; border-top: 1px solid var(--border); margin: 0; }
.section-label { font-size: 10px; font-weight: 600; letter-spacing: .08em; color: var(--text-subtle); }
.acts { display: flex; flex-direction: column; gap: 6px; }
.act {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--bg-elev); color: var(--text); text-align: left; cursor: pointer;
}
.act svg { width: 15px; height: 15px; }
.act span { display: flex; flex-direction: column; }
.act b { font-weight: 500; }
.act small { font-size: 11px; color: var(--text-subtle); }
.act:hover { border-color: #33405a; }
.act:disabled { opacity: .45; cursor: not-allowed; }
.act--warn { color: var(--warn-text); background: rgba(245, 158, 11, .06); border-color: rgba(245, 158, 11, .3); }
.act--ok { color: var(--ok-text); background: rgba(34, 197, 94, .06); border-color: rgba(34, 197, 94, .3); }
.act--err { color: var(--err-text); background: rgba(239, 68, 68, .06); border-color: rgba(239, 68, 68, .3); }

/* ---------- Finestre (dialog) ---------- */
dialog {
  width: min(440px, calc(100vw - 32px)); padding: 24px;
  border: 1px solid var(--border-strong); border-radius: 16px;
  background: var(--surface); color: var(--text);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .5);
}
dialog::backdrop { background: rgba(0, 0, 0, .55); }
dialog form { display: flex; flex-direction: column; gap: 16px; }
.dlg__head { display: flex; gap: 12px; }
.dlg__head div { flex: 1; }
.dlg__head h2 { margin: 0 0 4px; font-size: 17px; font-weight: 600; color: var(--text-strong); }
.dlg__head p { margin: 0; color: var(--text-muted); }
.dlg__x { width: 28px; height: 28px; display: grid; place-items: center; border: 0; border-radius: 6px; background: none; color: var(--text-muted); cursor: pointer; }
.dlg__x:hover { color: var(--text); background: rgba(255, 255, 255, .05); }
.dlg__x svg { width: 16px; height: 16px; }
.dlg__btns { display: flex; justify-content: flex-end; gap: 8px; }
.dlg__error { padding: 8px 12px; border-radius: var(--radius-sm); font-size: 12px; color: var(--err-text); background: rgba(239, 68, 68, .08); border: 1px solid rgba(239, 68, 68, .3); }

/* ---------- Avvisi ---------- */
.toast {
  position: fixed; right: 24px; bottom: 24px; z-index: 50;
  max-width: 360px; padding: 10px 14px; border-radius: var(--radius);
  font-size: 13px; font-weight: 500;
  background: var(--surface-2); border: 1px solid var(--border-strong); box-shadow: 0 12px 30px rgba(0, 0, 0, .4);
}
.toast--ok { color: var(--ok-text); border-color: rgba(34, 197, 94, .4); }
.toast--err { color: var(--err-text); border-color: rgba(239, 68, 68, .4); }

.denied { flex: 1; display: grid; place-items: center; }

/* ---------- Schermi piccoli ---------- */
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-row, .users { grid-template-columns: 1fr; }
  .drawer { position: static; }
}
@media (max-width: 760px) {
  .app { flex-direction: column; }
  .sidebar { position: static; width: 100%; height: auto; padding: 12px; }
  .brand { padding-bottom: 12px; }
  .nav { flex-direction: row; overflow-x: auto; }
  .nav a { flex-shrink: 0; }
  .sidebar__foot { flex-direction: row; margin-top: 8px; padding-top: 8px; }
  .me { display: none; }
  main.main { padding: 20px 16px; }
  .stats { grid-template-columns: 1fr; }
}


/* ===================================================================== */
/* ========================== Parti del Cloud ========================== */
/* ===================================================================== */
body.no-scroll { overflow: hidden; }
main.main { padding-bottom: 90px; }
.btn--violet { border: 0; background: var(--violet); color: #fff; font-weight: 600; }
.btn--violet:hover { background: #7c4ff0; }
.btn--run { border: 0; background: var(--ok); color: #04130a; font-weight: 700; }
.btn--run:hover { background: #2fd46b; }
.btn--upload { height: 36px; margin-bottom: 16px; border: 0; border-radius: var(--radius); background: var(--violet); color: #fff; font-size: 13px; font-weight: 600; }
.btn--upload:hover { background: #7c4ff0; }
.btn--upload svg { width: 15px; height: 15px; }
.with-icon { display: inline-flex; align-items: center; gap: 6px; }
.with-icon svg { width: 13px; height: 13px; }
.pill--cyan { color: var(--cyan-soft); background: rgba(6, 182, 212, .1); border-color: rgba(6, 182, 212, .35); }

/* Sidebar */
.nav__label { margin: 16px 10px 6px; font-size: 10px; font-weight: 600; letter-spacing: .08em; color: var(--text-subtle); }
.nav__lock { margin-left: auto; width: 13px !important; height: 13px !important; color: var(--text-subtle); }
.nav__badge { color: var(--violet-soft); background: rgba(139, 92, 246, .16); }
.space { margin-top: auto; margin-bottom: 14px; padding: 12px; display: flex; flex-direction: column; gap: 8px; border: 1px solid var(--border-strong); border-radius: var(--radius-md); background: var(--surface); }
.space__title { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--text-strong); font-size: 12px; }
.space__title svg { width: 14px; height: 14px; }
.space small { font-size: 11px; color: var(--text-muted); }
.bar--grad > i { background: var(--gradient); }
.bar--grad.is-full > i { background: var(--err); }
.sidebar__foot { margin-top: 0; }

/* Intestazione */
.head__right { display: flex; align-items: center; gap: 10px; }
.head--tight { align-items: flex-end; }
.h1-row { display: flex; align-items: center; gap: 10px; }
.crumbs { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; font-size: 12px; color: var(--text-muted); flex-wrap: wrap; }
.crumbs svg { width: 12px; height: 12px; color: var(--text-faint); }
.crumbs a:hover { color: var(--text); }
.seg--right { margin-left: auto; }
.seg button { display: inline-flex; align-items: center; gap: 6px; }
.seg button svg { width: 13px; height: 13px; }
.seg button.is-active { background: rgba(139, 92, 246, .18); color: var(--text-strong); }
.banner { display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-radius: 10px; color: var(--err-text); background: rgba(239, 68, 68, .07); border: 1px solid rgba(239, 68, 68, .35); }
.banner svg { width: 15px; height: 15px; }
.center { flex: 1; display: grid; place-items: center; min-height: 70vh; }
.icon-box--violet { color: var(--violet-soft); background: rgba(139, 92, 246, .14); border-color: rgba(139, 92, 246, .4); }
.lock-card .btn { margin-top: 4px; }

/* Icone dei file */
.ficon { width: 30px; height: 30px; flex-shrink: 0; display: grid; place-items: center; border-radius: 7px; color: var(--text-muted); background: rgba(139, 147, 167, .1); }
.ficon svg { width: 15px; height: 15px; }
.ficon--sm { width: 22px; height: 22px; border-radius: 5px; }
.ficon--sm svg { width: 12px; height: 12px; }
.ficon--xl { width: 64px; height: 64px; border-radius: 16px; background: transparent !important; }
.ficon--xl svg { width: 40px; height: 40px; }
.ficon--dir    { color: var(--violet-soft); background: rgba(139, 92, 246, .14); }
.ficon--codice { color: var(--violet-soft); background: rgba(139, 92, 246, .14); }
.ficon--pdf    { color: #f87171; background: rgba(239, 68, 68, .12); }
.ficon--sheet  { color: var(--ok-text); background: rgba(34, 197, 94, .12); }
.ficon--img    { color: var(--cyan-soft); background: rgba(6, 182, 212, .12); }
.ficon--video  { color: #f9a8d4; background: rgba(236, 72, 153, .12); }
.ficon--audio  { color: #f9a8d4; background: rgba(236, 72, 153, .12); }
.ficon--zip    { color: var(--warn-text); background: rgba(245, 158, 11, .12); }
.ficon--code   { color: #fdba74; background: rgba(249, 115, 22, .12); }
.ficon--text   { color: #93c5fd; background: rgba(59, 130, 246, .12); }
.ficon--code-java { color: #fdba74; background: rgba(249, 115, 22, .14); }
.ficon--code-c    { color: #93c5fd; background: rgba(59, 130, 246, .14); }

/* Chip */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 500; white-space: nowrap; color: var(--text-muted); background: rgba(139, 147, 167, .1); border: 1px solid rgba(139, 147, 167, .25); }
.chip svg { width: 11px; height: 11px; }
.chip--violet { color: var(--violet-soft); background: rgba(139, 92, 246, .12); border-color: rgba(139, 92, 246, .35); }
.chip--ok { color: var(--ok-text); background: rgba(34, 197, 94, .1); border-color: rgba(34, 197, 94, .35); }
.chip--cyan { color: var(--cyan-soft); background: rgba(6, 182, 212, .1); border-color: rgba(6, 182, 212, .35); }
.chip--err { color: var(--err-text); background: rgba(239, 68, 68, .1); border-color: rgba(239, 68, 68, .35); }
.chip--warn { color: var(--warn-text); background: rgba(245, 158, 11, .1); border-color: rgba(245, 158, 11, .35); }
.chip--java { border-radius: 6px; color: #fdba74; background: rgba(249, 115, 22, .1); border-color: rgba(249, 115, 22, .4); }
.chip--c { border-radius: 6px; color: #93c5fd; background: rgba(59, 130, 246, .1); border-color: rgba(59, 130, 246, .4); }
.chip--mono { border-radius: 6px; font-family: var(--mono); color: var(--text); background: var(--surface-2); border-color: var(--border-strong); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* Pulsanti a icona */
.icon-btn { width: 28px; height: 28px; display: inline-grid; place-items: center; border: 1px solid transparent; border-radius: 7px; background: none; color: var(--text-muted); cursor: pointer; }
.icon-btn svg { width: 14px; height: 14px; }
.icon-btn:hover { color: var(--text-strong); background: rgba(255, 255, 255, .05); }
.icon-btn--box { width: 34px; height: 34px; border-color: var(--border-strong); background: var(--bg-elev); }
.icon-btn--err { color: var(--err-text); border-color: rgba(239, 68, 68, .4); background: rgba(239, 68, 68, .06); }
.icon-btn.is-star { color: var(--warn); }
.icon-btn.is-star svg { fill: var(--warn); }

/* Elenco file */
.check { appearance: none; width: 16px; height: 16px; margin: 0; display: inline-grid; place-items: center; border: 1.5px solid #3a4560; border-radius: 4px; background: var(--bg-elev); cursor: pointer; vertical-align: middle; }
.check:checked { border-color: var(--violet); background: var(--violet); }
.check:checked::after { content: ""; width: 4px; height: 8px; margin-top: -2px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.table--files th.ck, .table--files td.ck { width: 36px; padding-right: 0; }
.table td { height: 52px; }
.table tbody tr:hover td { background: rgba(255, 255, 255, .015); }
.fname { display: inline-flex; align-items: center; gap: 12px; max-width: 100%; padding: 0; border: 0; background: none; color: var(--text-strong); font-weight: 500; text-align: left; cursor: pointer; }
.fname > span:not(.ficon):not(.chip):not(.star) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
button.fname:hover > span:nth-child(2) { text-decoration: underline; text-decoration-color: var(--text-faint); }
.fname.is-dim { color: var(--text-muted); cursor: default; }
.star { color: var(--warn); }
.star svg { width: 13px; height: 13px; fill: var(--warn); }
.where { display: block; margin: 2px 0 0 42px; font-size: 11px; color: var(--text-subtle); }
.shared { display: inline-flex; align-items: center; gap: 6px; margin-right: 10px; color: var(--text-muted); font-size: 12px; }
.shared svg { width: 13px; height: 13px; }
.shared--link { color: var(--cyan-soft); }
.row-acts { display: flex; gap: 6px; justify-content: flex-end; align-items: center; }
.row-acts .icon-btn:not(.icon-btn--more) { opacity: 0; border-color: var(--border-strong); }
tr:hover .row-acts .icon-btn { opacity: 1; }
.row-acts--always .icon-btn { opacity: 1 !important; }
.table tr.is-off td { opacity: .55; }
.table tr.is-off td:last-child { opacity: 1; }
.user-inline { display: inline-flex; align-items: center; gap: 8px; }
.avatar--xs { width: 22px; height: 22px; font-size: 10px; }
.avatar--photo { background: none; border: 0; overflow: hidden; }
.avatar--photo img { width: 100%; height: 100%; object-fit: cover; }
.link-short { color: var(--cyan-soft); font-size: 12px; }
.empty-box { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 48px; color: var(--text-subtle); border: 1px dashed var(--border-strong); border-radius: var(--radius-md); }
.empty-box svg { width: 28px; height: 28px; }
.empty-box p { margin: 0; }
.empty-box--flat { border: 0; padding: 24px; }

/* Griglia */
.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin-bottom: 8px; }
.fcard { position: relative; display: flex; align-items: center; gap: 4px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.fcard:hover, .gcard:hover { border-color: var(--border-strong); }
.fcard__main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 0; border: 0; background: none; text-align: left; cursor: pointer; }
.fcard__main > span:last-child { min-width: 0; }
.fcard__main b { display: block; color: var(--text-strong); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fcard__main small { display: block; font-size: 11px; color: var(--text-subtle); }
.fcard__check { position: absolute; top: 6px; left: 6px; opacity: 0; }
.fcard:hover .fcard__check, .fcard.is-selected .fcard__check { opacity: 1; }
.fcard.is-selected, .gcard.is-selected { border-color: var(--violet); box-shadow: 0 0 0 1px var(--violet); }
.ggrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.gcard { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); overflow: hidden; }
.gcard__thumb { position: relative; height: 128px; display: grid; place-items: center; background: var(--bg-deep); cursor: pointer; overflow: hidden; }
.gcard__thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb__icon { display: grid; place-items: center; }
.snip { position: absolute; inset: 0; margin: 0; padding: 12px; font-family: var(--mono); font-size: 9.5px; line-height: 1.55; color: var(--text-muted); white-space: pre; overflow: hidden; background: #070a12; }
.gcard__check { position: absolute; top: 8px; left: 8px; opacity: 0; }
.gcard:hover .gcard__check, .gcard.is-selected .gcard__check { opacity: 1; }
.gcard__star { position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 6px; background: rgba(0, 0, 0, .55); color: var(--warn); }
.gcard__star svg { width: 13px; height: 13px; fill: var(--warn); }
.tbadge { position: absolute; left: 8px; bottom: 8px; display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; border-radius: 6px; font-size: 10px; color: var(--cyan-soft); background: rgba(0, 0, 0, .6); }
.tbadge svg { width: 10px; height: 10px; }
.gcard__foot { display: flex; align-items: center; gap: 8px; padding: 10px 8px 10px 12px; }
.gcard__name { flex: 1; min-width: 0; padding: 0; border: 0; background: none; text-align: left; cursor: pointer; }
.gcard__name b { display: block; color: var(--text-strong); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gcard__name small { display: block; font-size: 11px; color: var(--text-subtle); }

/* Barra della selezione */
.selbar { position: fixed; left: calc(50% + 116px); bottom: 24px; transform: translateX(-50%); z-index: 30; display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 18px; border: 1px solid var(--border-strong); border-radius: 14px; background: var(--surface-2); box-shadow: 0 16px 40px rgba(0, 0, 0, .5); }
.selbar b { margin-right: 4px; color: var(--text-strong); white-space: nowrap; }

/* Menu "..." */
.menu { position: fixed; z-index: 60; min-width: 200px; padding: 5px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface-2); box-shadow: 0 16px 40px rgba(0, 0, 0, .5); }
.menu button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 0; border-radius: 6px; background: none; color: var(--text); font-size: 13px; text-align: left; cursor: pointer; }
.menu button svg { width: 14px; height: 14px; color: var(--text-muted); }
.menu button:hover { background: rgba(255, 255, 255, .05); }
.menu button.is-danger, .menu button.is-danger svg { color: var(--err-text); }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }

/* Trascina qui e caricamenti */
.dropzone { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; background: rgba(7, 10, 18, .8); pointer-events: none; }
.dropzone div { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 40px 60px; border: 2px dashed var(--violet); border-radius: 20px; color: var(--violet-soft); font-size: 16px; font-weight: 600; }
.dropzone svg { width: 34px; height: 34px; }
.uploads { position: fixed; right: 24px; bottom: 80px; z-index: 40; width: 320px; display: flex; flex-direction: column; gap: 10px; padding: 14px; border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface-2); box-shadow: 0 16px 40px rgba(0, 0, 0, .5); }
.uploads > b { display: flex; align-items: center; gap: 8px; color: var(--text-strong); }
.uploads > b svg { width: 14px; height: 14px; color: var(--violet-soft); }
.up { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; font-size: 12px; }
.up span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up small { color: var(--text-muted); font-family: var(--mono); }
.up .bar { grid-column: 1 / -1; }
.up .bar > i { background: var(--violet); }
.up.is-err small { color: var(--err-text); }

/* Finestre del Cloud */
.dlg--wide { width: min(540px, calc(100vw - 32px)); }
.dlg__head .ficon { width: 36px; height: 36px; }
.picker { display: flex; flex-direction: column; gap: 2px; max-height: 280px; overflow: auto; padding: 6px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--bg-elev); }
.picker button { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 0; border-radius: 6px; background: none; color: var(--text); text-align: left; cursor: pointer; }
.picker button svg { width: 15px; height: 15px; color: var(--violet-soft); }
.picker button:hover { background: rgba(255, 255, 255, .05); }
.picker p { margin: 8px 10px; }

/* Condividi */
.share__label { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--text-strong); }
.share__label svg { width: 15px; height: 15px; }
.row-input { display: flex; gap: 8px; align-items: center; }
.row-input .search { min-width: 0; }
.search--focus .input:focus { border-color: var(--violet); box-shadow: 0 0 0 3px rgba(139, 92, 246, .2); }
.select--sm { height: 36px; font-size: 12px; background-color: var(--bg-elev); }
.found { display: flex; flex-direction: column; gap: 2px; margin-top: -8px; padding: 4px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--bg-elev); }
.found button { display: flex; align-items: center; gap: 10px; padding: 8px; border: 0; border-radius: 7px; background: none; text-align: left; cursor: pointer; }
.found button:hover { background: rgba(139, 92, 246, .12); }
.found b, .person b { display: block; color: var(--text-strong); font-weight: 500; }
.found small, .person small { display: block; font-size: 11px; color: var(--text-muted); }
.found p { margin: 8px; }
.people { display: flex; flex-direction: column; gap: 10px; }
.person { display: flex; align-items: center; gap: 10px; }
.person > span:nth-child(2) { flex: 1; min-width: 0; }
.share hr, .viewer__side hr { width: 100%; border: 0; border-top: 1px solid var(--border); margin: 0; }
.share-link { display: flex; flex-direction: column; gap: 12px; }
.share-link__head { display: flex; align-items: center; gap: 10px; }
.share-link__head > svg { width: 15px; height: 15px; color: var(--cyan-soft); }
.share-link__head > span { flex: 1; }
.share-link__head b { display: block; color: var(--text-strong); }
.share-link__head small { display: block; font-size: 11px; color: var(--text-muted); }
.share-link .field > span:first-child { display: flex; align-items: center; gap: 6px; }
.share-link .field > span:first-child svg { width: 12px; height: 12px; }
.input--link { flex: 1; color: var(--cyan-soft); background: var(--bg-elev); }
.toggle { position: relative; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; }
.switch { display: block; position: relative; width: 34px; height: 20px; border-radius: 99px; background: #2a3247; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: left .15s; }
.toggle input:checked + .switch { background: var(--violet); }
.toggle input:checked + .switch::after { left: 17px; }
.toggle input:focus-visible + .switch { outline: 2px solid var(--violet-soft); outline-offset: 2px; }

/* Anteprima */
.viewer { position: fixed; inset: 0; z-index: 45; display: flex; flex-direction: column; background: rgba(5, 7, 13, .96); }
.viewer__bar { display: flex; align-items: center; gap: 10px; padding: 12px 20px; border-bottom: 1px solid var(--border); background: var(--bg-elev); }
.viewer__name { flex: 1; min-width: 0; }
.viewer__name b { display: block; color: var(--text-strong); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer__name small { display: block; font-size: 11px; color: var(--text-muted); }
.viewer__sep { width: 1px; height: 24px; background: var(--border-strong); margin: 0 4px; }
.viewer__body { flex: 1; min-height: 0; display: flex; }
.viewer__stage { position: relative; flex: 1; min-width: 0; display: grid; place-items: center; padding: 40px 90px 80px; overflow: hidden; }
.viewer__stage img { max-width: 100%; max-height: 100%; object-fit: contain; transition: transform .15s; border-radius: 6px; }
.viewer__stage iframe { width: 100%; height: 100%; border: 0; border-radius: 8px; background: #fff; }
.viewer__stage video { max-width: 100%; max-height: 100%; border-radius: 8px; }
.viewer__text { width: 100%; height: 100%; margin: 0; padding: 20px; overflow: auto; font-family: var(--mono); font-size: 12.5px; line-height: 1.6; white-space: pre; color: var(--text); background: var(--bg-deep); border: 1px solid var(--border); border-radius: 10px; }
.viewer__audio, .viewer__none { display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; }
.viewer__none b { color: var(--text-strong); font-size: 15px; }
.viewer__none p { margin: 0; color: var(--text-muted); }
.viewer__nav { position: absolute; top: 50%; transform: translateY(-50%); width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); cursor: pointer; }
.viewer__nav svg { width: 18px; height: 18px; }
.viewer__nav:hover { background: var(--surface-2); }
.viewer__nav--prev { left: 28px; }
.viewer__nav--next { right: 28px; }
.viewer__tools { position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; padding: 6px 12px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); font-size: 12px; color: var(--text-muted); }
.viewer__tools button { width: 26px; height: 26px; display: grid; place-items: center; border: 0; border-radius: 6px; background: none; color: var(--text); cursor: pointer; }
.viewer__tools button:hover { background: rgba(255, 255, 255, .06); }
.viewer__tools svg { width: 15px; height: 15px; }
.viewer__tools i { width: 1px; height: 18px; background: var(--border-strong); }
.viewer__side { width: 340px; flex-shrink: 0; display: flex; flex-direction: column; gap: 16px; padding: 22px; overflow: auto; border-left: 1px solid var(--border); background: var(--bg-elev); }
.viewer__side h3 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 15px; color: var(--text-strong); }
.viewer__side h3 svg { width: 16px; height: 16px; }
.kv--plain div { border-top: 0; padding: 6px 0; }
.kv--plain dd { font-family: var(--font); }
.who { display: flex; align-items: center; gap: 10px; }
.who > svg { width: 28px; height: 28px; padding: 7px; border-radius: 50%; background: var(--surface-2); color: var(--text-muted); }
.who b { display: block; color: var(--text-strong); font-weight: 500; }
.who small { display: block; font-size: 11px; color: var(--text-muted); }
.row-btns { display: flex; gap: 8px; margin-top: 12px; }
#pv-sharing { display: flex; flex-direction: column; gap: 12px; }

/* Codice: progetti */
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.pcard { display: flex; flex-direction: column; gap: 14px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
.pcard[data-project] { cursor: pointer; transition: border-color var(--ease); }
.pcard[data-project]:hover { border-color: var(--border-strong); }
.pcard:hover { border-color: rgba(139, 92, 246, .45); }
.pcard__top { display: flex; align-items: flex-start; gap: 12px; }
.pcard__top > div { flex: 1; min-width: 0; }
.pcard__top b { display: block; font-size: 14px; color: var(--text-strong); font-weight: 500; }
.pcard__top small { display: block; font-size: 12px; color: var(--text-muted); }
.ficon--code-x { color: var(--text-muted); }
.pcard__foot { display: flex; align-items: center; gap: 16px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 11px; color: var(--text-subtle); }
.pcard__foot span { display: inline-flex; align-items: center; gap: 5px; }
.pcard__foot span svg { width: 12px; height: 12px; }
.pcard__foot .btn { margin-left: auto; }
.pcard--new { align-items: center; justify-content: center; min-height: 160px; border-style: dashed; background: transparent; color: var(--text-muted); cursor: pointer; }
.pcard--new b { color: var(--text-strong); }
.round { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: rgba(139, 92, 246, .16); color: var(--violet-soft); }
.round svg { width: 16px; height: 16px; }
.libs { display: flex; flex-direction: column; gap: 12px; }
.libs__title { display: flex; align-items: center; gap: 8px; margin: 0; }
.libs__title svg { width: 15px; height: 15px; }
.libs__title b { color: var(--text-strong); }

/* Nuovo progetto */
.choices, .templates { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice { position: relative; display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--bg-elev); cursor: pointer; }
.choice input, .tpl input { position: absolute; opacity: 0; }
.choice b, .tpl b { display: block; color: var(--text-strong); }
.choice small, .tpl small { display: block; font-size: 11px; color: var(--text-muted); }
.choice > span:nth-of-type(2) { flex: 1; }
.radio { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--text-subtle); }
.choice:has(input:checked) { border-color: #3b82f6; background: rgba(59, 130, 246, .08); }
.choice:has(input:checked) .radio { border: 4px solid #3b82f6; background: #fff; }
.tpl { position: relative; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--bg-elev); cursor: pointer; }
.tpl:has(input:checked) { border-color: var(--violet); background: rgba(139, 92, 246, .12); }
.choice:has(input:focus-visible), .tpl:has(input:focus-visible) { outline: 2px solid var(--violet-soft); outline-offset: 2px; }

/* Editor */
.ide { flex: 1; min-height: 560px; height: calc(100vh - 150px); display: flex; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-elev); overflow: hidden; }
.ide__side { width: 210px; flex-shrink: 0; display: flex; flex-direction: column; border-right: 1px solid var(--border); }
.ide__label { display: flex; align-items: center; justify-content: space-between; padding: 10px 10px 6px 16px; font-size: 10px; font-weight: 600; letter-spacing: .08em; color: var(--text-subtle); }
.tree { flex: 1; overflow: auto; padding: 0 8px; }
.tree__row { display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 4px 0 calc(8px + var(--d) * 14px); border-radius: 6px; font-family: var(--mono); font-size: 12.5px; color: var(--text); cursor: pointer; }
.tree__row svg { width: 14px; height: 14px; color: var(--text-muted); }
.tree__row[data-type="file"] svg:first-child { color: #fdba74; }
.tree__row > span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree__row:hover { background: rgba(255, 255, 255, .03); }
.tree__row.is-active { background: rgba(139, 92, 246, .16); color: var(--text-strong); }
.tree__row .icon-btn { width: 22px; height: 22px; opacity: 0; }
.tree__row:hover .icon-btn { opacity: 1; }
.tree__empty { padding: 8px; }
.mod { font-style: normal; font-size: 10px; font-weight: 700; color: var(--warn); }
.sandbox { margin: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); font-size: 11px; color: var(--text-muted); }
.sandbox p { margin: 0; }
.sandbox code { font-family: var(--mono); color: var(--cyan-soft); margin-right: 4px; }
.ide__main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tabs { display: flex; min-height: 40px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab { display: flex; align-items: center; gap: 8px; padding: 0 12px 0 14px; border: 0; border-right: 1px solid var(--border); border-top: 2px solid transparent; background: none; color: var(--text-muted); font-family: var(--mono); font-size: 12.5px; cursor: pointer; white-space: nowrap; }
.tab svg { width: 13px; height: 13px; color: #fdba74; }
.tab.is-active { color: var(--text-strong); background: var(--bg-deep); border-top-color: var(--violet); }
.tab .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--warn); }
.tab__x { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 4px; }
.tab__x svg { width: 11px; height: 11px; color: var(--text-muted); }
.tab__x:hover { background: rgba(255, 255, 255, .08); }
.editor { flex: 1; min-height: 0; display: flex; background: var(--bg-deep); }
.editor[hidden] { display: none; }
.editor__monaco { flex: 1; min-width: 0; min-height: 0; }
#out, .viewer__text, .snip, .stdin input { font-variant-ligatures: none; }
/* Monaco: menu suggerimenti e finestre con gli stessi angoli del sito */
.monaco-editor .suggest-widget, .monaco-editor .monaco-hover, .monaco-editor .parameter-hints-widget { border-radius: 8px; overflow: hidden; }
.monaco-editor .find-widget { border-radius: 0 0 8px 8px; }
.editor-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--text-subtle); background: var(--bg-deep); }
.editor-empty svg { width: 26px; height: 26px; }
.console { height: 300px; flex-shrink: 0; display: flex; flex-direction: column; border-top: 1px solid var(--border); background: var(--bg-elev); }
.console__bar { display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 16px; border-bottom: 1px solid var(--border); }
.console__bar > svg { width: 14px; height: 14px; }
.console__bar > b { color: var(--text-strong); }
.args { margin-left: auto; display: flex; align-items: center; gap: 6px; height: 28px; padding: 0 8px; border: 1px solid var(--border-strong); border-radius: 7px; font-size: 11px; color: var(--text-subtle); }
.args input { width: 140px; border: 0; outline: none; background: none; color: var(--text-strong); font-size: 12px; }
.console__screen { flex: 1; min-height: 0; overflow: auto; padding: 10px 16px; background: var(--bg-deep); }
#out { margin: 0; font-family: var(--mono); font-size: 12.5px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; color: var(--text); }
.o-cmd, .o-dim { color: var(--text-subtle); }
.o-ok { color: var(--ok-text); }
.o-err { color: var(--err-text); }
.o-warn { color: var(--warn-text); }
.stdin { display: flex; align-items: center; gap: 8px; margin: 8px 12px; padding: 0 12px; height: 34px; border: 1px solid rgba(139, 92, 246, .45); border-radius: 8px; background: var(--bg-deep); }
.stdin svg { width: 12px; height: 12px; color: var(--text-subtle); }
.stdin input { flex: 1; border: 0; outline: none; background: none; color: var(--text-strong); font-family: var(--mono); font-size: 12.5px; }
.stdin:has(input:disabled) { opacity: .5; border-color: var(--border-strong); }
.ide__status { display: flex; align-items: center; gap: 18px; padding: 7px 16px; border-top: 1px solid var(--border); font-size: 11px; color: var(--text-subtle); white-space: nowrap; overflow: hidden; }
.ide__status span { display: inline-flex; align-items: center; gap: 6px; }
.ide__status svg { width: 12px; height: 12px; }
.ide__right { margin-left: auto; }
#save.is-dirty { color: var(--warn-text); border-color: rgba(245, 158, 11, .4); }

@media (max-width: 1100px) {
  .viewer__side { display: none; }
  .ide__side { width: 170px; }
  .selbar { left: 50%; }
}
@media (max-width: 760px) {
  .space { display: none; }
  .btn--upload { margin-bottom: 8px; }
  .nav__label { display: none; }
  .choices, .templates { grid-template-columns: 1fr; }
  .ide { flex-direction: column; height: auto; }
  .ide__side { width: auto; max-height: 200px; }
  .viewer__stage { padding: 20px 12px 70px; }
  .viewer__nav { display: none; }
}
.person b small, .found b small { display: inline; font-size: 11px; }
.lock-card > a.btn:last-child { font-size: 13px; color: var(--text); }

/* ========== Pagina pubblica dei link (/s/<token>) ========== */
body.pub { display: flex; flex-direction: column; min-height: 100vh; }
.pub__head { position: relative; z-index: 1; padding: 24px 28px; }
.pub__head .brand { padding: 0; }
.pub__main { position: relative; z-index: 1; flex: 1; display: grid; place-items: center; padding: 16px; }
.pub__foot { position: relative; z-index: 1; padding: 20px; text-align: center; font-size: 11px; color: var(--text-faint); }
.pub-card { display: flex; flex-direction: column; gap: 16px; padding: 28px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); }
.pub-card h1 { margin: 0 0 4px; font-size: 18px; font-weight: 600; color: var(--text-strong); }
.pub-card p { margin: 0; color: var(--text-muted); font-size: 12px; }
.pub-card .note { font-size: 11px; justify-content: center; }
.pub-card--center { width: min(400px, 100%); align-items: center; text-align: center; }
.pub-card--wide { width: min(600px, 100%); }
.pub-name { word-break: break-word; }
.ficon--pub { width: 64px; height: 64px; border-radius: 16px; }
.ficon--pub svg { width: 30px; height: 30px; }
.ficon--lg { width: 42px; height: 42px; border-radius: 11px; }
.ficon--lg svg { width: 20px; height: 20px; }
.btn--tall { height: 44px; font-size: 14px; }
.pub-field { width: 100%; text-align: left; }
.pub-field .input-wrap .input { padding-right: 44px; }
.pub-field .with-icon { color: var(--err-text); }
.pub-dir { display: flex; align-items: center; gap: 12px; }
.pub-dir > div { flex: 1; min-width: 0; }
.pub-dir h1 { font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pub-card--wide .crumbs { margin: 0; }
.pub-card--wide .crumbs span { color: var(--text); }
.pub-list { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-elev); max-height: 52vh; overflow: auto; }
.pub-row { display: flex; align-items: center; gap: 12px; padding: 8px 10px 8px 14px; border-top: 1px solid var(--border); }
.pub-row:first-child { border-top: 0; }
.pub-row .ficon { width: 28px; height: 28px; }
.pub-row__name { flex: 1; min-width: 0; color: var(--text-strong); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.pub-row__name:hover { text-decoration: underline; text-decoration-color: var(--text-faint); }
.pub-row .mono { font-size: 11px; }
.pub-row .icon-btn--box { width: 30px; height: 30px; }
.pub-empty { padding: 20px; text-align: center; }
@media (max-width: 560px) {
  .pub-dir { flex-wrap: wrap; }
  .pub-dir .btn { width: 100%; }
}
.dropzone div { background: var(--surface); box-shadow: 0 20px 50px rgba(0, 0, 0, .5); }
@media (max-width: 760px) {
  .head { flex-wrap: wrap; }
  .head__right { flex-wrap: wrap; }
  .table--files:not(.table--in) th:nth-child(3), .table--files:not(.table--in) td:nth-child(3), .table--files:not(.table--in) th:nth-child(5), .table--files:not(.table--in) td:nth-child(5) { display: none; }
  .table--files.table--in th:nth-child(4), .table--files.table--in td:nth-child(4) { display: none; }
  .row-acts .icon-btn:not(.icon-btn--more) { display: none; }
  .selbar { left: 12px; right: 12px; transform: none; flex-wrap: wrap; justify-content: center; }
  .toolbar .seg--right { margin-left: 0; }
  .console { height: 340px; }
  .viewer__bar .btn span, .viewer__bar .btn { font-size: 12px; }
}
