/* Network Today Portal — sfondo e sfera viola; testi, card, bottoni e campi
   ripresi dal Documentale (doc.network.today, resources/css/app.css). */
:root {
  /* Sfondo del portale */
  --bg: #07061a;
  --bg-2: #0c0a22;

  /* Token del Documentale */
  --aura-blue: #3b82f6;
  --aura-blue-light: #60a5fa;
  --aura-surface-1: rgba(30, 44, 78, 0.42);
  --aura-surface-2: rgba(36, 52, 90, 0.50);
  --aura-border: rgba(120, 160, 230, 0.14);
  --aura-border-blue: rgba(59, 130, 246, 0.35);
  --aura-sheen: linear-gradient(180deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.012) 45%, rgba(255,255,255,0) 100%);
  --aura-lift: 0 12px 40px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255,255,255,0.07);
  --aura-shadow: rgba(59, 130, 246, 0.22) 0px 0px 10px 0px;
  --aura-shadow-hover: rgba(59, 130, 246, 0.65) 0px 0px 18px 2px;
  --orange: #e8841a;
  --orange-light: #f5a84b;
  --orange-dark: #c96d0f;
  --orange-glow: rgba(232, 132, 26, 0.45);
  --text-primary: #ffffff;
  --text-secondary: #a6b4c8;
  --text-muted: #5c6b82;
  --text-label: rgba(148, 163, 184, 0.6);
  --surface-modal: rgba(8, 15, 32, 0.97);
  --surface-popover: rgba(6, 12, 26, 0.97);
  --surface-field: rgba(255, 255, 255, 0.045);
  --overlay: rgba(2, 4, 10, 0.72);
  --r-sm: 7px;
  --r-md: 8px;
  --r-lg: 11px;
  --r-xl: 12px;
  --blur-md: 20px;
  --dur-fast: 150ms;
  --dur-base: 300ms;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --danger: #f87171;
  /* Stesso stack del Documentale: Plus Jakarta Sans se installato, altrimenti il font di sistema */
  --font: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: var(--text-primary); }
kbd {
  font-family: inherit;
  font-size: 10px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 5px;
  border: 1px solid var(--aura-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
}
:focus-visible { outline: 2px solid var(--aura-blue-light); outline-offset: 2px; }
::selection { background: rgba(59, 130, 246, 0.4); color: #fff; }

/* ── Sfondo ─────────────────────────────────────────── */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background:
    radial-gradient(ellipse 70% 50% at 50% 0%, rgba(91, 72, 200, 0.28), transparent 70%),
    radial-gradient(ellipse 60% 40% at 50% 110%, rgba(91, 72, 200, 0.16), transparent 70%),
    linear-gradient(var(--bg-2), var(--bg));
}
.beam {
  position: absolute;
  top: -15%;
  width: 22vw;
  height: 85vh;
  background: linear-gradient(to bottom, rgba(124, 93, 250, 0.42), rgba(124, 93, 250, 0.08) 70%, transparent);
  filter: blur(48px);
  opacity: 0.7;
}
.beam-l { left: 6vw; transform: rotate(14deg); }
.beam-r { right: 6vw; transform: rotate(-14deg); }
.floor {
  position: absolute;
  left: -60%;
  right: -60%;
  top: 0;
  bottom: 0;
  background-image:
    linear-gradient(rgba(139, 124, 246, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(139, 124, 246, 0.035) 1px, transparent 1px);
  background-size: 140px 140px;
  background-position: center;
  transform: perspective(700px) rotateX(58deg) scale(1.6);
  transform-origin: 50% 40%;
  mask-image: radial-gradient(ellipse 45% 55% at 50% 45%, #000 10%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 45% 55% at 50% 45%, #000 10%, transparent 70%);
}
.stars { position: absolute; inset: 0; }
.stars span.big { box-shadow: 0 0 6px 1px rgba(207, 200, 255, 0.55); }
.shooting {
  position: absolute;
  width: 140px;
  height: 1.5px;
  border-radius: 9999px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(220, 215, 255, 0.9));
  transform-origin: 0 50%;
  opacity: 0;
  filter: drop-shadow(0 0 4px rgba(180, 170, 255, 0.8));
}
/* Nebulose generate (orb.js): ingrandite e sfocate, si spostano piano */
.nebula-canvas {
  position: absolute;
  left: -6%; top: -6%;
  width: 112%; height: 112%;
  filter: blur(24px) saturate(1.2);
  opacity: 0.72;
  animation: drift 90s ease-in-out infinite alternate;
}
@keyframes drift { to { transform: translate(2vw, -1.5vh) scale(1.05); } }
.stars span { position: absolute; border-radius: 9999px; background: #cfc8ff; }

#app, #login, .overlay, .toast { position: relative; z-index: 1; }

/* Superficie vetro del Documentale (.card / .glass) */
.glass {
  background: var(--aura-surface-1);
  background-image: var(--aura-sheen);
  backdrop-filter: blur(var(--blur-md)) saturate(160%) brightness(1.08);
  -webkit-backdrop-filter: blur(var(--blur-md)) saturate(160%) brightness(1.08);
  border: 1px solid var(--aura-border);
  box-shadow: var(--aura-lift);
}

/* ── Marchio e navigazione ─────────────────────────── */
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text-primary); font-size: 15px; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; }
.brand img { width: 26px; height: 26px; border-radius: var(--r-sm); }
.brand em { font-style: normal; color: var(--orange); font-weight: 600; }
.brand-lg { font-size: 18px; }
.brand-lg img { width: 32px; height: 32px; }

.nav {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 32px;
  background: rgba(7, 6, 26, 0.78);
  backdrop-filter: blur(var(--blur-md));
  -webkit-backdrop-filter: blur(var(--blur-md));
  border-bottom: 1px solid var(--aura-border);
}
.nav-links { display: flex; gap: 6px; margin: 0 auto; }
.nav-links a {
  padding: 7px 14px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.nav-links a:hover { color: var(--text-primary); background: rgba(96, 165, 250, 0.07); }
.nav-links a.active {
  color: #fff;
  background: linear-gradient(180deg, rgba(59,130,246,0.16) 0%, rgba(59,130,246,0.05) 100%);
  box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.25);
}
.nav-actions { display: flex; align-items: center; gap: 10px; }
.btn-link { color: var(--text-muted); font-size: 13px; font-weight: 500; padding: 7px 10px; border-radius: var(--r-md); transition: color var(--dur-fast), background var(--dur-fast); }
.btn-link:hover { color: var(--text-primary); background: rgba(59, 130, 246, 0.06); }

/* Come la ricerca nella sidebar del Documentale */
.search-mini {
  display: inline-flex; align-items: center; gap: 24px;
  padding: 7px 8px 7px 12px;
  border-radius: var(--r-md);
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--aura-border);
  color: var(--text-muted);
  font-size: 13px;
  transition: border-color var(--dur-fast), color var(--dur-fast);
}
.search-mini:hover { border-color: var(--aura-border-blue); color: var(--text-secondary); }

/* ── Bottoni (identici al Documentale) ─────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 8px 16px;
  border-radius: var(--r-md);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: box-shadow var(--dur-base) var(--ease), transform var(--dur-fast) var(--ease), filter var(--dur-base) var(--ease), background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast);
}
.btn:active { transform: translateY(0); }
.btn-primary { color: #f1f5f9; background: linear-gradient(135deg, var(--orange) 0%, var(--orange-dark) 100%); box-shadow: 0 1px 4px rgba(0,0,0,0.3); }
.btn-primary:hover { box-shadow: 0 0 0 1px rgba(232,132,26,0.5), 0 0 20px var(--orange-glow), 0 4px 16px rgba(0,0,0,0.4); transform: translateY(-1px); filter: brightness(1.08); }
.btn-ghost { font-weight: 400; color: var(--text-secondary); background: rgba(15,23,42,0.6); border: 1px solid var(--aura-border); padding: 7px 14px; }
.btn-ghost:hover { background: rgba(15,23,42,0.85); border-color: var(--aura-border-blue); color: var(--text-primary); transform: translateY(-1px); }
.btn-danger { color: #fff; background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%); box-shadow: 0 1px 4px rgba(0,0,0,0.3); }
.btn-danger:hover { box-shadow: 0 0 0 1px rgba(239,68,68,0.5), 0 0 20px rgba(239,68,68,0.35), 0 4px 16px rgba(0,0,0,0.4); transform: translateY(-1px); filter: brightness(1.1); }
.btn-sm { font-size: 13px; }
.arrow { font-size: 1em; }

/* ── Sfera ─────────────────────────────────────────── */
/* --orb = diametro della sfera; il canvas è 2.4 volte più grande per l'alone */
.orb-wrap {
  position: relative;
  width: var(--orb, 22rem);
  aspect-ratio: 1;
  flex: none;
  animation: float 9s ease-in-out infinite;
}
@keyframes float { 50% { transform: translateY(-10px); } }
.orb-canvas {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 240%;
  height: 240%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.orb-fallback {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, #b8adff 0%, #6a5cf0 35%, #3a2fb4 70%, #241a7a 100%);
  box-shadow:
    0 0 90px rgba(124, 93, 250, 0.7),
    0 0 260px rgba(124, 93, 250, 0.4),
    inset 0 0 18px rgba(240, 236, 255, 0.85);
  animation: breathe 6s ease-in-out infinite;
}
.orb-wrap.has-gl .orb-fallback { display: none; }
@keyframes breathe { 50% { transform: scale(1.012); filter: brightness(1.08); } }

/* ── Home: collana ─────────────────────────────────── */
.necklace {
  position: relative;
  height: calc(100dvh - 61px);
  min-height: 600px;
  overflow: hidden;
}
.is-home .foot { display: none; }
.necklace .orb-wrap { position: absolute; }
.necklace .orb-wrap { z-index: 10; }
.necklace.dragging { cursor: grabbing; user-select: none; }
.ring { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.ring-back { z-index: 1; }
.ring-front { z-index: 15; }
.beads { position: absolute; inset: 0; }
.bead {
  position: absolute;
  width: var(--size, 56px);
  height: var(--size, 56px);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  will-change: transform, left, top;
  cursor: pointer;
  -webkit-user-drag: none;
}
.bead.back .bead-ball { filter: saturate(0.6) brightness(0.75); }
.bead:focus-visible { outline: none; }
.bead:focus-visible .bead-ball { box-shadow: 0 0 0 2px var(--aura-blue-light), 0 0 24px rgba(96, 165, 250, 0.6); }
/* Perla: vetro scuro lucido con riflesso */
.bead-ball {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 120%, rgba(124, 93, 250, 0.55) 0%, transparent 55%),
    radial-gradient(circle at 50% 45%, #29236e 0%, #17134a 55%, #0b0922 100%);
  box-shadow:
    inset 0 -6px 14px rgba(0, 0, 0, 0.55),
    inset 0 1px 3px rgba(255, 255, 255, 0.25),
    0 0 0 1px rgba(207, 200, 255, 0.20),
    0 8px 22px rgba(0, 0, 0, 0.55),
    0 0 26px rgba(124, 93, 250, 0.22);
  color: #e9e6ff;
  font-weight: 600;
  font-size: calc(var(--size, 56px) * 0.3);
  letter-spacing: -0.02em;
  transition: box-shadow var(--dur-base) var(--ease);
}
.bead-ball::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(ellipse 42% 30% at 34% 24%, rgba(255, 255, 255, 0.55) 0%, rgba(255, 255, 255, 0.08) 60%, transparent 100%);
  pointer-events: none;
}
.bead-ball .logo { width: 58%; height: 58%; object-fit: contain; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4)); }
.bead.hot .bead-ball {
  box-shadow:
    inset 0 -6px 14px rgba(0, 0, 0, 0.5),
    inset 0 1px 3px rgba(255, 255, 255, 0.3),
    0 0 0 1px rgba(207, 200, 255, 0.45),
    0 10px 26px rgba(0, 0, 0, 0.55),
    0 0 36px rgba(124, 93, 250, 0.6);
}
.bead-name { display: none; }

/* Nome sotto la perla puntata */
.bead-label {
  position: absolute;
  z-index: 50;
  display: grid;
  justify-items: center;
  gap: 1px;
  padding: 6px 12px;
  border-radius: var(--r-md);
  background: var(--surface-popover);
  border: 1px solid var(--aura-border);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -4px);
  transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.bead-label.on { opacity: 1; transform: translate(-50%, 0); }
.bead-label b { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.bead-label span { font-size: 11px; color: var(--text-secondary); }

.necklace-search {
  position: absolute;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 10px;
  padding: 9px 10px 9px 14px;
  border-radius: var(--r-md);
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--aura-border);
  backdrop-filter: blur(var(--blur-md));
  -webkit-backdrop-filter: blur(var(--blur-md));
  color: var(--text-muted);
  font-size: 13px;
  transition: border-color var(--dur-fast), color var(--dur-fast);
}
.necklace-search:hover { border-color: var(--aura-border-blue); color: var(--text-secondary); }
.necklace-search svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

/* Schermi stretti: la luna in alto e le perle in griglia, col nome visibile */
.necklace.compact { height: auto; min-height: calc(100dvh - 100px); overflow: visible; }
.necklace.compact .ring { display: none; }
.necklace.compact .beads {
  position: relative;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 20px 8px;
  padding: calc(var(--orb-d, 260px) + 64px) 16px 96px;
}
.necklace.compact .bead {
  position: relative;
  width: auto; height: auto;
  transform: none !important;
  opacity: 1 !important;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  border-radius: 0;
}
.necklace.compact .bead-ball { position: relative; width: 56px; height: 56px; font-size: 16px; }
.necklace.compact .bead-name { display: block; font-size: 11px; line-height: 1.3; color: var(--text-secondary); text-align: center; }
.necklace.compact .bead-label { display: none; }

/* ── Sezioni ───────────────────────────────────────── */
.section { max-width: 1240px; margin: 0 auto; padding: 32px 40px 48px; }
.section-head { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 24px; }
.section-head h2 { margin: 0; font-size: 28px; font-weight: 500; letter-spacing: -0.01em; color: var(--text-primary); line-height: 1.2; }
.section-head p { margin: 4px 0 0; font-size: 13px; font-weight: 300; }
.section-head .spacer { flex: 1; }
/* Etichette piccole maiuscole, come le sezioni della sidebar e le KPI */
.eyebrow { font-size: 10px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--orange); margin-bottom: 6px; line-height: 1.4; }
.cat-title { margin: 32px 0 12px; font-size: 10px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-label); display: flex; align-items: center; gap: 12px; line-height: 1.4; }
.cat-title::after { content: ''; flex: 1; height: 1px; background: var(--aura-border); }
.cat-title:first-of-type { margin-top: 4px; }
.muted { color: var(--text-secondary); }

/* ── Card (.card del Documentale) ──────────────────── */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.card {
  position: relative;
  display: flex; align-items: center; gap: 14px;
  padding: 16px 18px;
  border-radius: var(--r-lg);
  background: var(--aura-surface-1);
  background-image: var(--aura-sheen);
  backdrop-filter: blur(var(--blur-md)) saturate(160%) brightness(1.08);
  -webkit-backdrop-filter: blur(var(--blur-md)) saturate(160%) brightness(1.08);
  border: 1px solid var(--aura-border);
  box-shadow: var(--aura-lift);
  transition: border-color var(--dur-base) var(--ease), box-shadow var(--dur-base) var(--ease), transform var(--dur-base) var(--ease);
  min-width: 0;
}
a.card:hover { border-color: var(--aura-border-blue); box-shadow: var(--aura-shadow); transform: translateY(-1px); }
/* Icona: tessera blu come .badge-blue */
.mono {
  flex: none;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: var(--r-md);
  background: rgba(59, 130, 246, 0.14);
  border: 1px solid rgba(59, 130, 246, 0.25);
  color: #93c5fd;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: -0.01em;
  transition: box-shadow var(--dur-fast), color var(--dur-fast), border-color var(--dur-fast);
}
.mono.has-logo { background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.10); }
.mono .logo { width: 62%; height: 62%; object-fit: contain; }
a.card:hover .mono { color: #fff; border-color: rgba(96, 165, 250, 0.5); box-shadow: 0 0 12px rgba(59, 130, 246, 0.35); }
.card-text { min-width: 0; flex: 1; display: grid; gap: 1px; }
.card-title { color: var(--text-primary); font-size: 14px; font-weight: 600; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-sub { font-size: 12px; line-height: 1.4; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .go { color: var(--text-muted); transition: color var(--dur-fast), transform var(--dur-fast), opacity var(--dur-fast); }
a.card:hover .go { color: var(--aura-blue-light); transform: translate(1px, -1px); }
.card-wrap { position: relative; }
.card-wrap > .card { height: 100%; }
.card-wrap .edit {
  position: absolute; top: 50%; right: 12px;
  width: 32px; height: 32px; border-radius: var(--r-sm);
  display: grid; place-items: center;
  transform: translateY(-50%);
  color: #64748b;
  opacity: 0;
  transition: opacity var(--dur-fast), color var(--dur-fast), background var(--dur-fast);
}
.card-wrap:hover .go { opacity: 0; }
.card-wrap:hover .edit, .card-wrap .edit:focus-visible { opacity: 1; }
.card-wrap .edit:hover { color: #94a3b8; background: rgba(255, 255, 255, 0.06); }
.card-wrap .edit svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Servizio senza link per il cliente */
.card.empty { background: rgba(15, 23, 42, 0.35); background-image: none; border-style: dashed; box-shadow: none; }
.card.empty .mono { background: rgba(255, 255, 255, 0.04); border-color: rgba(255, 255, 255, 0.09); color: #94a3b8; }
.card.empty .card-title { color: var(--text-secondary); font-weight: 500; }
.card.empty .card-sub { color: var(--text-muted); }
/* .badge-green del Documentale */
.card .badge {
  justify-self: start;
  display: inline-flex; align-items: center; gap: 5px;
  margin-top: 3px;
  padding: 1px 8px;
  border-radius: 9999px;
  font-size: 11px; font-weight: 500;
  background: rgba(34, 197, 94, 0.12); color: #4ade80; border: 1px solid rgba(34, 197, 94, 0.20);
}
.card-actions { display: flex; gap: 4px; flex: none; }
/* .btn-icon del Documentale */
.mini {
  display: grid; place-items: center;
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  font-size: 15px; font-weight: 500;
  color: #60a5fa;
  transition: background var(--dur-fast), color var(--dur-fast);
}
.mini:hover { background: rgba(59, 130, 246, 0.12); color: #93c5fd; }

/* ── Clienti ───────────────────────────────────────── */
.filter {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  border-radius: var(--r-md);
  background: var(--surface-field);
  border: 1px solid var(--aura-border);
  width: min(300px, 100%);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast), background var(--dur-fast);
}
.filter:focus-within { border-color: rgba(59,130,246,0.45); box-shadow: 0 0 0 3px rgba(59,130,246,0.12); background: rgba(255,255,255,0.06); }
.filter svg { width: 15px; height: 15px; fill: none; stroke: var(--text-muted); stroke-width: 1.8; stroke-linecap: round; flex: none; }
.filter input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; font-size: 14px; }
.filter input::placeholder { color: var(--text-muted); }
.client-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.client-card { padding: 14px 16px; }
.client-card .mono { width: 36px; height: 36px; font-size: 12px; }
.dots { display: flex; gap: 4px; margin-top: 5px; }
.dots i { width: 6px; height: 6px; border-radius: 9999px; background: rgba(255, 255, 255, 0.10); }
.dots i.on { background: var(--aura-blue-light); box-shadow: 0 0 6px rgba(96, 165, 250, 0.6); }

.client-head { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-bottom: 28px; }
.client-head .mono { width: 60px; height: 60px; border-radius: var(--r-lg); font-size: 20px; }
.client-head h1 { margin: 0; font-size: 28px; font-weight: 500; letter-spacing: -0.01em; line-height: 1.2; color: var(--text-primary); }
.client-head .spacer { flex: 1; }
.back { display: inline-flex; gap: 6px; align-items: center; margin-bottom: 20px; color: var(--text-muted); font-size: 13px; font-weight: 500; transition: color var(--dur-fast); }
.back:hover { color: var(--text-primary); }
.notes { margin-top: 28px; padding: 20px; border-radius: var(--r-lg); white-space: pre-wrap; color: var(--text-secondary); }
.notes h3 { margin: 0 0 8px; font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-label); font-weight: 600; }

.empty-state { padding: 48px 24px; text-align: center; border-radius: var(--r-lg); border: 1px dashed var(--aura-border); }

/* ── Ricerca rapida (popover del Documentale) ─────── */
.overlay {
  position: fixed; inset: 0; z-index: 20;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 12vh 16px 16px;
  background: var(--overlay);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fade 150ms var(--ease);
}
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } }
.palette {
  width: min(620px, 100%);
  border-radius: var(--r-xl);
  overflow: hidden;
  background: var(--surface-popover);
  border: 1px solid var(--aura-border);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255,255,255,0.06);
  animation: rise 150ms var(--ease);
}
.palette-input { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--aura-border); }
.palette-input svg { width: 18px; height: 18px; fill: none; stroke: var(--text-muted); stroke-width: 1.8; stroke-linecap: round; flex: none; }
.palette-input input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; font-size: 15px; }
.palette-input input::placeholder { color: var(--text-muted); }
.palette-list { list-style: none; margin: 0; padding: 6px; max-height: min(420px, 55vh); overflow-y: auto; }
.palette-list li {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 10px;
  border-radius: var(--r-md);
  cursor: pointer;
}
.palette-list li.sel { background: linear-gradient(180deg, rgba(59,130,246,0.14) 0%, rgba(59,130,246,0.05) 100%); box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.22); }
.palette-list li.sel .p-title { color: #fff; }
.palette-list .mono { width: 32px; height: 32px; font-size: 11px; border-radius: var(--r-sm); }
.palette-list li.combo .mono { background: rgba(232, 132, 26, 0.14); border-color: rgba(232, 132, 26, 0.22); color: var(--orange-light); }
.p-text { flex: 1; min-width: 0; display: grid; }
.p-title { color: var(--text-secondary); font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-title b { color: var(--text-primary); font-weight: 600; }
.p-title .sep { color: var(--orange); margin: 0 6px; }
.p-sub { font-size: 12px; line-height: 1.4; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-kind { font-size: 10px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); flex: none; }
.palette-list .none { justify-content: center; color: var(--text-muted); cursor: default; padding: 24px; }
.palette-hint { display: flex; gap: 16px; padding: 8px 16px; border-top: 1px solid var(--aura-border); font-size: 11px; color: var(--text-muted); }
.palette-hint kbd { margin-right: 4px; }

/* ── Finestra di modifica (modale del Documentale) ─── */
.modal {
  width: min(600px, 100%);
  max-height: 80vh;
  display: flex; flex-direction: column;
  border-radius: var(--r-xl);
  background: var(--surface-modal);
  border: 1px solid var(--aura-border);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255,255,255,0.06);
  animation: rise 150ms var(--ease);
}
.modal-head { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--aura-border); }
.modal-head h2 { margin: 0; flex: 1; font-size: 17px; font-weight: 600; color: var(--text-primary); }
.icon-btn { width: 32px; height: 32px; border-radius: var(--r-sm); color: #64748b; transition: background var(--dur-fast), color var(--dur-fast); }
.icon-btn:hover { background: rgba(255, 255, 255, 0.06); color: #94a3b8; }
.modal-body { padding: 20px; overflow-y: auto; display: grid; gap: 14px; }
.modal .error { padding: 0 20px 4px; }
.modal-foot { display: flex; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--aura-border); }
.spacer { flex: 1; }
/* .nt-label / .nt-input */
.field { display: grid; gap: 6px; }
.field > span { font-size: 12px; font-weight: 500; letter-spacing: 0.04em; color: var(--text-secondary); }
.field small { font-size: 12px; color: var(--text-muted); }
.field input, .field textarea, .field select {
  width: 100%;
  padding: 9px 14px;
  border-radius: var(--r-md);
  background: var(--surface-field);
  border: 1px solid var(--aura-border);
  outline: 0;
  font-size: 14px;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast), background var(--dur-fast);
}
.field textarea { min-height: 90px; resize: vertical; }
.field select option { background: #0d1929; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: rgba(59,130,246,0.45); box-shadow: 0 0 0 3px rgba(59,130,246,0.12); background: rgba(255,255,255,0.06); }
.field input::placeholder, .field textarea::placeholder { color: var(--text-muted); }
.field-group { display: grid; gap: 12px; }
.field-group h3 { margin: 6px 0 0; font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; font-weight: 600; color: var(--text-label); }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-secondary); }
.check input { accent-color: var(--aura-blue); width: 16px; height: 16px; }
.error { color: var(--danger); font-size: 13px; margin: 0; }
.error:empty { display: none; }

/* ── Accesso ──────────────────────────────────────── */
.login { --orb: min(32rem, 86vw, 56vh); overflow: clip; min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px 16px; }
.rocket-idle { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
/* Nel login lo spazio è più buio: la luna ancora non c'è */
.nebula-canvas, .beam { transition: opacity 1.2s var(--ease); }
body.on-login .backdrop { background: #030209; }
body.on-login .nebula-canvas { opacity: 0.06; }
body.on-login .beam,
body.on-login .floor { opacity: 0; }
.floor { transition: opacity 1.2s var(--ease); }
#login-form { transition: opacity 0.5s var(--ease), transform 0.5s var(--ease); }
#login-form.leaving { opacity: 0; transform: translateY(10px) scale(0.98); }
.login-card { z-index: 1; position: relative; width: min(380px, 100%); padding: 28px; border-radius: var(--r-xl); display: grid; gap: 16px; background: var(--surface-modal); }
.login-card .muted { margin: -8px 0 4px; font-size: 13px; font-weight: 300; }
.login-card .btn { width: 100%; margin-top: 4px; padding: 10px 16px; }

/* ── Intro dopo il login ──────────────────────────── */
.intro { position: fixed; inset: 0; z-index: 200; cursor: pointer; transition: opacity 600ms var(--ease); }
.intro.leaving { opacity: 0; }
.intro > canvas { position: absolute; inset: 0; display: block; }
.intro-moon { position: absolute; animation: none; transform-origin: 50% 50%; will-change: transform; }
.intro-skip { position: absolute; right: 24px; bottom: 20px; font-size: 12px; color: rgba(255, 255, 255, 0.3); pointer-events: none; }
/* Mentre l'intro tiene la luna, quella della home resta nascosta (stesso posto) */
body.intro-hold #home-orb { visibility: hidden; }
/* La scena compare attorno alla luna, a strati */
body.intro-pending .nav,
body.intro-pending .necklace .ring,
body.intro-pending .beads,
body.intro-pending .necklace-search { opacity: 0; }
body.intro-reveal .nav { transition: opacity 1.4s var(--ease) 0.9s; }
body.intro-reveal .necklace .ring { transition: opacity 1.6s var(--ease) 1.1s; }
body.intro-reveal .beads { transition: opacity 1.6s var(--ease) 1.4s; }
body.intro-reveal .necklace-search { transition: opacity 1.2s var(--ease) 1.9s; }

/* ── Varie ────────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: 32px; z-index: 30;
  transform: translateX(-50%);
  padding: 9px 16px;
  border-radius: var(--r-md);
  background: var(--surface-popover);
  border: 1px solid rgba(34, 197, 94, 0.25);
  color: #4ade80;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  font-size: 13px; font-weight: 500;
  animation: rise 150ms var(--ease);
}
.foot { text-align: center; padding: 40px 16px 48px; font-size: 11px; color: var(--text-muted); }
.reveal { animation: rise 500ms var(--ease) both; }

/* ── Mobile ───────────────────────────────────────── */
@media (max-width: 860px) {
  .nav { padding: 12px 16px; gap: 10px; flex-wrap: wrap; }
  .nav-links { order: 3; width: 100%; justify-content: center; margin: 0; }
  .nav-actions { margin-left: auto; }
  .search-mini kbd, .necklace-search kbd { display: none; }
  .search-mini { gap: 8px; }
  .section { padding: 24px 16px 32px; }
  .section-head { flex-wrap: wrap; }
  .section-head h2 { font-size: 24px; }
  .filter { width: 100%; }
  .card-wrap .edit { opacity: 1; }
  .card-wrap .go { display: none; }
  .modal-foot { flex-wrap: wrap; }
  .beam { width: 40vw; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
