
/* Player Plyr in tema oro VBS */
:root { --plyr-color-main:#C9A227; --plyr-video-control-color:#fff; --plyr-range-thumb-background:#E8C84A; --plyr-video-control-background-hover:#C9A227; }
#lessonPlayerBox .plyr { position:absolute; inset:0; width:100%; height:100%; }
#lessonPlayerBox .plyr--video, #lessonPlayerBox .plyr__video-wrapper { width:100%; height:100%; }
#lessonPlayerBox .plyr video { width:100%; height:100%; object-fit:contain; }


/* === Scheda corso === */
.course-hero { position:relative; min-height:46vh; display:flex; align-items:flex-end; padding:calc(var(--nav-h,68px) + 40px) 6vw 40px; background:#141414 center/cover no-repeat; overflow:hidden; }
.course-hero::after { content:''; position:absolute; inset:0; background:linear-gradient(180deg, rgba(10,10,10,.35) 0%, rgba(10,10,10,.82) 70%, var(--bg) 100%), linear-gradient(90deg, rgba(10,10,10,.7), rgba(10,10,10,.15)); }
.course-hero-content { position:relative; z-index:1; max-width:780px; width:100%; }
.course-back { position:absolute; top:calc(var(--nav-h,68px) + 14px); left:6vw; z-index:2; display:inline-flex; align-items:center; gap:6px; color:var(--gray1); font-size:14px; background:rgba(0,0,0,.4); border:1px solid var(--border); padding:8px 14px; border-radius:30px; backdrop-filter:blur(6px); }
.course-back:hover { color:#fff; }
.course-back svg { width:16px; height:16px; }
.course-cat { display:inline-flex; align-items:center; gap:8px; color:var(--gold); font-size:12px; font-weight:700; letter-spacing:.12em; text-transform:uppercase; margin-bottom:14px; }
.course-cat::before { content:''; width:7px; height:7px; border-radius:50%; background:var(--gold); }
.course-title { font-size:clamp(28px,5vw,52px); font-weight:800; line-height:1.05; letter-spacing:-0.03em; }
.course-meta { display:flex; flex-wrap:wrap; align-items:center; gap:10px 14px; margin-top:16px; color:var(--gray2); font-size:14px; }
.course-meta .dot { width:4px; height:4px; border-radius:50%; background:var(--gray3); }
.course-badge { background:rgba(201,162,39,.16); color:var(--gold2); border:1px solid rgba(201,162,39,.3); padding:3px 10px; border-radius:5px; font-size:12px; font-weight:700; letter-spacing:.04em; }
.course-desc { margin-top:18px; color:var(--gray1); font-size:16px; line-height:1.6; max-width:680px; }
.course-actions { display:flex; flex-wrap:wrap; gap:12px; margin-top:26px; }
.course-cta { display:inline-flex; align-items:center; gap:10px; font-weight:700; font-size:15px; padding:13px 26px; border-radius:8px; transition:transform .12s, background .15s; }
.course-cta svg { width:20px; height:20px; }
.course-cta.primary { background:#fff; color:#000; }
.course-cta.primary:hover { transform:scale(1.02); background:var(--gray1); }
.course-cta.ghost { background:rgba(255,255,255,.12); color:#fff; border:1px solid var(--border); }
.course-cta.ghost:hover { background:rgba(255,255,255,.2); }
.course-modules { max-width:920px; margin:0 auto; padding:34px 6vw 90px; }
/* ── Vista corso modulare (AIPOCALYPSE NOW) ──────────────────────────────
   Colonna a larghezza fissa = home (--app-max), così la cover 16:9 si vede
   intera; moduli come card grandi come i corsi in home (griglia 3 colonne). */
.course-modular { max-width: var(--app-max); margin: 0 auto; padding: calc(var(--nav-h,68px) + 20px) var(--gutter) 90px; }
.cm-back { display:inline-flex; align-items:center; gap:6px; color:var(--gray1); font-size:14px; margin-bottom:18px; cursor:pointer; }
.cm-back:hover { color:#fff; }
.cm-back svg { width:16px; height:16px; }
.cm-hero { width:100%; aspect-ratio:16/9; max-height:76vh; border-radius:16px; overflow:hidden;
  background:#141414 center/cover no-repeat; box-shadow:0 24px 60px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.05); }
.cm-head { margin:30px 0 18px; }
.cm-h2 { font-size:22px; font-weight:800; letter-spacing:-0.01em; margin-bottom:6px; }
.cm-sub { color:var(--gray2); font-size:14px; }
.cm-grid { display:grid; grid-template-columns:repeat(3, 1fr); gap:18px; }
@media (max-width:1000px){ .cm-grid { grid-template-columns:repeat(2, 1fr); } }
@media (max-width:560px){
  .course-modular { padding-left:16px; padding-right:16px; }
  .cm-grid { grid-template-columns:1fr; }
  .cm-hero { border-radius:10px; }
}
.course-modules-title { font-size:20px; font-weight:800; letter-spacing:-0.01em; margin-bottom:6px; }
.course-modules-sub { color:var(--gray2); font-size:14px; margin-bottom:22px; }
.mod { border:1px solid var(--border); border-radius:12px; margin-bottom:12px; overflow:hidden; background:var(--bg2); }
.mod-head { display:flex; align-items:center; gap:14px; padding:18px 20px; cursor:pointer; user-select:none; }
.mod-head:hover { background:rgba(255,255,255,.03); }
.mod-idx { flex-shrink:0; width:30px; height:30px; border-radius:8px; background:var(--bg3); color:var(--gold); font-weight:800; font-size:13px; display:flex; align-items:center; justify-content:center; }
.mod-h-main { flex:1; min-width:0; }
.mod-title { font-weight:700; font-size:15.5px; letter-spacing:-0.01em; }
.mod-count { color:var(--gray2); font-size:13px; margin-top:2px; }
.mod-chevron { flex-shrink:0; color:var(--gray2); transition:transform .2s; }
.mod-chevron svg { width:18px; height:18px; display:block; }
.mod.open .mod-chevron { transform:rotate(90deg); }
.mod-body { display:none; padding:0 8px 8px; }
.mod.open .mod-body { display:block; }
.mod-lesson { display:flex; align-items:center; gap:14px; padding:12px; border-radius:8px; cursor:pointer; }
.mod-lesson:hover { background:rgba(255,255,255,.05); }
.mod-lesson-ic { flex-shrink:0; width:34px; height:34px; border-radius:8px; background:var(--bg3); display:flex; align-items:center; justify-content:center; color:var(--gray1); }
.mod-lesson-ic svg { width:15px; height:15px; }
.mod-lesson.done .mod-lesson-ic { background:rgba(70,211,105,.15); color:#46d369; }
.mod-lesson-main { flex:1; min-width:0; }
.mod-lesson-title { font-size:14.5px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.mod-lesson-dur { color:var(--gray3); font-size:12.5px; margin-top:2px; }
@media (max-width:768px){
  .course-hero { min-height:40vh; padding:calc(var(--nav-h,68px) + 30px) 20px 28px; }
  .course-back { left:16px; }
  .course-modules { padding:28px 16px 70px; }
  .course-cta { flex:1; justify-content:center; }
}


/* === Polish globale === */
:root { --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif; }
body { font-family: var(--font); font-feature-settings: 'cv02','cv03','cv04','cv11'; }
h1,h2,h3,h4 { letter-spacing: -0.02em; }
.hero-title, .lesson-ep-title, .locked-hero-title { letter-spacing: -0.03em; }
html { -webkit-text-size-adjust: 100%; }
body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; }
::selection { background: rgba(201,162,39,0.85); color: #000; }
:focus-visible { outline: 2px solid #C9A227; outline-offset: 2px; border-radius: 4px; }
button:focus:not(:focus-visible), a:focus:not(:focus-visible), input:focus:not(:focus-visible) { outline: none; }
* { scrollbar-width: thin; scrollbar-color: #333 transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: #2e2e2e; border-radius: 6px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: #3d3d3d; background-clip: content-box; }
img { max-width: 100%; }


*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --black:   #000000;
  --bg:      #0a0a0a;
  --bg2:     #141414;
  --bg3:     #1f1f1f;
  --border:  rgba(255,255,255,0.08);
  --gold:    #C9A227;
  --gold2:   #E8C84A;
  /* Tokens "milestone" — usati nelle card di admin/tools/profilo/ordini */
  --m-card:   rgba(22,22,24,0.85);
  --m-gold:   #DCC88D;
  --m-gold-l: #e5d6a8;
  --m-gold-d: #B8A46E;
  --m-line:   rgba(220,200,141,0.18);
  --m-ink:    #E8E6E1;
  --m-muted:  #c2c2c8;
  --m-display:'Barlow Condensed','Inter',system-ui,sans-serif;
  --white:   #ffffff;
  --gray1:   #e5e5e5;
  --gray2:   #999999;
  --gray3:   #555555;
  --radius:  6px;
  --nav-h:   68px;
  --app-max: 1600px;   /* larghezza massima del contenuto: app "boxed" su schermi grandi */
  --gutter:  48px;     /* padding orizzontale coerente del contenuto */
}

html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--white);
  font-family: var(--font, -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif);
  font-size: 16px;
  line-height: 1.5;
  overflow-x: hidden;
}
button { cursor: pointer; border: none; background: none; font-family: inherit; }
a { color: inherit; text-decoration: none; }
img { display: block; }

/* ═══════════════════════════════════════════════
   NAVBAR
═══════════════════════════════════════════════ */
.navbar {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--nav-h);
  z-index: 100;
  transition: background 0.3s;
  background: linear-gradient(to bottom, rgba(0,0,0,0.9) 0%, transparent 100%);
}
.navbar.scrolled {
  background: rgba(10,10,10,0.97);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.navbar-inner {
  max-width: var(--app-max); margin: 0 auto;
  height: 100%;
  display: flex; align-items: center;
  padding: 0 48px;
  gap: 40px;
}
.nav-logo {
  flex-shrink: 0; cursor: pointer;
  display: flex; align-items: center;
}
.nav-logo img { height: 40px; width: auto; mix-blend-mode: screen; }

.nav-links {
  display: flex; align-items: center; gap: 24px;
  flex: 1;
}
.nav-link {
  font-size: 14px; font-weight: 500;
  color: var(--gray1);
  transition: color 0.15s;
  cursor: pointer;
  position: relative;
  padding: 4px 0;
}
.nav-link:hover { color: var(--white); }
.nav-link.active { color: var(--white); font-weight: 600; }
.nav-link.active::after {
  content: ''; position: absolute; bottom: -2px; left: 0; right: 0;
  height: 2px; background: var(--gold); border-radius: 2px;
}

.nav-right {
  display: flex; align-items: center; gap: 16px;
  margin-left: auto;
}
.nav-search-btn {
  color: var(--gray1); transition: color 0.15s; padding: 4px;
}
.nav-search-btn:hover { color: var(--white); }
.nav-search-btn svg { width: 20px; height: 20px; }
.nav-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  overflow: hidden; cursor: pointer;
  border: 1.5px solid rgba(220,200,141,0.45);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.nav-avatar:hover { border-color: var(--m-gold); box-shadow: 0 0 0 3px rgba(220,200,141,0.15); }
.nav-avatar img { width: 100%; height: 100%; object-fit: cover; }
/* Avatar a iniziali (reale, niente foto mockup) */
.avatar-initials {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #e5d6a8 0%, #DCC88D 50%, #B8A46E 100%);
  color: #0E0E12; font-family: var(--m-display); font-weight: 900; letter-spacing: .5px; line-height: 1;
}
/* Storico ordini (schermata Pagamenti) */
.orders-list { display: flex; flex-direction: column; gap: 10px; }
.order-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: #141414; border: 1px solid #262626; border-radius: 10px; padding: 14px 18px;
}
.order-course { font-weight: 700; font-size: 15px; }
.order-meta { font-size: 12px; color: var(--gray2); margin-top: 2px; text-transform: capitalize; }
.order-amount { font-weight: 800; color: var(--m-gold); white-space: nowrap; }
.payment-section-title { font-size: 16px; font-weight: 700; margin: 0 0 10px; }
.sub-cancel-btn {
  background: #1f1f1f; color: #e5e5e5; border: 1px solid #333; border-radius: 7px;
  padding: 7px 14px; font-size: 13px; font-weight: 600; white-space: nowrap;
}
.sub-cancel-btn:hover { background: #2a2a2a; color: #fff; }
.sub-cancel-btn:disabled { opacity: .5; cursor: default; }
.payment-whop-link {
  display: inline-block; margin-top: 18px; color: var(--m-gold);
  font-weight: 600; font-size: 14px;
}
.payment-whop-link:hover { text-decoration: underline; }

/* Modale Embedded Checkout Whop */
.whop-modal-overlay {
  position: fixed; inset: 0; z-index: 600;
  background: rgba(0,0,0,.72); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.whop-modal {
  background: #0f0f0f; border: 1px solid #262626; border-radius: 14px;
  width: 100%; max-width: 460px; max-height: 90vh; overflow: hidden;
  display: flex; flex-direction: column; box-shadow: 0 24px 60px rgba(0,0,0,.6);
}
.whop-modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 18px; border-bottom: 1px solid #1f1f1f; font-weight: 700; font-size: 15px;
}
.whop-modal-close {
  color: var(--gray2); font-size: 18px; line-height: 1; padding: 4px 8px; border-radius: 6px;
}
.whop-modal-close:hover { color: var(--white); background: #1f1f1f; }
.whop-modal-body { padding: 14px; overflow-y: auto; }
#whopCheckoutBox { min-height: 420px; }

/* ═══════════════════════════════════════════════
   SCREENS
═══════════════════════════════════════════════ */
.screen { display: none; }
.screen.active { display: block; }

/* ═══════════════════════════════════════════════
   HERO — full-bleed cinematic
═══════════════════════════════════════════════ */
/* ═══ HERO — layout split sinistra/destra ═══ */
.hero {
  position: relative;
  height: 76vh; min-height: 500px; max-height: 800px;
  max-width: var(--app-max); margin: 0 auto;
  overflow: hidden;
}

/* Sfondo dark con glow categoria (impostato da JS via inline style) */
.hero-bg {
  position: absolute; inset: 0;
  transition: background 0.7s cubic-bezier(0.4,0,0.2,1);
}
/* Vignetta inferiore per raccordare con le row */
.hero-bg::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(10,10,10,1) 0%, rgba(10,10,10,0.5) 18%, transparent 40%);
}

/* Flex wrapper che occupa tutta la hero */
.hero-body {
  position: absolute; inset: 0;
  display: flex;
  align-items: center;
  padding: 0 48px;
  gap: 40px;
}

/* ── Colonna sinistra: testo ── */
.hero-content {
  flex: 0 0 auto;
  width: 50%;
  max-width: 520px;
  position: relative; z-index: 1;
}
/* Logo corso con proporzioni naturali */
.hero-logo-wrap {
  height: 52px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
}
.hero-logo {
  max-height: 52px;
  max-width: 200px;
  width: auto;
  object-fit: contain;
  object-position: left center;
  border-radius: 6px;
  display: block;
}
.hero-logo-wrap:empty,
.hero-logo[src=""] { display: none; }

.hero-category {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--gold); margin-bottom: 12px;
}
.hero-category-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); flex-shrink: 0; }
.hero-title {
  font-size: clamp(28px, 3.8vw, 50px);
  font-weight: 800; line-height: 1.06;
  letter-spacing: -0.025em;
  margin-bottom: 12px;
}
.hero-desc {
  font-size: 14px; color: var(--gray1); line-height: 1.65;
  margin-bottom: 20px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.hero-stats {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 24px;
}
.hero-stat-item {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 13px; color: var(--gray1);
}
.hero-stat-sep { font-size: 11px; color: var(--gray3); }
.hero-meta-badge {
  font-size: 10px; font-weight: 700; letter-spacing: 0.07em;
  padding: 3px 8px; border: 1px solid rgba(255,255,255,0.35);
  border-radius: 3px; color: var(--gray1);
}
.hero-meta-text { font-size: 13px; color: var(--gray2); }
.hero-actions { display: flex; align-items: center; gap: 12px; }
.btn-play {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--white); color: var(--black);
  font-size: 15px; font-weight: 700;
  padding: 11px 28px; border-radius: var(--radius);
  transition: background 0.15s, transform 0.12s;
}
.btn-play svg { width: 18px; height: 18px; }
.btn-play:hover { background: rgba(255,255,255,0.88); transform: scale(1.02); }
.btn-info {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(109,109,110,0.65); backdrop-filter: blur(8px);
  color: var(--white); font-size: 15px; font-weight: 600;
  padding: 11px 24px; border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,0.1);
  transition: background 0.15s;
}
.btn-info svg { width: 17px; height: 17px; }
.btn-info:hover { background: rgba(109,109,110,0.5); }

/* ── Colonna destra: poster card ── */
.hero-poster-wrap {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  position: relative; z-index: 1;
  gap: 0;
}
@keyframes hero-float {
  0%, 100% { transform: translateY(0px) rotate(-1deg); }
  50%       { transform: translateY(-8px) rotate(-1deg); }
}
/* Poster 16:9 — thumbnail lezione video */
.hero-poster {
  position: relative;
  width: min(440px, 42vw);
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  overflow: hidden;
  animation: hero-float 7s ease-in-out infinite;
  transition: box-shadow 0.7s ease;
  cursor: pointer;
}
.hero-poster-img {
  width: 100%; height: 100%;
  background-size: cover; background-position: center;
  transition: background-image 0.4s ease, transform 0.4s ease;
}
.hero-poster:hover .hero-poster-img { transform: scale(1.03); }
/* Play button centrale */
.hero-poster-play {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.22);
  transition: background 0.2s;
}
.hero-poster:hover .hero-poster-play { background: rgba(0,0,0,0.12); }
.hero-poster-play svg {
  width: 52px; height: 52px;
  filter: drop-shadow(0 2px 12px rgba(0,0,0,0.7));
  opacity: 0.92;
  transition: transform 0.18s, opacity 0.18s;
}
.hero-poster:hover .hero-poster-play svg { transform: scale(1.1); opacity: 1; }
/* Shine */
.hero-poster-shine {
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.03) 40%, transparent 60%);
  pointer-events: none;
}
/* Overlay bottom: titolo + chip */
.hero-poster-bottom {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 28px 14px 12px;
  background: linear-gradient(to top, rgba(0,0,0,0.88) 0%, transparent 100%);
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 8px;
}
.hero-poster-label {
  font-size: 12px; font-weight: 700;
  color: rgba(255,255,255,0.9);
  line-height: 1.3; flex: 1;
  overflow: hidden; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.hero-poster-chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(255,255,255,0.15); backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 20px; padding: 4px 10px;
  font-size: 11px; font-weight: 600; color: #fff;
  white-space: nowrap; flex-shrink: 0;
}
/* Riflesso — scaleY(-1) inverte l'asse locale: "to top" locale = opaco vicino alla card */
.hero-poster-reflection {
  width: min(440px, 42vw);
  height: 48px;
  border-radius: 0 0 14px 14px;
  background-size: cover;
  background-position: center bottom;
  transform: scaleY(-1);
  opacity: 0.55;
  /* Con scaleY(-1) il gradiente visivo è invertito: usiamo "to top" locale
     → opaco in cima (vicino alla card), trasparente in basso */
  -webkit-mask-image: linear-gradient(to top, rgba(0,0,0,0.6) 0%, transparent 100%);
  mask-image: linear-gradient(to top, rgba(0,0,0,0.6) 0%, transparent 100%);
  filter: blur(3px) saturate(0.8);
  flex-shrink: 0;
}

/* Slider dots — centrati in fondo all'hero */
.hero-dots {
  position: absolute; bottom: 20px; left: 0; right: 0;
  display: flex; justify-content: center; gap: 6px; z-index: 2;
}
.hero-dot {
  width: 22px; height: 4px; border-radius: 2px;
  background: rgba(255,255,255,0.25);
  cursor: pointer; transition: all 0.25s;
}
.hero-dot.active { background: var(--gold); width: 36px; }

/* ═══════════════════════════════════════════════
   ROW SLIDER (Netflix style)
═══════════════════════════════════════════════ */
/* niente pull-up sotto la hero (evita la sovrapposizione di "Continua a guardare") + colonna centrata */
/* ── Griglia di sfondo per la sezione rows ────────────────────────── */
.rows-wrapper {
  position: relative;
  overflow: hidden;
}
.rows-bg {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  /* Griglia con linee sottili gold */
  background-image:
    linear-gradient(rgba(201,162,39,0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(201,162,39,0.07) 1px, transparent 1px);
  background-size: 44px 44px;
  /* Sfuma verso i bordi con gradiente radiale */
  -webkit-mask-image: radial-gradient(ellipse 96% 80% at 50% 35%, black 10%, transparent 72%);
  mask-image: radial-gradient(ellipse 96% 80% at 50% 35%, black 10%, transparent 72%);
}
/* Spotlight dorato che segue il mouse (--mx/--my aggiornati da JS) */
.rows-bg::after {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(
    circle 320px at var(--mx, 50%) var(--my, 40%),
    rgba(201,162,39,0.07) 0%,
    transparent 70%
  );
  pointer-events: none;
}
.rows-container { padding: 28px 0 60px; position: relative; z-index: 1; max-width: var(--app-max); margin: 0 auto; }

.row { margin-bottom: 3vw; padding: 0; }
.row-header {
  padding: 0 48px 12px;
  display: flex; align-items: baseline; gap: 12px;
}
.row-title {
  font-size: 20px; font-weight: 700; color: var(--gray1);
  letter-spacing: -0.01em;
}
.row-title:hover { color: var(--gold); cursor: default; }
.row-see-all {
  font-size: 13px; color: var(--gold);
  font-weight: 600; cursor: pointer;
  opacity: 0; transition: opacity 0.2s;
  display: flex; align-items: center; gap: 4px;
}
.row-header:hover .row-see-all { opacity: 1; }
.row-see-all svg { width: 14px; height: 14px; transition: transform 0.2s; }
.row-see-all:hover svg { transform: translateX(3px); }

.row-slider-wrap { position: relative; }
.row-slider {
  display: flex; gap: 4px;
  padding: 0 var(--gutter);
  overflow-x: auto; overflow-y: visible;
  scrollbar-width: none;
  scroll-snap-type: x mandatory;
  scroll-padding-left: var(--gutter);
  padding-bottom: 20px; margin-bottom: -20px;
}
.row-slider::-webkit-scrollbar { display: none; }
.row-arrow {
  position: absolute; top: 0; bottom: 20px;
  width: 48px;
  background: rgba(20,20,20,0.7);
  color: var(--white);
  font-size: 28px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; z-index: 10;
  opacity: 0; transition: opacity 0.2s;
}
.row-slider-wrap:hover .row-arrow { opacity: 1; }
.row-arrow.left { left: 0; border-radius: 0 var(--radius) var(--radius) 0; }
.row-arrow.right { right: 0; border-radius: var(--radius) 0 0 var(--radius); }
.row-arrow:hover { background: rgba(20,20,20,0.95); }

/* ═══════════════════════════════════════════════
   CARD (Netflix hover zoom)
═══════════════════════════════════════════════ */
.card {
  flex-shrink: 0;
  width: calc((100vw - 96px - 16px) / 5);
  min-width: 180px; max-width: 320px;
  border-radius: var(--radius);
  overflow: visible;
  cursor: pointer;
  position: relative;
  transition: transform 0.25s ease, z-index 0s 0.25s;
  scroll-snap-align: start;
}
.card:hover {
  transform: scale(1.08);
  z-index: 20;
  transition: transform 0.25s ease, z-index 0s;
}
.card:first-child:hover { transform-origin: left center; }
.card:last-child:hover  { transform-origin: right center; }

.card-thumb {
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--bg3) center/cover no-repeat;
  border-radius: var(--radius);
  position: relative; overflow: hidden;
}
/* Placeholder copertina: titolo corso su sfondo nero (corsi senza logo nel mockup) */
.cover-ph {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center; text-align: center;
  padding: 10px 14px; background: #000; color: #fff;
  font-weight: 800; font-size: 14px; line-height: 1.25;
  letter-spacing: 0.4px; text-transform: uppercase;
}
.card-progress {
  position: absolute; bottom: 0; left: 0; right: 0;
  height: 3px; background: rgba(255,255,255,0.2);
}
.card-progress-fill {
  height: 100%; background: var(--gold); border-radius: 2px;
}
.card-hover-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0);
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius);
  transition: background 0.2s;
}
.card:hover .card-hover-overlay { background: rgba(0,0,0,0.3); }
.card-play-icon {
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255,255,255,0.95);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transform: scale(0.8);
  transition: opacity 0.2s, transform 0.2s;
}
.card:hover .card-play-icon { opacity: 1; transform: scale(1); }
.card-play-icon svg { width: 18px; height: 18px; margin-left: 2px; }

.card-info {
  padding: 10px 4px 4px;
  opacity: 0; transform: translateY(-4px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}
.card:hover .card-info { opacity: 1; transform: translateY(0); pointer-events: auto; }
.card-info-actions {
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
}
.card-action-btn {
  width: 30px; height: 30px; border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.4);
  color: var(--white);
  display: flex; align-items: center; justify-content: center;
  transition: border-color 0.15s, background 0.15s;
}
.card-action-btn:hover { border-color: var(--white); background: rgba(255,255,255,0.1); }
.card-action-btn svg { width: 14px; height: 14px; }
.card-action-btn.primary {
  background: var(--white); border-color: var(--white);
  color: var(--black); width: 34px; height: 34px;
}
.card-action-btn.primary svg { width: 16px; height: 16px; margin-left: 2px; }
.card-action-btn.primary:hover { background: var(--gray1); }
.card-meta {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; flex-wrap: wrap;
}
.card-match { color: #46d369; font-weight: 700; }
.card-dur { color: var(--gray2); }
.card-cat-badge {
  font-size: 10px; font-weight: 700;
  border: 1px solid rgba(255,255,255,0.3);
  padding: 1px 5px; border-radius: 2px;
  color: var(--gray1);
}
.card-title-small {
  font-size: 12px; font-weight: 600;
  color: var(--white); margin-top: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Info (categoria + titolo) sovrapposte dentro la thumb, in basso a sinistra */
.card-thumb-info {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 1;
  padding: 28px 10px 10px;
  display: flex; flex-direction: column; align-items: flex-start; gap: 5px;
  background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.45) 55%, transparent 100%);
  pointer-events: none; text-align: left;
}
.card-thumb-info .card-cat-badge {
  font-size: 9px; letter-spacing: 0.04em; text-transform: uppercase;
  background: rgba(0,0,0,0.35);
}
.card-thumb-info .card-title-small {
  margin-top: 0; max-width: 100%;
  text-shadow: 0 1px 3px rgba(0,0,0,0.65);
}
/* la barra di progresso resta visibile sopra la sfumatura */
.card-progress { z-index: 2; }

/* ═══════════════════════════════════════════════
   CATEGORIES SCREEN
═══════════════════════════════════════════════ */
.cats-screen-header {
  padding: calc(var(--nav-h) + 40px) 48px 32px;
  max-width: var(--app-max);
  margin: 0 auto;
}
.cats-screen-title { font-size: 32px; font-weight: 800; letter-spacing: -0.02em; }

.cats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 0 48px 80px;
  max-width: var(--app-max);
  margin: 0 auto;
}

  .cat-tile-icon {
    position: absolute; top: 18px; left: 18px;
    width: 44px; height: 44px;
    opacity: 0.9;
    color: #98743D;
  }
  .cat-tile-icon svg { width: 100%; height: 100%; }
  .cat-tile-name {
    position: absolute; bottom: 14px; left: 18px;
    font-size: 17px; font-weight: 800;
    letter-spacing: -0.01em;
    text-shadow: 0 1px 6px rgba(0,0,0,0.5);
  }
  .cat-tile-count {
    position: absolute; top: 14px; right: 14px;
    font-size: 11px; font-weight: 700;
    background: rgba(0,0,0,0.45);
    padding: 3px 8px; border-radius: 20px;
    color: rgba(255,255,255,0.85); letter-spacing: 0.04em;
  }

  .cat-tile {
  height: 150px; border-radius: 8px;
  position: relative; overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}
.cat-tile:hover { transform: scale(1.03); box-shadow: 0 8px 32px rgba(0,0,0,0.5); }
.cat-tile-bg {
  position: absolute; inset: 0;
  border-radius: 8px;
}
.cat-tile-name {
  position: absolute; bottom: 16px; left: 20px;
  font-size: 20px; font-weight: 800;
  letter-spacing: -0.01em;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}
.cat-tile-count {
  position: absolute; top: 14px; right: 14px;
  font-size: 11px; font-weight: 700;
  background: rgba(0,0,0,0.5);
  padding: 3px 8px; border-radius: 20px;
  color: var(--gray1); letter-spacing: 0.04em;
}

/* ═══════════════════════════════════════════════
   ALL PERCORSI GRID
═══════════════════════════════════════════════ */
.all-grid-screen { padding: calc(var(--nav-h) + 32px) 48px 80px; max-width: var(--app-max); margin: 0 auto; }
.all-grid-title { font-size: 28px; font-weight: 800; margin-bottom: 8px; letter-spacing: -0.02em; }
.all-grid-sub { font-size: 14px; color: var(--gray2); margin-bottom: 32px; }
.all-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.all-card {
  border-radius: 6px;
  cursor: pointer; position: relative;
  transition: transform 0.2s;
}
.all-card:hover { transform: scale(1.03); z-index: 2; }
.all-card-thumb {
  aspect-ratio: 16/9;
  background: var(--bg3) center/cover no-repeat;
  position: relative;
  overflow: hidden;
  border-radius: 6px;
}
.all-card-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 60%);
  z-index: 0;
}
.all-card-ep {
  position: absolute; top: 10px; left: 10px;
  z-index: 2;
  font-size: 10px; font-weight: 700; letter-spacing: 0.08em;
  background: rgba(0,0,0,0.65); color: var(--gray1);
  padding: 3px 8px; border-radius: 3px;
}
.all-card-free {
  position: absolute; top: 10px; right: 10px;
  z-index: 2;
  font-size: 10px; font-weight: 800; letter-spacing: 0.1em;
  background: #46d369; color: #000;
  padding: 3px 8px; border-radius: 3px;
}
.card-free-badge {
  position: absolute; top: 8px; right: 8px;
  z-index: 3;
  font-size: 9px; font-weight: 800; letter-spacing: 0.1em;
  background: #46d369; color: #000;
  padding: 2px 7px; border-radius: 3px;
}
.all-card-title {
  position: absolute; bottom: 10px; left: 12px; right: 12px;
  z-index: 2;
  font-size: 13px; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.all-card-cat {
  position: absolute; bottom: 28px; left: 12px;
  z-index: 2;
  font-size: 10px; font-weight: 600;
  color: var(--gold);
}
.all-card-progress {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 3;
  height: 3px; background: rgba(255,255,255,0.18);
}
.all-card-progress-fill { height: 100%; background: var(--gold); }

/* Chip-filtro categoria nella griglia "Esplora" della home */
.home-chips {
  display: flex; gap: 8px; overflow-x: auto;
  padding: 4px var(--gutter) 18px; scrollbar-width: none;
}
.explore-row .all-grid { padding: 0 var(--gutter); }
.home-chips::-webkit-scrollbar { display: none; }
.home-chip {
  flex: 0 0 auto; background: var(--bg3); color: var(--gray2);
  border: none; border-radius: 999px; padding: 8px 15px;
  font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background .15s, color .15s;
}
.home-chip:hover { color: var(--white); }
.home-chip.active { background: var(--gold); color: #000; }
.home-chip-n { opacity: .55; font-weight: 700; margin-left: 3px; }
.home-chip.active .home-chip-n { opacity: .75; }
.explore-row { margin-top: 8px; }

/* ── Schermi grandi (27"+): nav/titoli più sostanziosi, hero non troppo basso ── */
@media (min-width: 1700px) {
  :root { --nav-h: 76px; }
  .nav-link { font-size: 15px; }
  .nav-links { gap: 30px; }
  .nav-logo img { height: 44px; }
  .hero { min-height: 600px; max-height: 880px; }
  .hero-title { font-size: clamp(44px, 3.4vw, 64px); }
  .row-title { font-size: 22px; }
  .home-chip { font-size: 14px; padding: 9px 17px; }
}

/* ═══════════════════════════════════════════════
   TOOLS SCREEN
═══════════════════════════════════════════════ */
.tools-screen { padding: calc(var(--nav-h) + 40px) 48px 80px; max-width: var(--app-max); margin: 0 auto; }
.tools-title { font-size: 32px; font-weight: 800; margin-bottom: 8px; letter-spacing: -0.02em; }
.tools-sub { font-size: 14px; color: var(--gray2); margin-bottom: 40px; }
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}
.tool-card {
  background: var(--m-card);
  border: 1px solid var(--m-line);
  border-radius: 16px;
  padding: 28px;
  cursor: pointer;
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  box-shadow: 0 18px 40px -22px rgba(0,0,0,0.6), inset 0 1px 0 rgba(220,200,141,0.06);
  transition: background 0.18s, border-color 0.18s, transform 0.18s, box-shadow 0.18s;
  display: flex; flex-direction: column; gap: 16px;
}
.tool-card:hover {
  border-color: rgba(220,200,141,0.45);
  transform: translateY(-2px);
  box-shadow: 0 26px 52px -20px rgba(0,0,0,0.7), 0 0 44px -26px rgba(220,200,141,0.3);
}
.tool-name { font-family: var(--m-display); text-transform: uppercase; letter-spacing: 0.01em; }
.tool-discount { background: rgba(220,200,141,0.14); color: var(--m-gold); }
.tool-stars { color: var(--m-gold); }
.tool-access-btn:hover { background: rgba(220,200,141,0.1); border-color: var(--m-gold); color: var(--m-gold); }
.tool-logo-row { display: flex; align-items: center; gap: 16px; }
.tool-logo {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 800; flex-shrink: 0;
}
.tool-name { font-size: 16px; font-weight: 700; }
.tool-cat-badge {
  font-size: 10px; color: var(--gray2); font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
}
.tool-desc { font-size: 13px; color: var(--gray2); line-height: 1.65; }
.tool-discount {
  display: inline-block;
  background: rgba(201,162,39,0.12);
  color: var(--gold);
  font-size: 11px; font-weight: 700;
  padding: 3px 8px; border-radius: 3px;
  letter-spacing: 0.04em;
}

  .tool-access-btn {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    width: 100%;
    padding: 10px 16px;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 6px;
    color: var(--gray1);
    font-size: 13px; font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    margin-top: 4px;
  }
  .tool-access-btn:hover {
    background: rgba(201,162,39,0.1);
    border-color: var(--gold);
    color: var(--gold);
  }

  .tool-rating { display: flex; align-items: center; gap: 4px; }
.tool-stars { color: var(--gold); font-size: 12px; letter-spacing: -1px; }
.tool-rating-num { font-size: 12px; color: var(--gray2); }

/* ═══════════════════════════════════════════════
   SUPPORTO SCREEN
═══════════════════════════════════════════════ */
.supporto-screen {
  padding: calc(var(--nav-h) + 60px) 48px 80px;
  max-width: 900px;
  margin: 0 auto;
  text-align: center;
}
.supporto-title { font-size: 32px; font-weight: 800; margin-bottom: 10px; letter-spacing: -0.02em; }
.supporto-sub { font-size: 15px; color: var(--gray2); margin-bottom: 52px; }

.support-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}
.support-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px 28px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.support-card:hover {
  border-color: var(--gold);
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
}
.support-card-icon {
  width: 56px; height: 56px;
  border-radius: 14px;
  background: rgba(201,162,39,0.12);
  color: var(--gold);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 20px;
}
.support-card-icon svg { width: 26px; height: 26px; }
.support-card-title {
  font-size: 17px; font-weight: 700;
  color: var(--white);
  margin-bottom: 8px;
}
.support-card-desc {
  font-size: 13px; color: var(--gray2);
  line-height: 1.5;
  margin-bottom: 28px;
  flex: 1;
}
.support-card-cta {
  font-size: 13px; font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.03em;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s;
  padding-bottom: 2px;
}
.support-card:hover .support-card-cta { border-color: var(--gold); }
.support-card--disabled { opacity: 0.5; cursor: default; pointer-events: none; }
.support-card--disabled:hover { border-color: var(--border); background: var(--bg2); transform: none; }
.support-options { display: flex; flex-direction: column; gap: 2px; }
.support-option {
  display: flex; align-items: center; gap: 20px;
  padding: 24px;
  background: var(--bg2);
  cursor: pointer; transition: background 0.15s;
}
.support-option:hover { background: var(--bg3); }
.support-option-icon {
  width: 48px; height: 48px; border-radius: 10px;
  background: var(--bg3);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; color: var(--gold);
}
.support-option-icon svg { width: 22px; height: 22px; }
.support-option-text { flex: 1; }
.support-option-title { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.support-option-desc { font-size: 13px; color: var(--gray2); }
.support-option-arrow { color: var(--gray3); }
.support-option-arrow svg { width: 20px; height: 20px; }

/* ═══════════════════════════════════════════════
   SEARCH OVERLAY
═══════════════════════════════════════════════ */
.search-overlay {
  display: none; position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.92);
  backdrop-filter: blur(8px);
  padding: 80px 48px 40px;
}
.search-overlay.open { display: block; }
.search-box-wrap {
  max-width: 600px; margin: 0 auto;
  position: relative;
}
.search-input {
  width: 100%; padding: 16px 20px 16px 52px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 6px; color: var(--white);
  font-size: 18px; font-family: inherit;
  outline: none; transition: border-color 0.2s;
}
.search-input:focus { border-color: rgba(255,255,255,0.3); }
.search-input::placeholder { color: var(--gray3); }
.search-icon {
  position: absolute; left: 18px; top: 50%; transform: translateY(-50%);
  color: var(--gray3);
}
.search-icon svg { width: 20px; height: 20px; }
.search-close {
  position: absolute; top: -56px; right: 0;
  color: var(--gray2); font-size: 14px; font-weight: 500;
  display: flex; align-items: center; gap: 6px;
}
.search-close svg { width: 16px; height: 16px; }
.search-results {
  max-width: 600px; margin: 20px auto 0;
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}

/* ═══════════════════════════════════════════════
   MOBILE HAMBURGER + DRAWER
═══════════════════════════════════════════════ */
.hamburger-btn {
  display: none;
  flex-direction: column; gap: 5px;
  padding: 6px; cursor: pointer; color: var(--white);
}
.hamburger-btn svg { width: 22px; height: 22px; }
.mobile-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.7); z-index: 299;
}
.mobile-drawer {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: 260px; background: #000;
  z-index: 300; display: flex; flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
  border-right: 1px solid var(--border);
}
.mobile-drawer.open { transform: translateX(0); }
.drawer-nav-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.drawer-nav-header img { height: 32px; mix-blend-mode: screen; }
.drawer-close { color: var(--gray2); padding: 4px; }
.drawer-close svg { width: 20px; height: 20px; }
.drawer-nav-links { padding: 8px 0; flex: 1; }
.drawer-nav-link {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 20px;
  font-size: 15px; font-weight: 500; color: var(--gray1);
  cursor: pointer; transition: color 0.15s, background 0.15s;
  width: 100%;
}
.drawer-nav-link svg { width: 18px; height: 18px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 2; }
.drawer-nav-link:hover, .drawer-nav-link.active { color: var(--white); background: rgba(255,255,255,0.05); }
.drawer-nav-link.active { color: var(--gold); }
.drawer-user {
  padding: 16px 20px; border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; cursor: pointer;
}
.drawer-avatar { width: 36px; height: 36px; border-radius: 4px; overflow: hidden; }
.drawer-avatar img { width: 100%; height: 100%; object-fit: cover; }
.drawer-user-info { flex: 1; min-width: 0; }
.drawer-user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawer-user-email { font-size: 11px; color: var(--gray3); }

/* ═══════════════════════════════════════════════
   TOAST
═══════════════════════════════════════════════ */
.toast {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--white); font-size: 13px; font-weight: 500;
  padding: 10px 20px; border-radius: 6px;
  opacity: 0; transition: all 0.3s; z-index: 500; white-space: nowrap;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Error banner — bootstrap failure */
.vbs-error-banner {
  position: fixed; top: var(--nav-h, 72px); left: 0; right: 0;
  background: rgba(239,68,68,0.12); border-bottom: 1px solid rgba(239,68,68,0.3);
  color: #fca5a5; font-size: 14px; font-weight: 500;
  padding: 14px var(--gutter, 24px); text-align: center; z-index: 200;
  display: flex; align-items: center; justify-content: center; gap: 12px;
}
.vbs-error-banner button {
  background: var(--gold); color: #000; border: none; border-radius: 6px;
  padding: 6px 16px; font-size: 13px; font-weight: 600; cursor: pointer;
}

/* ═══════════════════════════════════════════════
   MOBILE RESPONSIVE
═══════════════════════════════════════════════ */
@media (max-width: 768px) {
  :root { --nav-h: 56px; --gutter: 16px; }
  .navbar-inner { padding: 0 16px; gap: 0; }
  .nav-links { display: none; }
  .hamburger-btn { display: flex !important; }
  .nav-logo img { height: 30px; }
  .nav-avatar { width: 30px; height: 30px; }

  .hero { height: auto; min-height: unset; }
  .hero-body { flex-direction: column-reverse; padding: 72px 20px 52px; gap: 24px; align-items: center; justify-content: flex-end; }
  .hero-content { width: 100%; max-width: 100%; text-align: center; }
  .hero-category { justify-content: center; }
  .hero-stats { justify-content: center; }
  .hero-actions { justify-content: center; }
  .hero-title { font-size: 26px; margin-bottom: 10px; }
  .hero-desc { display: none; }
  .hero-poster { width: min(300px, 86vw); animation: none; transform: none; }
  .hero-poster-reflection { display: none; }
  .hero-logo-wrap { height: 36px; margin-bottom: 10px; }
  .hero-logo { max-height: 36px; }
  .btn-play { font-size: 13px; padding: 9px 20px; }
  .btn-info { font-size: 13px; padding: 9px 16px; }
  .hero-dots { bottom: 12px; }
  .hero-dot { width: 16px; height: 3px; }
  .hero-dot.active { width: 26px; }

  .rows-container { margin-top: -40px; }
  .row { margin-bottom: 24px; }
  .row-header { padding: 0 16px 8px; }
  .row-title { font-size: 16px; }
  .row-slider { padding: 0 16px; gap: 6px; }
  .row-see-all { opacity: 1; }
  .row-arrow { display: none; }
  .card { width: calc((100vw - 32px - 12px) / 2.5); min-width: 140px; }
  .card-info { display: none; }

  .cats-screen-header { padding: calc(var(--nav-h) + 24px) 16px 20px; }
  .cats-screen-title { font-size: 24px; }
  .cats-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; padding: 0 16px 60px; }
  .cat-tile { height: 100px; }
  .cat-tile-name { font-size: 15px; bottom: 12px; left: 14px; }

  .all-grid-screen { padding: calc(var(--nav-h) + 24px) 16px 60px; }
  .all-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .all-grid-title { font-size: 22px; }

  .tools-screen { padding: calc(var(--nav-h) + 24px) 16px 60px; }
  .tools-title { font-size: 24px; }
  .tools-grid { grid-template-columns: 1fr; gap: 14px; }

  .supporto-screen { padding: calc(var(--nav-h) + 24px) 16px 60px; }
  .supporto-title { font-size: 24px; }
  .support-cards-grid { grid-template-columns: 1fr; gap: 14px; }
  .support-card { padding: 28px 20px 24px; }

  .search-overlay { padding: 64px 16px 20px; }
  .search-results { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .all-grid { grid-template-columns: repeat(2, 1fr); }
  .cats-grid { grid-template-columns: 1fr; }
  .card { width: calc((100vw - 32px - 6px) / 2); }
}

/* ═══════════════════════════════════════════════
   HOME SCREEN — card più grandi su desktop (4 per riga invece di 5)
═══════════════════════════════════════════════ */
@media (min-width: 769px) {
  #screen-home .card {
    width: calc((100vw - 96px - 12px) / 4);
    max-width: 400px;
  }
}

  /* ══════════════════════════════════════════════════
     LESSON SCREEN
  ══════════════════════════════════════════════════ */
  .lesson-topbar {
    display:flex; align-items:center; gap:16px;
    max-width:1400px; margin:0 auto; padding:18px 48px 4px;
  }
  .lesson-topbar .lesson-back { margin-bottom:0; }
  .lesson-topbar .lesson-course-tag { margin-bottom:0; margin-left:auto; }
  @media (max-width:768px){ .lesson-topbar { padding:14px 16px 4px; gap:10px; flex-wrap:wrap; } }
  .lesson-screen {
    min-height: 100vh;
    background: var(--bg);
    padding-top: var(--nav-h);
  }

  /* ── Video player area ───────────────────────────── */
  .lesson-video-wrap {
    position: relative;
    width: 100%;
    background: #000;
    max-height: 75vh;
    overflow: hidden;
  }
  .lesson-video-player {
    width: 100%;
    aspect-ratio: 16/9;
    max-height: 75vh;
    object-fit: contain;
    background: #000;
    display: block;
  }
  /* Fake video overlay (no real video) */
  .lesson-video-fake {
    width: 100%;
    aspect-ratio: 16/9;
    max-height: 75vh;
    background: center/cover no-repeat;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
  }
  .lesson-video-fake::after {
    content: '';
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.4);
  }
  .lesson-video-play-center {
    position: relative; z-index: 1;
    width: 72px; height: 72px;
    border-radius: 50%;
    background: rgba(255,255,255,0.92);
    display: flex; align-items: center; justify-content: center;
    transition: transform 0.2s, background 0.2s;
    cursor: pointer;
  }
  .lesson-video-fake:hover .lesson-video-play-center {
    transform: scale(1.08);
    background: #fff;
  }
  .lesson-video-play-center svg {
    width: 28px; height: 28px;
    margin-left: 4px;
  }
  /* video controls bar */
  .lesson-video-controls {
    position: absolute; bottom: 0; left: 0; right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, transparent 100%);
    padding: 24px 24px 16px;
    display: flex; flex-direction: column; gap: 10px;
    z-index: 2;
    opacity: 0; transition: opacity 0.2s;
  }
  .lesson-video-fake:hover .lesson-video-controls { opacity: 1; }
  .lesson-progress-bar {
    width: 100%; height: 3px;
    background: rgba(255,255,255,0.25);
    border-radius: 2px; cursor: pointer; position: relative;
  }
  .lesson-progress-fill {
    height: 100%; background: var(--gold);
    border-radius: 2px; transition: width 0.1s; width: 0%;
  }
  .lesson-controls-row {
    display: flex; align-items: center; gap: 16px;
  }
  .lc-btn {
    color: var(--white); opacity: 0.9;
    transition: opacity 0.15s; padding: 2px;
  }
  .lc-btn:hover { opacity: 1; }
  .lc-btn svg { width: 20px; height: 20px; }
  .lc-time { font-size: 13px; color: var(--gray1); letter-spacing: 0.02em; }
  .lc-spacer { flex: 1; }
  .lc-vol svg { width: 18px; height: 18px; }
  .lc-full svg { width: 18px; height: 18px; }

  /* ── Below video: title + body ───────────────────── */
  .lesson-body {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 0;
    max-width: 1400px;
    margin: 0 auto;
    padding: 32px 48px 80px;
    align-items: start;
  }

  /* ── Left: info ───────────────────────────────────── */
  .lesson-info { padding-right: 48px; }
  .lesson-back {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 13px; color: var(--gray2);
    margin-bottom: 20px; cursor: pointer;
    transition: color 0.15s;
  }
  .lesson-back:hover { color: var(--white); }
  .lesson-back svg { width: 16px; height: 16px; }

  .lesson-course-tag {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 11px; font-weight: 700;
    letter-spacing: 0.1em; text-transform: uppercase;
    color: var(--gold); margin-bottom: 10px;
  }
  .lesson-ep-title {
    font-size: 28px; font-weight: 800;
    letter-spacing: -0.02em; line-height: 1.15;
    margin-bottom: 12px;
  }
  .lesson-ep-meta {
    display: flex; align-items: center; gap: 12px;
    font-size: 13px; color: var(--gray2);
    margin-bottom: 20px;
  }
  .lesson-ep-meta-sep { width: 3px; height: 3px; border-radius: 50%; background: var(--gray3); }
  .lesson-ep-desc {
    font-size: 15px; color: var(--gray2);
    line-height: 1.7; max-width: 620px;
    margin-bottom: 28px;
  }
  .lesson-tags {
    display: flex; gap: 8px; flex-wrap: wrap;
    margin-bottom: 32px;
  }
  .lesson-tag {
    font-size: 12px; font-weight: 600;
    padding: 5px 12px; border-radius: 20px;
    background: var(--bg3); color: var(--gray2);
    border: 1px solid var(--border);
  }

  /* Instructor mini card */
  .lesson-instructor {
    display: flex; align-items: center; gap: 14px;
    padding: 18px 0; border-top: 1px solid var(--border);
  }
  .lesson-instr-avatar {
    width: 48px; height: 48px; border-radius: 4px;
    overflow: hidden; flex-shrink: 0;
  }
  .lesson-instr-avatar img { width: 100%; height: 100%; object-fit: cover; }
  .lesson-instr-info { flex: 1; }
  .lesson-instr-label { font-size: 11px; color: var(--gray3); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 3px; }
  .lesson-instr-name { font-size: 15px; font-weight: 700; }
  .lesson-instr-role { font-size: 13px; color: var(--gray2); }

  /* ── Right: episode list ──────────────────────────── */
  .lesson-episodes {
    background: var(--bg2);
    border-radius: 8px;
    border: 1px solid var(--border);
    overflow: hidden;
    position: sticky; top: calc(var(--nav-h) + 20px);
  }
  .lesson-episodes-header {
    padding: 16px 20px 12px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
  }
  .lesson-episodes-title { font-size: 14px; font-weight: 700; }
  .lesson-episodes-count { font-size: 12px; color: var(--gray3); }
  .episode-list { max-height: 520px; overflow-y: auto; }
  .episode-list::-webkit-scrollbar { width: 4px; }
  .episode-list::-webkit-scrollbar-track { background: transparent; }
  .episode-list::-webkit-scrollbar-thumb { background: var(--bg3); border-radius: 2px; }
  .episode-item {
    display: flex; align-items: center; gap: 14px;
    padding: 12px 20px; cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid rgba(255,255,255,0.04);
  }
  .episode-item:last-child { border-bottom: none; }
  .episode-item:hover { background: var(--bg3); }
  .episode-item.playing { background: rgba(201,162,39,0.08); }
  .episode-num {
    font-size: 12px; color: var(--gray3); font-weight: 600;
    min-width: 20px; text-align: center; flex-shrink: 0;
  }
  .episode-item.playing .episode-num { color: var(--gold); }
  .episode-thumb {
    width: 100px; height: 56px; border-radius: 4px;
    background: var(--bg3) center/cover no-repeat;
    flex-shrink: 0; position: relative; overflow: hidden;
  }
  .episode-play-overlay {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0);
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s;
  }
  .episode-item:hover .episode-play-overlay { background: rgba(0,0,0,0.4); }
  .episode-play-icon {
    opacity: 0; transition: opacity 0.15s;
  }
  .episode-item:hover .episode-play-icon { opacity: 1; }
  .episode-play-icon svg { width: 20px; height: 20px; color: white; }
  .episode-item.playing .episode-thumb::after {
    content: ''; position: absolute; bottom: 0; left: 0; right: 0;
    height: 2px; background: var(--gold);
  }
  .episode-details { flex: 1; min-width: 0; }
  .episode-title {
    font-size: 13px; font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    margin-bottom: 4px;
    color: var(--gray1);
  }
  .episode-item.playing .episode-title { color: var(--white); }
  .episode-dur { font-size: 11px; color: var(--gray3); }

  /* ── Mobile lesson ────────────────────────────────── */
  @media (max-width: 768px) {
    .lesson-video-fake { max-height: 55vw; }
    .lesson-body {
      grid-template-columns: 1fr;
      padding: 20px 16px 80px;
      gap: 32px;
    }
    .lesson-info { padding-right: 0; }
    .lesson-ep-title { font-size: 20px; }
    .lesson-episodes { position: static; }
    .episode-list { max-height: 400px; }
    .episode-thumb { width: 80px; height: 45px; }
    .lesson-video-controls { opacity: 1; }
  }


  /* ══════════════════════════════════════════════════
     LOCKED COURSE PAGE
  ══════════════════════════════════════════════════ */
  .locked-screen {
    min-height: 100vh;
    background: var(--bg);
    padding-top: var(--nav-h);
  }
  .locked-hero {
    position: relative;
    height: 55vh; min-height: 400px;
    overflow: hidden;
  }
  .locked-hero-bg {
    position: absolute; inset: 0;
    background: center/cover no-repeat;
    /* Molto più sfocato e scuro: l'immagine diventa solo atmosfera,
       il testo sopra resta perfettamente leggibile. */
    filter: blur(10px) brightness(0.14) saturate(1.1);
    transform: scale(1.12);
  }
  /* Vignetta/scurimento extra: radiale al centro (dietro il testo) +
     sfumatura verso il nero in basso per saldarsi al body. */
  .locked-hero::after {
    content: ''; position: absolute; inset: 0; pointer-events: none;
    background:
      radial-gradient(ellipse 70% 60% at 50% 45%, rgba(0,0,0,0.55), transparent 75%),
      linear-gradient(180deg, rgba(10,10,12,0.5) 0%, rgba(10,10,12,0.2) 35%, rgba(10,10,12,0.9) 100%);
  }
  .locked-hero-content {
    position: absolute; inset: 0; z-index: 1;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    text-align: center; padding: 0 24px;
  }
  .locked-icon {
    width: 72px; height: 72px;
    border-radius: 50%;
    background: rgba(201,162,39,0.15);
    border: 2px solid var(--gold);
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 24px;
    color: var(--gold);
  }
  .locked-icon svg { width: 32px; height: 32px; }
  .locked-hero-title {
    font-size: clamp(24px, 4vw, 42px);
    font-weight: 800; letter-spacing: -0.02em;
    margin-bottom: 12px;
    text-shadow: 0 2px 24px rgba(0,0,0,0.7);
  }
  .locked-hero-sub {
    font-size: 16px; color: var(--gray1);
    max-width: 480px; line-height: 1.6;
    margin-bottom: 0;
    text-shadow: 0 1px 16px rgba(0,0,0,0.7);
  }
  .locked-body {
    max-width: 760px; margin: 0 auto;
    padding: 48px 24px 80px;
  }
  .locked-course-meta {
    display: flex; align-items: center; gap: 16px;
    padding-bottom: 32px; border-bottom: 1px solid var(--border);
    margin-bottom: 32px;
  }
  .locked-course-thumb {
    width: 120px; height: 68px;
    border-radius: 6px; overflow: hidden;
    background: center/cover no-repeat;
    flex-shrink: 0;
  }
  .locked-course-info { flex: 1; }
  .locked-course-cat { font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--gold); margin-bottom: 6px; }
  .locked-course-name { font-size: 20px; font-weight: 800; margin-bottom: 6px; letter-spacing: -0.01em; }
  .locked-course-stats { font-size: 13px; color: var(--gray2); display: flex; gap: 12px; }

  /* Descrizione marketing (AI) */
  .locked-desc {
    font-size: 16px; color: var(--gray1); line-height: 1.7;
    margin: 0 0 32px; max-width: 620px;
  }

  /* Cosa imparerai — bullet in stile checkout (icona oro 28x28, frase singola) */
  .locked-features { margin-bottom: 40px; }
  .locked-features-title {
    font-family: var(--display, 'Barlow Condensed', sans-serif);
    font-size: 13px; font-weight: 800; text-transform: uppercase;
    letter-spacing: 0.14em; color: var(--gold); margin-bottom: 18px;
  }
  .locked-feature-item {
    display: flex; align-items: center; gap: 12px;
    padding: 9px 0;
  }
  .locked-feature-icon {
    width: 28px; height: 28px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    border-radius: 8px;
    background: rgba(220,200,141,0.12);
    border: 1px solid rgba(220,200,141,0.30);
    color: var(--gold);
  }
  .locked-feature-icon svg { width: 14px; height: 14px; }
  .locked-feature-text {
    flex: 1; font-size: 15px; color: var(--gray1); line-height: 1.45;
  }

  /* Checkout card — stile coerente con la pagina di checkout */
  .locked-checkout {
    position: relative;
    background: rgba(22,22,24,0.85);
    border: 1px solid rgba(220,200,141,0.18);
    border-radius: 16px;
    overflow: hidden;
    -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
    box-shadow:
      0 30px 60px -20px rgba(0,0,0,0.6),
      0 0 60px -20px rgba(220,200,141,0.18),
      inset 0 1px 0 rgba(220,200,141,0.06);
  }
  /* Hairline oro sfumato in cima alla card */
  .locked-checkout::before {
    content: ''; position: absolute; left: 36px; right: 36px; top: 0; height: 1px;
    background: linear-gradient(90deg, transparent, rgba(220,200,141,0.55), transparent);
  }
  .locked-checkout-header {
    background: linear-gradient(135deg, rgba(220,200,141,0.12), transparent);
    padding: 28px 28px 20px;
    border-bottom: 1px solid var(--border);
  }
  .locked-price-row {
    display: flex; align-items: baseline; gap: 12px; margin-bottom: 8px;
  }
  .locked-price {
    font-family: var(--display, 'Barlow Condensed', sans-serif);
    font-size: 50px; font-weight: 800; letter-spacing: 0.01em; line-height: 1;
    background: linear-gradient(180deg, #f0e3b8, #DCC88D 55%, #B8A46E);
    -webkit-background-clip: text; background-clip: text; color: transparent;
  }
  .locked-price-old {
    font-size: 20px; color: var(--gray3);
    text-decoration: line-through; font-weight: 500;
  }
  .locked-price-badge {
    font-family: var(--display, 'Barlow Condensed', sans-serif);
    font-size: 12px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase;
    background: rgba(220,200,141,0.14);
    border: 1px solid rgba(220,200,141,0.30);
    color: var(--gold);
    padding: 3px 9px; border-radius: 6px;
  }
  .locked-checkout-desc { font-size: 14px; color: var(--gray2); }
  .locked-checkout-body { padding: 24px 28px; display: flex; flex-direction: column; gap: 14px; }
  .locked-checkout-includes { font-size: 13px; color: var(--gray2); margin-bottom: 4px; }
  .locked-include-item {
    display: flex; align-items: center; gap: 10px;
    font-size: 14px; color: var(--gray1);
  }
  .locked-include-item svg { width: 16px; height: 16px; color: #46d369; flex-shrink: 0; }
  .locked-cta-btn {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    background: linear-gradient(135deg, #e5d6a8, #DCC88D 50%, #B8A46E);
    color: #0E0E12;
    font-family: var(--display, 'Barlow Condensed', sans-serif);
    font-size: 17px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.03em;
    padding: 16px 32px; border-radius: 10px;
    margin-top: 8px; width: 100%;
    transition: box-shadow 0.15s, transform 0.1s, filter 0.15s;
    box-shadow: 0 10px 28px -10px rgba(220,200,141,0.5);
  }
  .locked-cta-btn:hover { filter: brightness(1.05); transform: translateY(-1px); box-shadow: 0 14px 34px -10px rgba(220,200,141,0.65); }
  .locked-cta-btn svg { width: 18px; height: 18px; }
  .locked-guarantee {
    display: flex; align-items: center; gap: 8px;
    font-size: 12px; color: var(--gray3);
    justify-content: center; margin-top: 4px;
  }
  .locked-guarantee svg { width: 14px; height: 14px; }
  .locked-back {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 13px; color: var(--gray2);
    margin-bottom: 32px; cursor: pointer;
    transition: color 0.15s; background: none; border: none;
  }
  .locked-back:hover { color: var(--white); }
  .locked-back svg { width: 16px; height: 16px; }

  /* card lock badge on rows */
  .card-lock-badge {
    position: absolute; top: 8px; right: 8px;
    background: rgba(0,0,0,0.7);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 4px; padding: 4px 6px;
    color: var(--gray1);
    display: flex; align-items: center; justify-content: center;
  }
  .all-card-lock {
    position: absolute; top: 8px; right: 8px;
    background: rgba(0,0,0,0.7);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 4px; padding: 4px 6px;
    z-index: 10;
    color: var(--white);
    display: flex; align-items: center; justify-content: center;
    pointer-events: none;
    line-height: 0;
  }
  .all-card-locked .all-card-thumb { filter: brightness(0.55); }
  .all-card-locked:hover .all-card-thumb { filter: brightness(0.8); }

  /* Unlock price badge on locked cards */
  .card-unlock-badge {
    position: absolute; bottom: 8px; right: 8px;
    background: var(--gold);
    color: #000; font-size: 11px; font-weight: 700;
    padding: 3px 8px; border-radius: 4px;
    letter-spacing: 0.02em;
    z-index: 5;
  }

  /* ── Ordini section ──────────────────────────────────────────────── */
  .ordini-section { margin-bottom: 32px; }
  .ordini-section-title {
    font-family: var(--m-display); font-size: 14px; font-weight: 800;
    text-transform: uppercase; letter-spacing: 0.12em; color: var(--m-gold);
    margin-bottom: 16px; padding-bottom: 10px;
    border-bottom: 1px solid rgba(220,200,141,0.16);
  }
  .ordini-list { display: flex; flex-direction: column; gap: 10px; }
  .ordini-card {
    background: var(--m-card);
    border: 1px solid var(--m-line);
    border-radius: 14px;
    padding: 16px;
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    box-shadow: 0 14px 34px -22px rgba(0,0,0,0.55);
    transition: border-color 0.15s, box-shadow 0.15s;
  }
  .ordini-card:hover { border-color: rgba(220,200,141,0.4); box-shadow: 0 20px 44px -22px rgba(0,0,0,0.65), 0 0 36px -26px rgba(220,200,141,0.25); }
  .ordini-card-inner {
    display: flex; align-items: center; gap: 16px;
  }
  .ordini-thumb {
    width: 64px; height: 40px; flex-shrink: 0;
    border-radius: 6px;
    background: #000 center/cover no-repeat;
  }
  .ordini-card-content {
    flex: 1; min-width: 0;
  }
  .ordini-card-top {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  }
  .ordini-course-name {
    font-size: 14px; font-weight: 600; color: var(--gray1);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .ordini-card-meta {
    font-size: 12px; color: var(--gray2); margin-top: 4px;
  }
  .ordini-method {
    text-transform: capitalize;
  }
  .ordini-card-right {
    display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0;
  }
  .ordini-amount {
    font-family: var(--m-display); font-size: 18px; font-weight: 800; color: var(--m-gold);
    white-space: nowrap;
  }
  .ordini-card-actions {
    flex-shrink: 0;
  }

  @media (max-width: 640px) {
    .ordini-card-inner { flex-wrap: wrap; }
    .ordini-thumb { width: 48px; height: 32px; }
    .ordini-card-right { flex-direction: row; align-items: center; gap: 10px; width: 100%; justify-content: space-between; margin-top: 8px; }
  }

  @media (max-width: 768px) {
    .locked-hero { height: 45vh; min-height: 300px; }
    .locked-body { padding: 28px 16px 80px; }
    .locked-course-meta { flex-direction: column; align-items: flex-start; }
    .locked-checkout-header, .locked-checkout-body { padding: 20px; }
    .locked-price { font-size: 32px; }
  }


  /* ══════════════════════════════════════════════════
     FOOTER
  ══════════════════════════════════════════════════ */
  .vbs-footer {
    background: #000;
    border-top: 1px solid rgba(255,255,255,0.07);
    padding: 56px 48px 32px;
    margin-top: 0;
  }
  .vbs-footer-inner {
    max-width: 1400px; margin: 0 auto;
  }
  .vbs-footer-top {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 48px;
    padding-bottom: 48px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    margin-bottom: 32px;
  }
  .vbs-footer-brand img {
    height: 36px; width: auto;
    mix-blend-mode: screen;
    margin-bottom: 20px;
    display: block;
  }
  .vbs-footer-brand-desc {
    font-size: 13px; color: var(--gray3);
    line-height: 1.7; max-width: 320px;
  }
  .vbs-footer-col-title {
    font-size: 11px; font-weight: 700;
    letter-spacing: 0.1em; text-transform: uppercase;
    color: var(--gray3); margin-bottom: 16px;
  }
  .vbs-footer-links {
    display: flex; flex-direction: column; gap: 10px;
  }
  .vbs-footer-link {
    font-size: 13px; color: var(--gray2);
    cursor: pointer; transition: color 0.15s;
    background: none; border: none; text-align: left;
    padding: 0; font-family: inherit; text-decoration: none;
  }
  .vbs-footer-link:hover { color: var(--white); }
  .vbs-footer-bottom {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 12px;
  }
  .vbs-footer-copy {
    font-size: 12px; color: var(--gray3);
  }
  .vbs-footer-legal {
    display: flex; align-items: center; gap: 20px;
  }
  .vbs-footer-legal-link {
    font-size: 12px; color: var(--gray3);
    cursor: pointer; transition: color 0.15s;
    background: none; border: none; font-family: inherit; padding: 0; text-decoration: none;
  }
  .vbs-footer-legal-link:hover { color: var(--gray2); }

  @media (max-width: 768px) {
    .vbs-footer { padding: 40px 16px 24px; }
    .vbs-footer-top {
      grid-template-columns: 1fr 1fr;
      gap: 32px;
    }
    .vbs-footer-brand { grid-column: 1 / -1; }
    .vbs-footer-brand-desc { max-width: 100%; }
    .vbs-footer-bottom { flex-direction: column; align-items: flex-start; gap: 10px; }
    .vbs-footer-legal { flex-wrap: wrap; gap: 12px; }
  }
  @media (max-width: 480px) {
    .vbs-footer-top { grid-template-columns: 1fr; }
  }


  /* ══════════════════════════════════════════════════
     PROFILE / ACCOUNT SCREEN
  ══════════════════════════════════════════════════ */
  .profile-screen {
    max-width: var(--app-max); margin: 0 auto;
    padding: calc(var(--nav-h) + 40px) 48px 80px;
    min-height: calc(100vh - var(--nav-h));
  }

  /* ── Hero card ───────────────────────────────────── */
  .profile-hero {
    display: flex; align-items: center; gap: 28px;
    background: var(--m-card);
    border: 1px solid var(--m-line);
    border-radius: 16px;
    padding: 32px 36px;
    margin-bottom: 40px;
    position: relative; overflow: hidden;
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    box-shadow: 0 22px 50px -24px rgba(0,0,0,0.6), inset 0 1px 0 rgba(220,200,141,0.06);
  }
  .profile-hero::before {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(135deg, rgba(220,200,141,0.10) 0%, transparent 60%);
    pointer-events: none;
  }
  .profile-avatar-big {
    width: 88px; height: 88px; border-radius: 12px;
    overflow: hidden; flex-shrink: 0;
    border: 2px solid rgba(220,200,141,0.4);
    position: relative; z-index: 1;
  }
  .profile-avatar-big img { width: 100%; height: 100%; object-fit: cover; }
  .profile-hero-info { flex: 1; position: relative; z-index: 1; }
  .profile-name {
    font-family: var(--m-display); font-size: 32px; font-weight: 800;
    text-transform: uppercase; letter-spacing: 0.01em; margin-bottom: 4px; color: #fff;
  }
  .profile-email { font-size: 14px; color: var(--gray2); margin-bottom: 16px; }
  .profile-badges { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
  .profile-badge {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12px; font-weight: 700; letter-spacing: 0.04em;
    padding: 5px 12px; border-radius: 20px;
  }
  .profile-badge.gold {
    background: rgba(220,200,141,0.15);
    color: var(--m-gold); border: 1px solid var(--m-line);
  }
  .profile-badge.silver {
    background: rgba(255,255,255,0.06);
    color: var(--gray1); border: 1px solid var(--border);
  }
  .profile-stats {
    display: flex; gap: 32px; margin-top: 0;
    position: relative; z-index: 1;
    padding-left: 4px;
  }
  .profile-stat { text-align: center; }
  .profile-stat-num {
    font-family: var(--m-display); font-size: 34px; font-weight: 800; letter-spacing: 0.01em;
    color: var(--m-gold); line-height: 1;
    margin-bottom: 4px;
  }
  .profile-stat-label { font-size: 11px; color: var(--gray3); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
  .profile-stat-divider {
    width: 1px; background: var(--border);
    align-self: stretch; margin: 4px 0;
  }

  /* ── Section headings ────────────────────────────── */
  .profile-section { margin-bottom: 40px; }
  .profile-section-header {
    display: flex; align-items: baseline; gap: 12px;
    margin-bottom: 20px;
  }
  .profile-section-title {
    font-family: var(--m-display); font-size: 24px; font-weight: 800;
    text-transform: uppercase; letter-spacing: 0.01em;
  }
  .profile-section-count {
    font-size: 13px; color: var(--gray3); font-weight: 500;
  }

  /* ── Owned courses grid ──────────────────────────── */
  .profile-courses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
  }
  .profile-course-card {
    border-radius: 8px; overflow: hidden;
    cursor: pointer; position: relative;
    transition: transform 0.18s;
  }
  .profile-course-card:hover { transform: scale(1.03); }
  .profile-course-thumb {
    aspect-ratio: 16/9;
    background: var(--bg3) center/cover no-repeat;
    position: relative;
  }
  .profile-course-thumb::after {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.75) 0%, transparent 55%);
  }
  .profile-course-progress-bar {
    position: absolute; bottom: 0; left: 0; right: 0;
    height: 2px; background: rgba(255,255,255,0.15); z-index: 2;
  }
  .profile-course-progress-fill {
    height: 100%; background: var(--m-gold); border-radius: 2px;
  }
  .profile-course-name {
    position: absolute; bottom: 8px; left: 10px; right: 10px;
    font-size: 11px; font-weight: 700;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    z-index: 2;
  }
  .profile-course-check {
    position: absolute; top: 8px; right: 8px; z-index: 2;
    width: 22px; height: 22px; border-radius: 50%;
    background: rgba(70,211,105,0.2);
    border: 1.5px solid #46d369;
    display: flex; align-items: center; justify-content: center;
    color: #46d369;
  }
  .profile-course-check svg { width: 11px; height: 11px; }

  /* ── Unlock section ──────────────────────────────── */
  .unlock-tabs {
    display: flex; gap: 4px; margin-bottom: 24px;
    background: var(--bg2); border-radius: 8px; padding: 4px;
    width: fit-content;
  }
  .unlock-tab {
    font-size: 13px; font-weight: 600;
    padding: 8px 18px; border-radius: 6px;
    cursor: pointer; color: var(--gray2);
    transition: all 0.15s; border: none; font-family: inherit;
  }
  .unlock-tab.active {
    background: var(--bg3); color: var(--white);
  }

  /* ── Individual locked courses ───────────────────── */
  .unlock-courses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
  }
  .unlock-course-card {
    background: var(--bg2); border: 1px solid var(--border);
    border-radius: 10px; overflow: hidden; cursor: pointer;
    transition: border-color 0.18s, transform 0.18s;
  }
  .unlock-course-card:hover {
    border-color: rgba(201,162,39,0.4);
    transform: translateY(-2px);
  }
  .unlock-course-thumb {
    aspect-ratio: 16/9;
    background: var(--bg3) center/cover no-repeat;
    position: relative;
  }
  .unlock-course-thumb-overlay {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.35);
    display: flex; align-items: center; justify-content: center;
  }
  .unlock-course-thumb-overlay svg { width: 20px; height: 20px; color: rgba(255,255,255,0.6); }
  .unlock-course-info { padding: 14px; }
  .unlock-course-cat { font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold); margin-bottom: 5px; }
  .unlock-course-name { font-size: 13px; font-weight: 700; margin-bottom: 10px; line-height: 1.3; }
  .unlock-course-price-row { display: flex; align-items: center; justify-content: space-between; }
  .unlock-course-price { font-size: 18px; font-weight: 800; letter-spacing: -0.02em; }
  .unlock-course-btn {
    font-size: 11px; font-weight: 700; letter-spacing: 0.04em;
    padding: 6px 12px; border-radius: 5px;
    background: var(--gold); color: #000;
    border: none; cursor: pointer; font-family: inherit;
    transition: background 0.15s;
  }
  .unlock-course-btn:hover { background: var(--gold2); }

  /* ── Packages grid ───────────────────────────────── */
  .unlock-packages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
  }
  .package-card {
    border-radius: 12px; overflow: hidden;
    border: 1px solid var(--border);
    cursor: pointer; position: relative;
    transition: border-color 0.18s, transform 0.18s;
    background: var(--bg2);
  }
  .package-card:hover { border-color: rgba(201,162,39,0.4); transform: translateY(-2px); }
  .package-card-header {
    padding: 24px 24px 20px;
    position: relative; overflow: hidden;
  }
  .package-card-bg {
    position: absolute; inset: 0;
    opacity: 0.12;
  }
  .package-emoji { font-size: 28px; margin-bottom: 10px; display: block; position: relative; z-index: 1; }
  .package-name { font-size: 18px; font-weight: 800; margin-bottom: 6px; position: relative; z-index: 1; }
  .package-desc { font-size: 13px; color: var(--gray2); line-height: 1.5; position: relative; z-index: 1; }
  .package-courses-preview {
    display: flex; gap: -8px;
    position: relative; z-index: 1; margin-top: 14px;
  }
  .package-thumb-mini {
    width: 40px; height: 24px; border-radius: 3px;
    background: var(--bg3) center/cover no-repeat;
    border: 1px solid rgba(0,0,0,0.3);
    margin-right: -6px;
  }
  .package-thumb-count {
    width: 40px; height: 24px; border-radius: 3px;
    background: var(--bg3); border: 1px solid rgba(255,255,255,0.1);
    display: flex; align-items: center; justify-content: center;
    font-size: 10px; font-weight: 700; color: var(--gray2);
  }
  .package-card-footer {
    padding: 16px 24px 20px;
    border-top: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
  }
  .package-price-col { display: flex; flex-direction: column; gap: 2px; }
  .package-price { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
  .package-price-original {
    font-size: 13px; color: var(--gray3);
    text-decoration: line-through;
    display: flex; align-items: center; gap: 8px;
  }
  .package-discount {
    text-decoration: none; font-size: 11px; font-weight: 700;
    background: rgba(201,162,39,0.15); color: var(--gold);
    padding: 2px 6px; border-radius: 3px;
  }
  .package-cta {
    padding: 10px 20px; border-radius: 6px;
    background: var(--gold); color: #000;
    font-size: 13px; font-weight: 800;
    border: none; cursor: pointer; font-family: inherit;
    transition: background 0.15s, transform 0.1s;
    white-space: nowrap;
  }
  .package-cta:hover { background: var(--gold2); transform: scale(1.02); }

  @media (max-width: 768px) {
    .profile-screen { padding: calc(var(--nav-h) + 24px) 16px 80px; }
    .profile-hero { flex-direction: column; align-items: flex-start; padding: 24px; gap: 16px; }
    .profile-stats { gap: 20px; }
    .profile-courses-grid { grid-template-columns: repeat(2, 1fr); }
    .unlock-courses-grid { grid-template-columns: repeat(2, 1fr); }
    .unlock-packages-grid { grid-template-columns: 1fr; }
    .profile-name { font-size: 20px; }
    .unlock-tab { padding: 7px 13px; font-size: 12px; }
  }


  /* ══════════════════════════════════════════════════
     USER POPUP MENU
  ══════════════════════════════════════════════════ */
  .user-popup {
    display: none;
    position: fixed;
    top: calc(var(--nav-h) + 8px);
    right: 24px;
    width: 264px;
    background: rgba(20,20,23,0.92);
    border: 1px solid rgba(220,200,141,0.18);
    border-radius: 16px;
    box-shadow: 0 24px 60px -18px rgba(0,0,0,0.7), 0 0 40px -20px rgba(220,200,141,0.18);
    -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
    z-index: 500;
    overflow: hidden;
    animation: popupIn 0.18s ease;
  }
  /* Hairline oro sul bordo superiore */
  .user-popup::before {
    content: ''; position: absolute; left: 28px; right: 28px; top: 0; height: 1px;
    background: linear-gradient(90deg, transparent, rgba(220,200,141,0.55), transparent);
  }
  .user-popup.open { display: block; }
  @keyframes popupIn {
    from { opacity: 0; transform: translateY(-8px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)    scale(1); }
  }
  .user-popup-header {
    display: flex; align-items: center; gap: 12px;
    padding: 18px 16px 14px;
    border-bottom: 1px solid rgba(220,200,141,0.12);
  }
  .user-popup-avatar {
    width: 42px; height: 42px; border-radius: 11px;
    overflow: hidden; flex-shrink: 0;
    border: 1px solid rgba(220,200,141,0.3);
  }
  .user-popup-avatar img { width: 100%; height: 100%; object-fit: cover; }
  .user-popup-name { font-size: 14px; font-weight: 700; line-height: 1.2; color: var(--white); }
  .user-popup-email { font-size: 11px; color: var(--gray3); margin-top: 2px; }
  .user-popup-items { padding: 6px 0; }
  .user-popup-item {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 16px;
    font-size: 14px; font-weight: 500; color: var(--gray1);
    cursor: pointer; transition: background 0.12s, color 0.12s;
    width: 100%; text-align: left;
    border: none; background: none; font-family: inherit;
  }
  .user-popup-item:hover { background: rgba(220,200,141,0.08); color: var(--white); }
  .user-popup-item svg { width: 17px; height: 17px; flex-shrink: 0; opacity: 0.65; transition: color 0.12s, opacity 0.12s; }
  .user-popup-item:hover svg { opacity: 1; color: var(--m-gold); }
  .user-popup-divider { height: 1px; background: rgba(220,200,141,0.12); margin: 4px 0; }
  .user-popup-item.danger { color: var(--gray3); }
  .user-popup-item.danger:hover { color: #ff5555; background: rgba(255,50,50,0.06); }
  .user-popup-item.danger:hover svg { color: #ff5555; }

  /* ══════════════════════════════════════════════════
     PAGAMENTI SCREEN
  ══════════════════════════════════════════════════ */
  .payment-screen {
    max-width: var(--app-max); margin: 0 auto;
    padding: calc(var(--nav-h) + 40px) 48px 80px;
  }
  #paymentsBody { max-width: 760px; }
  .payment-back {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 13px; color: var(--gray2); margin-bottom: 28px;
    cursor: pointer; background: none; border: none; font-family: inherit;
    transition: color 0.15s;
  }
  .payment-back:hover { color: var(--white); }
  .payment-back svg { width: 16px; height: 16px; }
  .payment-title { font-family: var(--m-display); font-size: 34px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.01em; margin-bottom: 6px; color: #fff; }
  .payment-sub { font-size: 14px; color: var(--gray2); margin-bottom: 36px; }

  .payment-cards { display: flex; flex-direction: column; gap: 10px; margin-bottom: 28px; }
  .payment-card-item {
    display: flex; align-items: center; gap: 16px;
    background: var(--bg2); border: 1px solid var(--border);
    border-radius: 10px; padding: 16px 20px;
    transition: border-color 0.15s;
  }
  .payment-card-item.active { border-color: var(--m-gold); }
  .payment-card-icon {
    width: 44px; height: 30px; border-radius: 5px;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 800; letter-spacing: 0.04em;
    flex-shrink: 0;
  }
  .payment-card-icon.visa { background: #1a1f71; color: #fff; }
  .payment-card-icon.mastercard { background: #eb001b; color: #fff; }
  .payment-card-info { flex: 1; }
  .payment-card-number { font-size: 14px; font-weight: 600; letter-spacing: 0.08em; }
  .payment-card-expiry { font-size: 12px; color: var(--gray3); margin-top: 2px; }
  .payment-card-default {
    font-size: 10px; font-weight: 700; letter-spacing: 0.06em;
    background: rgba(220,200,141,0.14); color: var(--m-gold);
    padding: 3px 8px; border-radius: 4px;
  }
  .payment-card-remove {
    color: var(--gray3); background: none; border: none; cursor: pointer;
    font-size: 18px; line-height: 1; padding: 4px;
    transition: color 0.15s;
  }
  .payment-card-remove:hover { color: #ff5555; }

  .payment-add-btn {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; padding: 14px;
    border: 1.5px dashed rgba(255,255,255,0.15); border-radius: 10px;
    background: none; color: var(--gray2); font-size: 14px; font-weight: 600;
    cursor: pointer; font-family: inherit;
    transition: border-color 0.15s, color 0.15s;
  }
  .payment-add-btn:hover { border-color: var(--m-gold); color: var(--m-gold); }
  .payment-add-btn svg { width: 18px; height: 18px; }

  /* Add card form */
  .payment-form {
    display: none; background: var(--bg2); border: 1px solid var(--border);
    border-radius: 12px; padding: 24px; margin-top: 16px;
  }
  .payment-form.open { display: block; }
  .payment-form-title { font-size: 15px; font-weight: 700; margin-bottom: 20px; }
  .payment-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
  .payment-form-field { display: flex; flex-direction: column; gap: 6px; }
  .payment-form-field.full { grid-column: 1/-1; }
  .payment-form-label { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--gray3); }
  .payment-form-input {
    background: var(--bg3); border: 1px solid var(--border); border-radius: 7px;
    padding: 11px 14px; color: var(--white); font-size: 14px; font-family: inherit;
    outline: none; transition: border-color 0.15s;
  }
  .payment-form-input:focus { border-color: rgba(220,200,141,0.55); }
  .payment-form-input::placeholder { color: var(--gray3); }
  .payment-form-actions { display: flex; gap: 10px; margin-top: 16px; }
  .payment-form-save {
    flex: 1; padding: 12px; background: linear-gradient(135deg,#e5d6a8,#DCC88D 50%,#B8A46E); color: #0E0E12;
    font-size: 14px; font-weight: 800; border-radius: 9px;
    border: none; cursor: pointer; font-family: inherit;
    transition: filter 0.15s;
  }
  .payment-form-save:hover { filter: brightness(1.05); }
  .payment-form-cancel {
    padding: 12px 20px; background: transparent; color: var(--gray2);
    font-size: 14px; font-weight: 600; border-radius: 7px;
    border: 1px solid var(--border); cursor: pointer; font-family: inherit;
    transition: border-color 0.15s, color 0.15s;
  }
  .payment-form-cancel:hover { border-color: rgba(255,255,255,0.3); color: var(--white); }

  /* ══════════════════════════════════════════════════
     INFO PERSONALI SCREEN
  ══════════════════════════════════════════════════ */
  .info-screen {
    max-width: var(--app-max); margin: 0 auto;
    padding: calc(var(--nav-h) + 40px) 48px 80px;
  }
  .info-avatar-section, .info-form { max-width: 640px; }
  .info-back {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 13px; color: var(--gray2); margin-bottom: 28px;
    cursor: pointer; background: none; border: none; font-family: inherit;
    transition: color 0.15s;
  }
  .info-back:hover { color: var(--white); }
  .info-back svg { width: 16px; height: 16px; }
  .info-title { font-family: var(--m-display); font-size: 34px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.01em; margin-bottom: 6px; color: #fff; }
  .info-sub { font-size: 14px; color: var(--gray2); margin-bottom: 36px; }

  .info-avatar-section {
    display: flex; align-items: center; gap: 20px;
    background: var(--m-card); border: 1px solid var(--m-line);
    border-radius: 16px; padding: 24px; margin-bottom: 24px;
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    box-shadow: 0 18px 40px -22px rgba(0,0,0,0.55), inset 0 1px 0 rgba(220,200,141,0.06);
  }
  .info-avatar-preview {
    width: 72px; height: 72px; border-radius: 10px;
    overflow: hidden; flex-shrink: 0; position: relative;
    border: 2px solid rgba(220,200,141,0.4);
  }
  .info-avatar-preview img { width: 100%; height: 100%; object-fit: cover; }
  .info-avatar-actions { flex: 1; }
  .info-avatar-name { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
  .info-avatar-hint { font-size: 12px; color: var(--gray3); margin-bottom: 12px; }
  .info-avatar-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; background: var(--bg3);
    border: 1px solid var(--border); border-radius: 7px;
    color: var(--gray1); font-size: 13px; font-weight: 600;
    cursor: pointer; font-family: inherit; transition: border-color 0.15s, color 0.15s;
  }
  .info-avatar-btn:hover { border-color: rgba(255,255,255,0.3); color: var(--white); }
  .info-avatar-btn svg { width: 14px; height: 14px; }

  .info-form { display: flex; flex-direction: column; gap: 14px; }
  .info-form-group {
    background: var(--m-card); border: 1px solid var(--m-line);
    border-radius: 16px; overflow: hidden;
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    box-shadow: 0 18px 40px -22px rgba(0,0,0,0.55), inset 0 1px 0 rgba(220,200,141,0.06);
  }
  .info-form-row {
    display: flex; align-items: center;
    padding: 16px 20px; border-bottom: 1px solid rgba(255,255,255,0.04);
  }
  .info-form-row:last-child { border-bottom: none; }
  .info-form-row-label {
    width: 140px; flex-shrink: 0;
    font-size: 12px; font-weight: 700; letter-spacing: 0.05em;
    text-transform: uppercase; color: var(--gray3);
  }
  .info-form-row-input {
    flex: 1; background: none; border: none;
    color: var(--white); font-size: 14px; font-family: inherit;
    outline: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.15s; padding: 2px 0;
  }
  .info-form-row-input:focus { border-color: var(--m-gold); }
  .info-form-row-input::placeholder { color: var(--gray3); }
  .info-save-btn {
    width: 100%; padding: 15px; background: linear-gradient(135deg,#e5d6a8,#DCC88D 50%,#B8A46E);
    color: #0E0E12; font-family: var(--m-display); text-transform: uppercase; letter-spacing: 0.04em;
    font-size: 18px; font-weight: 800;
    border-radius: 12px; border: none; cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s; margin-top: 8px;
    box-shadow: 0 8px 24px -8px rgba(220,200,141,0.55), 0 0 0 1px rgba(220,200,141,0.25);
  }
  .info-save-btn:hover { transform: translateY(-2px); box-shadow: 0 12px 32px -8px rgba(220,200,141,0.7), 0 0 0 1px rgba(220,200,141,0.4); }

  @media (max-width: 768px) {
    .user-popup { right: 12px; width: 240px; }
    .payment-screen, .info-screen { padding: calc(var(--nav-h) + 20px) 16px 80px; }
    .payment-form-row { grid-template-columns: 1fr; }
    .info-form-row { flex-direction: column; align-items: flex-start; gap: 8px; }
    .info-form-row-label { width: auto; }
  }


/* ══════════════════════════════════════════════════════════════════════════════
   VBS DESIGN SYSTEM — .vbs-* Component Library
   ══════════════════════════════════════════════════════════════════════════════
   Tokens: --gold #C9A227 · --gold2 #E8C84A · --bg/#bg2/#bg3 · --border ·
           --gray1/#gray2/#gray3 · --radius 6px · --gutter 48px · Inter
   Nessuna nuova semantica colore. Tutto deriva dai token esistenti.
   Importa i componenti JS: ui/modal.js (modale) · ui/toast.js (toast)
   ══════════════════════════════════════════════════════════════════════════════ */


/* ── .vbs-btn — Bottoni ────────────────────────────────────────────────────── */
.vbs-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: inherit; font-size: 14px; font-weight: 700;
  padding: 11px 22px; border-radius: var(--radius);
  border: none; cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.1s, opacity 0.15s;
  white-space: nowrap; line-height: 1.4;
}
.vbs-btn:disabled {
  opacity: 0.45; cursor: not-allowed; pointer-events: none;
}
.vbs-btn svg { width: 16px; height: 16px; flex-shrink: 0; }

/* Primary: gold bg, dark text */
.vbs-btn--primary {
  background: var(--gold); color: #000;
}
.vbs-btn--primary:hover {
  background: var(--gold2); transform: translateY(-1px);
}

/* Secondary: bordered, transparent bg */
.vbs-btn--secondary {
  background: transparent; color: var(--gray1);
  border: 1px solid var(--border);
}
.vbs-btn--secondary:hover {
  border-color: rgba(255,255,255,0.25); color: var(--white); background: rgba(255,255,255,0.04);
}

/* Ghost: no border, subtle hover */
.vbs-btn--ghost {
  background: transparent; color: var(--gray2);
  padding: 8px 14px;
}
.vbs-btn--ghost:hover {
  color: var(--white); background: rgba(255,255,255,0.06);
}

/* Danger variant for destructive actions */
.vbs-btn--danger {
  background: rgba(239,68,68,0.12); color: #ef4444;
  border: 1px solid rgba(239,68,68,0.2);
}
.vbs-btn--danger:hover {
  background: rgba(239,68,68,0.2); border-color: rgba(239,68,68,0.4);
}

/* Size modifiers */
.vbs-btn--sm { font-size: 12px; padding: 7px 14px; }
.vbs-btn--sm svg { width: 14px; height: 14px; }
.vbs-btn--lg { font-size: 16px; font-weight: 800; padding: 14px 28px; }
.vbs-btn--lg svg { width: 18px; height: 18px; }
.vbs-btn--block { width: 100%; }

/* Loading state */
.vbs-btn--loading {
  position: relative; color: transparent !important; pointer-events: none;
}
.vbs-btn--loading::after {
  content: ''; position: absolute;
  width: 16px; height: 16px;
  border: 2px solid currentColor; border-top-color: transparent;
  border-radius: 50%;
  animation: vbs-spin 0.6s linear infinite;
}
@keyframes vbs-spin { to { transform: rotate(360deg); } }


/* ── .vbs-input / .vbs-textarea / .vbs-select — Form Controls ──────────────── */
.vbs-input, .vbs-textarea, .vbs-select {
  width: 100%;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--white);
  font-family: inherit; font-size: 14px;
  padding: 11px 14px;
  outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
.vbs-input:focus, .vbs-textarea:focus, .vbs-select:focus {
  border-color: rgba(201,162,39,0.5);
  box-shadow: 0 0 0 3px rgba(201,162,39,0.08);
}
.vbs-input::placeholder, .vbs-textarea::placeholder { color: var(--gray3); }
.vbs-input:disabled, .vbs-textarea:disabled, .vbs-select:disabled {
  opacity: 0.5; cursor: not-allowed;
}
.vbs-textarea { resize: vertical; min-height: 88px; line-height: 1.6; }
.vbs-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23555' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  padding-right: 36px;
}

/* Error state */
.vbs-input--error, .vbs-textarea--error, .vbs-select--error {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 3px rgba(239,68,68,0.08) !important;
}

/* Label */
.vbs-label {
  display: block; font-size: 12px; font-weight: 700;
  letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--gray3); margin-bottom: 6px;
}
.vbs-label--required::after {
  content: ' *'; color: #ef4444;
}

/* Field group */
.vbs-field { margin-bottom: 16px; }
.vbs-field-error {
  font-size: 12px; color: #ef4444; margin-top: 4px;
  display: none;
}
.vbs-field.has-error .vbs-field-error { display: block; }
.vbs-field.has-error .vbs-input,
.vbs-field.has-error .vbs-textarea,
.vbs-field.has-error .vbs-select { border-color: #ef4444; }


/* ── .vbs-card — Unified Card ──────────────────────────────────────────────── */
.vbs-card {
  background: var(--m-card);
  border: 1px solid var(--m-line);
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  box-shadow: 0 18px 40px -22px rgba(0,0,0,0.55), inset 0 1px 0 rgba(220,200,141,0.06);
  transition: border-color 0.18s, transform 0.18s, box-shadow 0.18s;
}
.vbs-card::before {
  content: ''; position: absolute; left: 32px; right: 32px; top: 0; height: 1px; z-index: 1;
  background: linear-gradient(90deg, transparent, rgba(220,200,141,0.5), transparent);
}
.vbs-card--interactive {
  cursor: pointer;
}
.vbs-card--interactive:hover {
  border-color: rgba(220,200,141,0.45);
  transform: translateY(-2px);
  box-shadow: 0 26px 52px -20px rgba(0,0,0,0.7), 0 0 44px -26px rgba(220,200,141,0.28);
}
.vbs-card__header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--m-line);
}
.vbs-card__body {
  padding: 20px 24px;
}
.vbs-card__footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
}


/* ── .vbs-modal — Generic Modal ───────────────────────────────────────────── */
.vbs-modal-overlay {
  position: fixed; inset: 0; z-index: 600;
  background: rgba(0,0,0,0.72); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; transition: opacity 0.2s;
  pointer-events: none;
}
.vbs-modal-overlay.open {
  opacity: 1; pointer-events: auto;
}
.vbs-modal {
  background: #0f0f0f; border: 1px solid #262626;
  border-radius: 14px;
  width: 100%; max-width: 480px; max-height: 90vh;
  overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 24px 60px rgba(0,0,0,0.6);
  transform: scale(0.96) translateY(8px);
  transition: transform 0.2s ease;
}
.vbs-modal-overlay.open .vbs-modal {
  transform: scale(1) translateY(0);
}
.vbs-modal--sm { max-width: 360px; }
.vbs-modal--lg { max-width: 640px; }
.vbs-modal--xl { max-width: 800px; }

.vbs-modal__head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 20px; border-bottom: 1px solid #1f1f1f;
}
.vbs-modal__title {
  font-size: 16px; font-weight: 700; flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.vbs-modal__close {
  color: var(--gray2); font-size: 18px; line-height: 1;
  padding: 6px 8px; border-radius: 6px;
  cursor: pointer; background: none; border: none;
  transition: color 0.15s, background 0.15s;
}
.vbs-modal__close:hover {
  color: var(--white); background: #1f1f1f;
}
.vbs-modal__body {
  padding: 20px; overflow-y: auto; flex: 1;
}
.vbs-modal__footer {
  padding: 16px 20px; border-top: 1px solid #1f1f1f;
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
}


/* ── .vbs-badge — Status Badges ────────────────────────────────────────────── */
.vbs-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em;
  padding: 3px 10px; border-radius: 20px;
  line-height: 1.4;
}
.vbs-badge svg { width: 12px; height: 12px; }

.vbs-badge--success {
  background: rgba(70,211,105,0.12); color: #46d369;
  border: 1px solid rgba(70,211,105,0.25);
}
.vbs-badge--warn {
  background: rgba(217,119,6,0.12); color: #f59e0b;
  border: 1px solid rgba(217,119,6,0.25);
}
.vbs-badge--danger {
  background: rgba(239,68,68,0.12); color: #ef4444;
  border: 1px solid rgba(239,68,68,0.25);
}
.vbs-badge--info {
  background: rgba(37,99,235,0.12); color: #60a5fa;
  border: 1px solid rgba(37,99,235,0.25);
}
.vbs-badge--gold {
  background: rgba(220,200,141,0.15); color: var(--m-gold);
  border: 1px solid rgba(220,200,141,0.3);
}
.vbs-badge--neutral {
  background: rgba(255,255,255,0.06); color: var(--gray1);
  border: 1px solid var(--border);
}


/* ── .vbs-progress — Progress Bar ──────────────────────────────────────────── */
.vbs-progress {
  width: 100%; height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px; overflow: hidden;
}
.vbs-progress__fill {
  height: 100%; border-radius: 3px;
  background: var(--gold);
  transition: width 0.4s ease;
}
.vbs-progress--sm { height: 3px; }
.vbs-progress--lg { height: 10px; border-radius: 5px; }
.vbs-progress--lg .vbs-progress__fill { border-radius: 5px; }
.vbs-progress--success .vbs-progress__fill { background: #46d369; }
.vbs-progress--danger .vbs-progress__fill { background: #ef4444; }

/* Indeterminate / pulsing */
.vbs-progress--indeterminate .vbs-progress__fill {
  width: 40% !important;
  animation: vbs-progress-slide 1.5s ease-in-out infinite;
}
@keyframes vbs-progress-slide {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}


/* ── .vbs-skeleton — Loading Placeholders ──────────────────────────────────── */
.vbs-skeleton {
  background: linear-gradient(90deg, var(--bg3) 25%, #2a2a2a 50%, var(--bg3) 75%);
  background-size: 200% 100%;
  animation: vbs-shimmer 1.5s ease infinite;
  border-radius: var(--radius);
}
@keyframes vbs-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.vbs-skeleton--text   { height: 14px; width: 80%; margin-bottom: 8px; border-radius: 4px; }
.vbs-skeleton--title  { height: 22px; width: 60%; margin-bottom: 12px; border-radius: 4px; }
.vbs-skeleton--avatar { width: 40px; height: 40px; border-radius: 50%; }
.vbs-skeleton--thumb  { width: 100%; aspect-ratio: 16/9; border-radius: var(--radius); }
.vbs-skeleton--card   { height: 160px; border-radius: 12px; }
.vbs-skeleton--btn    { height: 42px; width: 140px; border-radius: var(--radius); }


/* ── .vbs-empty-state — Empty/No Content States ────────────────────────────── */
.vbs-empty-state {
  display: flex; flex-direction: column; align-items: center;
  text-align: center; padding: 48px 24px;
}
.vbs-empty-state__icon {
  width: 76px; height: 76px; border-radius: 18px;
  background: rgba(220,200,141,0.10);
  border: 1px solid rgba(220,200,141,0.22);
  color: var(--m-gold);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 22px;
}
.vbs-empty-state__icon svg { width: 30px; height: 30px; }
.vbs-empty-state__title {
  font-family: var(--m-display); font-size: 22px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.01em; color: #fff; margin-bottom: 8px;
}
.vbs-empty-state__desc {
  font-size: 14px; color: var(--gray2); line-height: 1.6;
  max-width: 360px; margin-bottom: 22px;
}
.vbs-empty-state__action {
  margin-top: 4px;
}


/* ── .vbs-wizard — Multi-Step Wizard ───────────────────────────────────────── */
.vbs-wizard {
  display: flex; align-items: center; gap: 0;
  padding: 0 0 24px;
}
.vbs-wizard__step {
  display: flex; align-items: center; gap: 10px;
  flex: 1; position: relative;
}
.vbs-wizard__step:not(:last-child)::after {
  content: ''; flex: 1; height: 2px;
  background: var(--border); margin: 0 12px;
}
.vbs-wizard__step.done:not(:last-child)::after {
  background: var(--gold);
}
.vbs-wizard__dot {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--bg3); border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: var(--gray3);
  flex-shrink: 0; transition: all 0.2s;
}
.vbs-wizard__step.active .vbs-wizard__dot {
  background: rgba(201,162,39,0.15); border-color: var(--gold); color: var(--gold);
}
.vbs-wizard__step.done .vbs-wizard__dot {
  background: var(--gold); border-color: var(--gold); color: #000;
}
.vbs-wizard__label {
  font-size: 12px; font-weight: 600; color: var(--gray3);
  white-space: nowrap;
}
.vbs-wizard__step.active .vbs-wizard__label { color: var(--white); }
.vbs-wizard__step.done .vbs-wizard__label { color: var(--gold); }

@media (max-width: 768px) {
  .vbs-wizard { gap: 0; }
  .vbs-wizard__label { display: none; }
  .vbs-wizard__step:not(:last-child)::after { margin: 0 6px; }
}


/* ── .vbs-stream — Streaming Output Display ────────────────────────────────── */
.vbs-stream {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 10px; padding: 20px;
  font-size: 14px; line-height: 1.7; color: var(--gray1);
  white-space: pre-wrap; word-break: break-word;
  max-height: 500px; overflow-y: auto;
  position: relative;
}
.vbs-stream--empty {
  color: var(--gray3); font-style: italic;
}
/* Blinking cursor animation while streaming */
.vbs-stream--typing::after {
  content: '▌'; color: var(--gold);
  animation: vbs-blink 0.8s step-end infinite;
}
@keyframes vbs-blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0; }
}
/* Copy button floating in top-right */
.vbs-stream__copy {
  position: absolute; top: 10px; right: 10px;
  opacity: 0; transition: opacity 0.15s;
}
.vbs-stream:hover .vbs-stream__copy { opacity: 1; }


/* ── .vbs-toast — Toast Notifications (enhanced) ──────────────────────────── */
.vbs-toast-container {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%);
  display: flex; flex-direction: column-reverse; gap: 8px;
  z-index: 700; pointer-events: none;
  max-width: min(90vw, 420px); width: 100%;
}
.vbs-toast {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--white); font-size: 13px; font-weight: 500;
  padding: 12px 16px; border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  pointer-events: auto;
  opacity: 0; transform: translateY(12px);
  transition: opacity 0.25s, transform 0.25s;
}
.vbs-toast.show {
  opacity: 1; transform: translateY(0);
}
.vbs-toast__icon {
  width: 18px; height: 18px; flex-shrink: 0;
}
.vbs-toast__text { flex: 1; line-height: 1.4; }
.vbs-toast__action {
  flex-shrink: 0;
  font-size: 12px; font-weight: 700;
  color: var(--gold); cursor: pointer;
  background: none; border: none; font-family: inherit;
  padding: 4px 8px; border-radius: 4px;
  transition: background 0.15s;
}
.vbs-toast__action:hover {
  background: rgba(201,162,39,0.12);
}
.vbs-toast__dismiss {
  flex-shrink: 0;
  color: var(--gray3); cursor: pointer;
  background: none; border: none; font-size: 16px; line-height: 1;
  padding: 2px 4px; transition: color 0.15s;
}
.vbs-toast__dismiss:hover { color: var(--white); }

/* Toast variants via left border accent */
.vbs-toast--success { border-left: 3px solid #46d369; }
.vbs-toast--error   { border-left: 3px solid #ef4444; }
.vbs-toast--warning { border-left: 3px solid #f59e0b; }
.vbs-toast--info    { border-left: 3px solid #60a5fa; }


/* ── Utility / Layout ──────────────────────────────────────────────────────── */
.vbs-divider {
  height: 1px; background: var(--border);
  margin: 16px 0;
}
.vbs-sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); border: 0;
}
.vbs-truncate {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.vbs-flex { display: flex; }
.vbs-flex--col { flex-direction: column; }
.vbs-flex--center { align-items: center; justify-content: center; }
.vbs-flex--between { justify-content: space-between; }
.vbs-gap-sm { gap: 8px; }
.vbs-gap-md { gap: 16px; }
.vbs-gap-lg { gap: 24px; }


/* ── Tool Workspace ────────────────────────────────────────────────────────── */
.tw-container { max-width: var(--app-max); margin: 0 auto; padding: calc(var(--nav-h) + 40px) var(--gutter) 80px; }
.tw-header { margin-bottom: 24px; }
.tw-back {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--gray2); margin-bottom: 16px;
  cursor: pointer; background: none; border: none; font-family: inherit;
  text-decoration: none; padding: 0;
}
.tw-back:hover { color: var(--gray1); }
.tw-title-row {
  display: flex; align-items: flex-start; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
}
.tw-title {
  font-size: 28px; font-weight: 900; letter-spacing: -0.02em;
  margin: 0 0 4px;
}
.tw-subtitle { font-size: 14px; color: var(--gray2); margin: 0; }
.tw-credit-badge {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--gray2);
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 14px; flex-shrink: 0;
}
.tw-credit-badge strong { color: var(--gold); }

.tw-form-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 14px; padding: 28px;
}
.tw-form-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}
.tw-field-full { grid-column: 1 / -1; }
.tw-field-hint {
  font-size: 12px; color: var(--gray3); margin-top: 4px;
}
.tw-form-footer {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px; margin-top: 20px;
  padding-top: 16px; border-top: 1px solid var(--border);
}
.tw-cost-estimate { display: flex; align-items: center; gap: 6px; }

/* Output area */
.tw-output {
  margin-top: 24px; background: var(--bg2); border: 1px solid var(--border);
  border-radius: 14px; overflow: hidden;
}
.tw-output-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px; border-bottom: 1px solid var(--border);
}
.tw-output-header h3 { font-size: 15px; font-weight: 700; margin: 0; }
.tw-output-actions { display: flex; align-items: center; gap: 10px; }
.tw-output-content {
  padding: 24px; font-size: 14px; line-height: 1.7; color: var(--gray1);
  max-height: 500px; overflow-y: auto;
}
.tw-output-content p { margin-bottom: 12px; }
.tw-output-content strong { color: var(--gold); }
.tw-output-error {
  padding: 40px; text-align: center; color: #f87171; font-size: 14px;
}
.tw-output-empty {
  padding: 40px; text-align: center; font-size: 14px;
}
.tw-profile-info {
  padding: 12px 24px;
  background: rgba(201,162,39,0.06);
  border-bottom: 1px solid var(--border);
  font-size: 13px; color: var(--gray2);
}
.tw-profile-info strong {
  color: var(--gold); font-weight: 700;
}

/* Ebook layout */
.tw-ebook-layout {
  display: grid; grid-template-columns: 1fr 280px; gap: 24px; align-items: start;
}
.tw-ebook-sidebar {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 14px; padding: 20px;
}
.tw-job-card { cursor: pointer; transition: border-color 0.15s; }
.tw-job-card:hover { border-color: var(--gold) !important; }

/* Summary */
.tw-summary {
  background: var(--bg3); border-radius: 10px; padding: 16px; margin-bottom: 16px;
}
.tw-summary-row {
  display: flex; gap: 10px; padding: 6px 0;
  font-size: 14px; line-height: 1.5;
}
.tw-summary-row + .tw-summary-row { border-top: 1px solid var(--border); }
.tw-summary-label {
  font-weight: 600; color: var(--gray2); min-width: 90px; flex-shrink: 0;
}
.tw-cost-summary {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--gray2);
  background: rgba(201,162,39,0.08); border: 1px solid rgba(201,162,39,0.2);
  border-radius: 8px; padding: 12px 16px;
}
.tw-cost-summary strong { color: var(--gold); }

/* Chapter card + regenerate */
.tw-chapter-card { transition: border-color 0.15s; }
.tw-chapter-card:hover { border-color: var(--border); }
.tw-chapter-card .tw-regen-btn { opacity: 0.5; transition: opacity 0.15s; }
.tw-chapter-card:hover .tw-regen-btn { opacity: 1; }

/* Color swatches for cover info */
.tw-color-swatch {
  display: inline-block; width: 18px; height: 18px;
  border-radius: 4px; border: 1px solid var(--border);
  vertical-align: middle;
}

/* ── Mobile adjustments for Design System ──────────────────────────────────── */
@media (max-width: 768px) {
  .vbs-modal { max-width: 100%; border-radius: 12px; }
  .vbs-modal--lg, .vbs-modal--xl { max-width: 100%; }
  .vbs-modal__head { padding: 14px 16px; }
  .vbs-modal__body { padding: 16px; }
  .vbs-modal__footer { padding: 12px 16px; }
  .vbs-card__header, .vbs-card__body { padding: 16px; }
  .vbs-card__footer { padding: 12px 16px; }
  .vbs-toast-container { bottom: 16px; left: 16px; right: 16px; transform: none; max-width: 100%; }
  .vbs-empty-state { padding: 32px 16px; }
  .tw-form-grid { grid-template-columns: 1fr; }
  .tw-ebook-layout { grid-template-columns: 1fr; }
  .tw-title { font-size: 22px; }
  .tw-form-card { padding: 20px 16px; }
  .tw-container { padding: calc(var(--nav-h) + 24px) 16px 60px; }
}


/* ═══════════════════════════════════════════════════════════════════════════ */
/*  AI Studio — Tool Studios (Phase 6.1)                                     */
/* ═══════════════════════════════════════════════════════════════════════════ */

/* ── Studio Layout — Sidebar + Main ────────────────────────────────────── */
.studio-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 0;
  min-height: 100vh;
}
.studio-sidebar {
  background: var(--bg2);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  overflow-y: auto;
  max-height: calc(100vh - var(--nav-h));
  position: sticky;
  top: var(--nav-h);
}
.studio-main {
  padding: calc(var(--nav-h) + 32px) 6vw 80px;
  max-width: none;
  min-width: 0;
}

/* ── Section Sub-headings (so-h2/h3/h4) ───────────────────────────────── */
.so-h2 { font-size: 20px; font-weight: 800; letter-spacing: -0.01em; margin: 0 0 16px; }
.so-h3 { font-size: 16px; font-weight: 700; margin: 0 0 10px; color: var(--gray1); }
.so-h4 { font-size: 14px; font-weight: 600; margin: 0 0 8px; color: var(--gray2); }


/* ── Reel Selection Grid ──────────────────────────────────────────────── */
.reel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.reel-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.reel-card:hover {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold);
}
.reel-card-select {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
}
.reel-check {
  width: 20px; height: 20px;
  accent-color: var(--gold);
  cursor: pointer;
}
.reel-card-body {
  padding: 10px 12px;
}
.reel-card-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  font-size: 12px;
  color: var(--gray2);
  margin-bottom: 6px;
}
.reel-card-metrics span {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.reel-card-caption {
  font-size: 13px;
  color: var(--gray1);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.reel-count-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray2);
  margin-bottom: 8px;
}


/* ── Variant Cards (Script output) ────────────────────────────────────── */
.variant-cards {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.variant-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  transition: border-color 0.15s;
}
.variant-card:hover {
  border-color: rgba(201,162,39,0.3);
}
.variant-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg3);
}
.variant-card-header h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}
.variant-edit {
  min-height: 120px;
  border: none;
  border-radius: 0;
  background: var(--bg2);
}

/* ── Variant Cards Final (structured output) ──────────────── */
.variant-cards-final {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.variant-card-final {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.variant-card-final:hover {
  border-color: rgba(201,162,39,0.5);
  box-shadow: 0 2px 12px rgba(201,162,39,0.08);
}
.variant-card-final .variant-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg3);
  flex-wrap: wrap;
  gap: 8px;
}
.variant-card-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.variant-card-title-row h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.variant-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.variant-card-model {
  padding: 8px 18px;
  font-size: 12px;
  color: var(--gray2);
  border-bottom: 1px solid var(--border);
  background: rgba(201,162,39,0.04);
}
.variant-card-model-label {
  font-weight: 600;
  color: var(--gray3);
}
.variant-card-hook {
  padding: 10px 18px;
  font-size: 13px;
  line-height: 1.5;
  background: rgba(232,200,74,0.06);
  border-bottom: 1px solid var(--border);
  color: var(--gray1);
}
.variant-card-hook strong {
  color: var(--gold);
}
.variant-card-script {
  padding: 18px;
  font-size: 14px;
  line-height: 1.75;
  color: var(--gray1);
}
.variant-card-script p {
  margin-bottom: 10px;
}
.variant-card-script strong {
  color: var(--gold);
}
.variant-card-delivery {
  padding: 10px 18px;
  font-size: 12px;
  color: var(--gray2);
  border-top: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
}
.variant-card-delivery strong {
  color: var(--gray3);
}
.variant-refine-inline {
  padding: 12px 18px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg3);
}
.variant-refine-inline .vbs-textarea {
  min-height: 60px;
}
@media (max-width: 640px) {
  .variant-card-final .variant-card-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .variant-card-actions {
    width: 100%;
    justify-content: flex-end;
  }
  .variant-card-script {
    padding: 14px;
    font-size: 13px;
  }
}

/* ── Ebook Studio Tabs ────────────────────────────────────────────────── */
.es-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
}
.es-tab {
  padding: 12px 20px;
  font-weight: 600;
  font-size: 14px;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  cursor: pointer;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  color: var(--gray2);
  margin-bottom: -2px;
}
.es-tab:hover {
  color: var(--gray1);
}
.es-tab--active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}
.es-tab--disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.es-tab--disabled:hover {
  color: var(--gray2);
}

/* Ebook color picker input */
.es-color-input {
  width: 36px;
  height: 36px;
  border: 2px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  padding: 2px;
  background: var(--bg3);
  -webkit-appearance: none;
  appearance: none;
}
.es-color-input::-webkit-color-swatch-wrapper { padding: 0; }
.es-color-input::-webkit-color-swatch {
  border: none;
  border-radius: 4px;
}
.es-color-input::-moz-color-swatch {
  border: none;
  border-radius: 4px;
}


/* ── Cover Grid (cg-*) ────────────────────────────────────────────────── */
.cg-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.cg-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray2);
}
.cg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}
.cg-card {
  position: relative;
  background: var(--bg2);
  border: 2px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.2s;
}
.cg-card:hover {
  border-color: rgba(201,162,39,0.4);
}
.cg-card--selected {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(201,162,39,0.25);
}
.cg-card--disabled {
  opacity: 0.45;
  pointer-events: none;
}
.cg-img-wrap {
  position: relative;
  aspect-ratio: 2/3;
  overflow: hidden;
  background: var(--bg3);
}
.cg-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.cg-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 8px;
  opacity: 0;
  transition: opacity 0.15s;
  background: linear-gradient(180deg, rgba(0,0,0,0.5) 0%, transparent 40%);
}
.cg-card:hover .cg-overlay,
.cg-card--selected .cg-overlay {
  opacity: 1;
}
.cg-check {
  display: flex;
  align-items: center;
  cursor: pointer;
  gap: 0;
}
.cg-check input {
  width: 18px; height: 18px;
  accent-color: var(--gold);
  cursor: pointer;
}
.cg-check-mark {
  /* Hidden visually — checkbox is the interactive element */
  display: none;
}
.cg-zoom-btn {
  background: rgba(0,0,0,0.6);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 16px;
  cursor: pointer;
  color: #fff;
  line-height: 1;
  transition: background 0.15s;
}
.cg-zoom-btn:hover {
  background: rgba(0,0,0,0.8);
}
.cg-label {
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray2);
  text-align: center;
}


/* ── Font Picker (fp-*) ───────────────────────────────────────────────── */
.fp-container {
  position: relative;
}
.fp-search-wrap {
  position: relative;
}
.fp-search {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--white);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}
.fp-search:focus {
  border-color: var(--gold);
}
.fp-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 200px;
  overflow-y: auto;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  z-index: 50;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.fp-option {
  padding: 8px 14px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.1s;
  color: var(--gray1);
}
.fp-option:hover {
  background: var(--bg3);
}
.fp-option--selected {
  background: rgba(201,162,39,0.12);
  color: var(--gold);
  font-weight: 600;
}
.fp-empty {
  padding: 12px 14px;
  font-size: 13px;
  color: var(--gray3);
  font-style: italic;
}
.fp-preview {
  margin-top: 10px;
  padding: 14px;
  background: var(--bg3);
  border-radius: var(--radius);
  text-align: center;
}
.fp-preview-text {
  font-size: 20px;
  line-height: 1.3;
  color: var(--white);
  transition: font-family 0.2s;
}


/* ── Session Sidebar (ss-*) ───────────────────────────────────────────── */
.ss-sidebar {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.ss-sidebar--collapsed .ss-body {
  display: none;
}
.ss-sidebar--collapsed .ss-title {
  display: none;
}
.ss-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.ss-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  color: var(--gray2);
  transition: color 0.15s, border-color 0.15s;
}
.ss-toggle:hover {
  color: var(--gold);
  border-color: var(--gold);
}
.ss-title {
  font-size: 15px;
  font-weight: 700;
  margin: 0;
  color: var(--white);
}
.ss-body {
  flex: 1;
  overflow-y: auto;
}
.ss-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ss-item {
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.1s, border-color 0.15s;
}
.ss-item:hover {
  background: var(--bg3);
}
.ss-item--active {
  background: rgba(201,162,39,0.1);
  border-color: var(--gold) !important;
}
.ss-item-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--white);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ss-item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ss-item-date {
  font-size: 11px;
  color: var(--gray3);
}


/* ── Step Wizard — Studio Enhancements ────────────────────────────────── */
.vbs-wizard--studio {
  padding: 0 0 28px;
}

/* Dot states for running/awaiting_input/failed */
.sw-dot--running {
  background: rgba(201,162,39,0.2) !important;
  border-color: var(--gold) !important;
  color: var(--gold) !important;
  animation: sw-pulse-gold 1.5s ease-in-out infinite;
}
.sw-dot--awaiting_input {
  background: rgba(59,130,246,0.2) !important;
  border-color: #3b82f6 !important;
  color: #3b82f6 !important;
  animation: sw-pulse-blue 1.5s ease-in-out infinite;
}
.sw-dot--failed {
  background: rgba(239,68,68,0.2) !important;
  border-color: #ef4444 !important;
  color: #ef4444 !important;
}
.sw-dot--done {
  background: var(--gold) !important;
  border-color: var(--gold) !important;
  color: #000 !important;
}
.sw-dot--pending {
  /* Default — no overrides needed */
}

/* Spinner inside running dot */
.sw-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid transparent;
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: sw-spin 0.7s linear infinite;
}

/* Connector line done state */
.sw-conn--done {
  background: var(--gold) !important;
}

/* Pulse keyframes */
@keyframes sw-pulse-gold {
  0%, 100% { box-shadow: 0 0 0 0 rgba(201,162,39,0.4); }
  50%      { box-shadow: 0 0 0 6px rgba(201,162,39,0); }
}
@keyframes sw-pulse-blue {
  0%, 100% { box-shadow: 0 0 0 0 rgba(59,130,246,0.4); }
  50%      { box-shadow: 0 0 0 6px rgba(59,130,246,0); }
}
@keyframes sw-spin {
  to { transform: rotate(360deg); }
}

/* Awaiting input highlight on wizard label */
.sw-awaiting .vbs-wizard__label {
  color: #3b82f6;
}
.sw-running .vbs-wizard__label {
  color: var(--gold);
}
.sw-failed .vbs-wizard__label {
  color: #ef4444;
}


/* ── SSE Stream — Typing Animation Enhancement ────────────────────────── */
/* (base .vbs-stream--typing::after already exists — this adds cursor blink) */
.vbs-stream--typing {
  position: relative;
}


/* ── Responsive — Studio Mobile ───────────────────────────────────────── */
@media (max-width: 768px) {
  .studio-layout {
    grid-template-columns: 1fr;
  }
  .studio-sidebar {
    display: none;
  }
  .studio-main {
    padding: calc(var(--nav-h) + 20px) 16px 60px;
  }
  .reel-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 8px;
  }
  .cg-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
  }
  .variant-card-header {
    padding: 10px 12px;
  }
  .es-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .es-tab {
    padding: 10px 14px;
    font-size: 13px;
    white-space: nowrap;
  }
  .fp-dropdown {
    max-height: 160px;
  }
}

/* ═══════════════════════════════════════════════════════════════
   PHASE 6.2 — Credits Dashboard + Nav Pill + Mega-menu + Resume
   ═══════════════════════════════════════════════════════════════ */

/* ── Nav Credit Pill ─────────────────────────────────────────── */
.credits-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 13px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(220,200,141,0.16), rgba(220,200,141,0.06));
  border: 1px solid rgba(220,200,141,0.3);
  color: var(--m-gold);
  font-family: var(--m-display);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.credits-pill:hover {
  background: linear-gradient(135deg, rgba(220,200,141,0.26), rgba(220,200,141,0.12));
  border-color: var(--m-gold);
  box-shadow: 0 6px 18px -8px rgba(220,200,141,0.5);
}
.credits-pill svg {
  color: var(--m-gold);
}

/* ── Nav Mega-menu ───────────────────────────────────────────── */
.nav-link--has-menu {
  position: relative;
}
.nav-mega {
  display: none;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 8px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  min-width: 340px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  z-index: 500;
  gap: 12px;
}
/* Ponte invisibile che copre il gap di 8px (margin-top) tra il trigger "Tools" e
   il pannello: senza, spostando il mouse verso il menu si perde l'hover e si chiude. */
.nav-mega::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 0;
  right: 0;
  height: 10px;
}
.nav-link--has-menu:hover .nav-mega,
.nav-link--has-menu:focus-within .nav-mega {
  display: flex;
  flex-direction: column;
}
.nav-mega-section {
  padding: 0;
}
.nav-mega-section + .nav-mega-section {
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-top: 2px;
}
.nav-mega-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gray3);
  margin-bottom: 8px;
}
.nav-mega-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
  text-decoration: none;
  color: inherit;
}
.nav-mega-item:hover {
  background: rgba(255,255,255,0.05);
}
.nav-mega-icon {
  font-size: 20px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.nav-mega-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray1);
}
.nav-mega-desc {
  font-size: 11px;
  color: var(--gray3);
  margin-top: 1px;
}

/* ── Paused Jobs Banner ──────────────────────────────────────── */
.vbs-paused-banner {
  position: fixed;
  top: var(--nav-h, 60px);
  left: 0;
  right: 0;
  z-index: 200;
  background: linear-gradient(90deg, #3b2a00 0%, #1a1a1a 100%);
  border-bottom: 1px solid var(--gold);
  animation: vbs-banner-slide 0.3s ease;
}
@keyframes vbs-banner-slide {
  from { transform: translateY(-100%); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}
.vbs-paused-banner-inner {
  max-width: var(--app-max, 1320px);
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.vbs-paused-banner-icon {
  font-size: 18px;
  flex-shrink: 0;
}
.vbs-paused-banner-msg {
  flex: 1;
  font-size: 13px;
  color: var(--gray1);
  min-width: 200px;
}
.vbs-paused-banner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.vbs-paused-banner-close {
  background: none;
  border: none;
  color: var(--gray3);
  font-size: 20px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.vbs-paused-banner-close:hover {
  color: var(--gray1);
}

/* ── Credits Dashboard ───────────────────────────────────────── */
.cd-header {
  margin-bottom: 24px;
}
.cd-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--gray2);
  margin-bottom: 12px;
  cursor: pointer;
  background: none;
  border: none;
}
.cd-back:hover {
  color: var(--gold);
}
.cd-title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}
.cd-sub {
  font-size: 14px;
  color: var(--gray2);
}
.cd-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.cd-tab {
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  color: var(--gray3);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}
.cd-tab:hover {
  color: var(--gray1);
}
.cd-tab--active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}
.cd-content {
  min-height: 200px;
}

/* Saldo tab */
.cd-saldo {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.cd-avail-card {
  text-align: center;
  padding: 28px 20px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.cd-avail-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray3);
  margin-bottom: 6px;
}
.cd-avail-value {
  font-size: 42px;
  font-weight: 800;
  color: var(--gold);
  letter-spacing: -0.03em;
}
.cd-avail-held {
  font-size: 12px;
  color: var(--gray3);
  margin-top: 6px;
}
.cd-breakdown {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.cd-kind-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}
.cd-kind-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.cd-kind-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.cd-kind-name {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray2);
}
.cd-kind-expires {
  margin-left: auto;
  font-size: 11px;
  color: #f59e0b;
  font-weight: 600;
}
.cd-kind-amounts {
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.cd-kind-remaining {
  font-size: 24px;
  font-weight: 800;
  color: var(--gray1);
}
.cd-kind-total {
  font-size: 12px;
  color: var(--gray3);
}
.cd-kind-expiry-date {
  font-size: 11px;
  color: var(--gray3);
  margin-top: 6px;
}
.cd-cta-row {
  text-align: center;
}

/* Utilizzo tab */
.cd-utilizzo {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.cd-filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.cd-filter-select {
  padding: 7px 12px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--gray1);
  font-size: 13px;
  cursor: pointer;
}
.cd-filter-select:focus {
  border-color: var(--gold);
  outline: none;
}
.cd-usage-summary {
  display: flex;
  gap: 24px;
}
.cd-usage-stat {
  display: flex;
  flex-direction: column;
}
.cd-usage-stat-val {
  font-size: 22px;
  font-weight: 800;
  color: var(--gold);
}
.cd-usage-stat-lbl {
  font-size: 11px;
  color: var(--gray3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Tables (shared: utilizzo + ricariche) */
.cd-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.cd-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.cd-table th {
  text-align: left;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray3);
  border-bottom: 1px solid var(--border);
}
.cd-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--gray1);
}
.cd-table tbody tr:hover {
  background: rgba(255,255,255,0.02);
}
.cd-model-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(255,255,255,0.06);
  font-size: 11px;
  font-family: monospace;
  color: var(--gray2);
}
.cd-credits-cell {
  font-weight: 700;
  color: #f87171;
  font-variant-numeric: tabular-nums;
}
.cd-token-cell {
  font-variant-numeric: tabular-nums;
  color: var(--gray2);
  font-size: 12px;
  font-family: monospace;
}
.cd-cost-cell {
  font-variant-numeric: tabular-nums;
  color: var(--gray3);
  font-size: 12px;
}
.cd-table--usage th {
  white-space: nowrap;
}

/* Realtime row flash animation */
.cd-row-new {
  animation: cdRowFlash 1.5s ease;
}
@keyframes cdRowFlash {
  0%, 30% { background: rgba(201, 162, 39, 0.15); }
  100% { background: transparent; }
}
.cd-kind-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
}
.cd-ref-cell {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--gray3);
  font-size: 12px;
}
.cd-empty {
  text-align: center;
  padding: 40px 0;
  color: var(--gray3);
  font-size: 14px;
}

/* ── Responsive: Credits Dashboard + Mega-menu ───────────────── */
@media (max-width: 768px) {
  .credits-pill {
    padding: 4px 8px;
    font-size: 12px;
    gap: 4px;
  }
  .credits-pill svg {
    width: 12px;
    height: 12px;
  }
  .nav-mega {
    display: none !important;
  }
  .cd-breakdown {
    grid-template-columns: 1fr;
  }
  .cd-avail-value {
    font-size: 32px;
  }
  .cd-title {
    font-size: 22px;
  }
  .cd-table {
    font-size: 12px;
  }
  .cd-table th,
  .cd-table td {
    padding: 8px;
  }
  .cd-filters {
    flex-direction: column;
  }
  .vbs-paused-banner-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

/* ═══ Admin AI Economics Dashboard ══════════════════════════════════ */
.aie-header {
  margin-bottom: 28px;
}
.aie-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--gray2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  margin-bottom: 12px;
}
.aie-back:hover {
  color: var(--gold);
}
.aie-title {
  font-size: 28px;
  font-weight: 800;
  margin: 0 0 6px;
}
.aie-sub {
  color: var(--gray2);
  font-size: 14px;
  margin: 0;
}

/* Summary cards */
.aie-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.aie-card {
  background: #141414;
  border: 1px solid #262626;
  border-radius: 12px;
  padding: 18px;
  position: relative;
  overflow: hidden;
}
.aie-card-icon {
  font-size: 24px;
  margin-bottom: 10px;
}
.aie-card-label {
  font-size: 12px;
  color: var(--gray3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}
.aie-card-value {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

/* Section titles */
.aie-section-title {
  font-size: 16px;
  font-weight: 800;
  margin: 0 0 14px;
}
.aie-empty {
  text-align: center;
  padding: 40px 0;
  color: var(--gray3);
  font-size: 14px;
}

/* Daily chart */
.aie-chart-section {
  margin-bottom: 32px;
}
.aie-chart-legend {
  display: flex;
  gap: 20px;
  margin-bottom: 14px;
}
.aie-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--gray2);
}
.aie-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}
.aie-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 180px;
  background: #141414;
  border: 1px solid #262626;
  border-radius: 12px;
  padding: 16px 12px 32px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.aie-chart-col {
  flex: 1;
  min-width: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
}
.aie-chart-bars {
  display: flex;
  gap: 2px;
  align-items: flex-end;
  width: 100%;
  height: 100%;
}
.aie-chart-bar {
  flex: 1;
  min-height: 0;
  border-radius: 3px 3px 0 0;
  transition: height 0.3s ease;
}
.aie-chart-bar--cost {
  background: #f87171;
  opacity: 0.8;
}
.aie-chart-bar--credits {
  background: var(--gold);
  opacity: 0.8;
}
.aie-chart-bar:hover {
  opacity: 1;
}
.aie-chart-label {
  font-size: 9px;
  color: var(--gray3);
  margin-top: 6px;
  white-space: nowrap;
  text-align: center;
}

/* Per-user table */
.aie-table-section {
  margin-bottom: 32px;
}
.aie-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: #141414;
  border: 1px solid #262626;
  border-radius: 12px;
}
.aie-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 700px;
}
.aie-table th {
  text-align: left;
  padding: 12px 14px;
  font-size: 11px;
  color: var(--gray3);
  border-bottom: 1px solid #262626;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  position: sticky;
  top: 0;
  background: #141414;
  z-index: 1;
  user-select: none;
}
.aie-table th:hover {
  color: var(--gold);
}
.aie-table td {
  padding: 11px 14px;
  border-bottom: 1px solid #1f1f1f;
  font-size: 13px;
}
.aie-table tbody tr {
  transition: background 0.12s;
}
.aie-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.035);
}
.aie-totals-row td {
  border-top: 2px solid var(--gold);
  border-bottom: none;
  background: rgba(201, 162, 39, 0.06);
  font-size: 13px;
}

@media (max-width: 768px) {
  .aie-title {
    font-size: 22px;
  }
  .aie-cards {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .aie-card-value {
    font-size: 20px;
  }
  .aie-chart {
    height: 140px;
    padding: 12px 8px 28px;
  }
  .aie-table {
    font-size: 12px;
  }
  .aie-table th,
  .aie-table td {
    padding: 8px 10px;
  }
}

/* ══════════════════════════════════════════════════════════════════════ */
/* Activity Panel — real-time observability log                         */
/* ══════════════════════════════════════════════════════════════════════ */
.act-panel {
  border: 1px solid #262626;
  border-radius: 12px;
  margin-top: 16px;
  background: var(--bg2);
  overflow: hidden;
}
.act-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}
.act-toggle:hover {
  background: rgba(255, 255, 255, 0.04);
}
.act-toggle-left {
  display: flex;
  align-items: center;
  gap: 8px;
}
.act-toggle-icon {
  font-size: 14px;
}
.act-toggle-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--gray1);
  letter-spacing: 0.01em;
}
.act-toggle-arrow {
  font-size: 12px;
  color: var(--gray3);
  transition: transform 0.2s;
}
.act-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--gold);
  color: #000;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}
.act-body {
  max-height: 300px;
  overflow: hidden;
  transition: max-height 0.25s ease;
}
.act-body.collapsed {
  max-height: 0;
}
.act-list {
  max-height: 300px;
  overflow-y: auto;
  padding: 0;
}
.act-event {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 16px;
  border-bottom: 1px solid #1f1f1f;
  font-size: 12px;
  line-height: 1.5;
}
.act-event:last-child {
  border-bottom: none;
}
.act-icon {
  flex-shrink: 0;
  font-size: 13px;
  line-height: 1;
  padding-top: 2px;
}
.act-content {
  min-width: 0;
  flex: 1;
}
.act-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.act-time {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 10px;
  color: var(--gray3);
  flex-shrink: 0;
}
.act-msg {
  color: var(--gray1);
  word-break: break-word;
}
.act-detail-toggle {
  color: var(--gray3);
  font-size: 10px;
  cursor: pointer;
  margin-top: 2px;
  user-select: none;
}
.act-detail-toggle:hover {
  color: var(--gold);
}
.act-detail {
  display: none;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 10px;
  line-height: 1.5;
  color: var(--gray2);
  background: rgba(255, 255, 255, 0.03);
  padding: 8px;
  border-radius: 6px;
  margin-top: 4px;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 200px;
  overflow-y: auto;
}
.act-detail.expanded {
  display: block;
}
/* Error events — red tint */
.act-error {
  background: rgba(239, 68, 68, 0.06);
  border-left: 3px solid #ef4444;
}
.act-error .act-msg {
  color: #f87171;
}
@media (max-width: 768px) {
  .act-event {
    padding: 6px 12px;
  }
  .act-body,
  .act-list {
    max-height: 200px;
  }
}

/* ── Stop button (cancel job) ─────────────────────────────── */
.ss-stop-btn,
.es-stop-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 8px 0 16px 0;
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: #ef4444;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}
.ss-stop-btn:hover,
.es-stop-btn:hover {
  background: #dc2626;
}
.ss-stop-btn:disabled,
.es-stop-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.ss-stop-btn:focus-visible,
.es-stop-btn:focus-visible {
  outline: 2px solid #ef4444;
  outline-offset: 2px;
}


/* ═══════════════════════════════════════════════════════════════
   TOOL WORKSPACE ROOT — default + full-viewport overrides
   ═══════════════════════════════════════════════════════════════ */

/* Default: non-studio pages (credits dashboard, support, admin tools) */
#toolWorkspaceRoot {
  max-width: 960px;
  margin: 0 auto;
  padding: calc(var(--nav-h, 68px) + 24px) 20px 60px;
}

/* Full-viewport override when Command Center is mounted */
#toolWorkspaceRoot:has(.cc-grid) {
  max-width: none;
  margin: 0;
  padding: 0;
}

/* Fallback for browsers without :has() — class added by JS */
#toolWorkspaceRoot.cc-fullwidth {
  max-width: none;
  margin: 0;
  padding: 0;
}


/* ═══════════════════════════════════════════════════════════════
   COMMAND CENTER — Full-viewport 3-zone layout
   ═══════════════════════════════════════════════════════════════ */

/* ── Grid ──────────────────────────────────────────────────────── */
.cc-grid {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 360px;
  gap: 20px;
  min-height: calc(100vh - var(--nav-h, 64px));
  max-width: var(--app-max);
  margin: 0 auto;
  padding: calc(var(--nav-h, 68px) + 16px) 48px 48px;
}

/* ── Sidebar (left) ────────────────────────────────────────────── */
.cc-sidebar {
  background: var(--bg2);
  border-right: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  overflow-y: auto;
  max-height: calc(100vh - var(--nav-h, 64px) - 32px);
  position: sticky;
  top: calc(var(--nav-h, 64px) + 16px);
}

/* ── Canvas (center) ───────────────────────────────────────────── */
.cc-canvas {
  padding: 8px 0;
  overflow-y: auto;
  scroll-behavior: smooth;
  min-width: 0;
}

/* ── Rail (right) ──────────────────────────────────────────────── */
.cc-rail {
  background: var(--bg2);
  border-left: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  overflow-y: auto;
  max-height: calc(100vh - var(--nav-h, 64px) - 32px);
  position: sticky;
  top: calc(var(--nav-h, 64px) + 16px);
}

/* ── Rail sections ─────────────────────────────────────────────── */
.cc-rail-section {
  margin-bottom: 20px;
}
.cc-rail-section:last-child {
  margin-bottom: 0;
}
.cc-rail-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gray3);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

/* ── Rail placeholder (before T6/T7 populate it) ───────────────── */
.cc-rail-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 16px;
  color: var(--gray3);
  font-size: 13px;
  gap: 8px;
}
.cc-rail-placeholder-icon {
  font-size: 24px;
  opacity: 0.5;
}

/* ── Step Spy (status indicators on wizard dots) ───────────────── */
.cc-step-spy {
  position: relative;
}
.cc-step-spy--pending .vbs-wizard__dot {
  background: var(--bg3);
  border-color: var(--border);
  color: var(--gray3);
}
.cc-step-spy--running .vbs-wizard__dot {
  background: rgba(201,162,39,0.2);
  border-color: var(--gold);
  color: var(--gold);
  animation: cc-pulse-gold 1.5s ease-in-out infinite;
}
.cc-step-spy--awaiting_input .vbs-wizard__dot {
  background: rgba(59,130,246,0.2);
  border-color: #3b82f6;
  color: #3b82f6;
  animation: cc-pulse-blue 1.5s ease-in-out infinite;
}
.cc-step-spy--done .vbs-wizard__dot {
  background: var(--gold);
  border-color: var(--gold);
  color: #000;
}
.cc-step-spy--error .vbs-wizard__dot {
  background: rgba(239,68,68,0.2);
  border-color: #ef4444;
  color: #ef4444;
}

/* Pulse keyframes for step spy */
@keyframes cc-pulse-gold {
  0%, 100% { box-shadow: 0 0 0 0 rgba(201,162,39,0.4); }
  50%      { box-shadow: 0 0 0 6px rgba(201,162,39,0); }
}
@keyframes cc-pulse-blue {
  0%, 100% { box-shadow: 0 0 0 0 rgba(59,130,246,0.4); }
  50%      { box-shadow: 0 0 0 6px rgba(59,130,246,0); }
}

/* ── Skeleton loader ───────────────────────────────────────────── */
.cc-skeleton-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 8px 0;
}
.cc-skeleton {
  height: 16px;
  background: linear-gradient(90deg, var(--bg3) 25%, rgba(255,255,255,0.06) 50%, var(--bg3) 75%);
  background-size: 200% 100%;
  border-radius: 6px;
  animation: cc-skeleton-shimmer 1.5s ease-in-out infinite;
}
@keyframes cc-skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Responsive: collapse to single column under 1200px ────────── */
@media (max-width: 1200px) {
  .cc-grid {
    grid-template-columns: 1fr;
    padding: calc(var(--nav-h, 68px) + 12px) 16px 48px;
    gap: 16px;
  }
  .cc-sidebar {
    order: 1;
    max-height: none;
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--border);
    border-radius: 12px;
  }
  .cc-canvas {
    order: 2;
  }
  .cc-rail {
    order: 3;
    max-height: none;
    position: static;
    border-left: none;
    border-top: 1px solid var(--border);
    border-radius: 12px;
  }
}

/* ── When Command Center is used, override studio-layout ───────── */
.cc-grid .studio-sidebar {
  display: none; /* sidebar is now the cc-sidebar zone */
}
.cc-grid .studio-main {
  max-width: none;
  padding: 0;
}

/* ═══════════════════════════════════════════════════════════════
   ARTIFACTS — Card grid + floating modal for step outputs
   All colors via CSS vars (--bg, --bg2, --bg3, --gold, --white, etc.)
   ═══════════════════════════════════════════════════════════════ */

/* ── Card grid ─────────────────────────────────────────────── */
.art-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

/* ── Card ──────────────────────────────────────────────────── */
.art-card {
  display: flex;
  flex-direction: column;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  cursor: pointer;
  user-select: none;
  transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
  min-height: 140px;
  position: relative;
}
.art-card:hover,
.art-card:focus-visible {
  border-color: var(--gold);
  transform: scale(1.02);
  box-shadow: 0 0 16px rgba(201,162,39,0.12);
}
.art-card:active {
  transform: scale(0.99);
}

/* Card header */
.art-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.art-card-icon {
  font-size: 18px;
  flex-shrink: 0;
  color: var(--gold);
}
.art-card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}
.art-card-badge {
  font-size: 10px;
  font-weight: 600;
  color: var(--gold);
  background: rgba(201,162,39,0.12);
  border: 1px solid rgba(201,162,39,0.2);
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Card preview */
.art-card-preview {
  flex: 1;
  position: relative;
  overflow: hidden;
  max-height: 54px; /* ~3 lines at 13px/1.4 */
}
.art-card-preview-text {
  font-size: 12px;
  line-height: 1.45;
  color: var(--gray2);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.art-card-preview-fade {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 20px;
  background: linear-gradient(transparent, var(--bg3));
  pointer-events: none;
}

/* Card footer */
.art-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.art-card-cta {
  font-size: 11px;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: 0.02em;
}
.art-card-arrow {
  color: var(--gold);
  opacity: 0.5;
  transition: opacity 0.15s, transform 0.15s;
  flex-shrink: 0;
}
.art-card:hover .art-card-arrow {
  opacity: 1;
  transform: translateX(2px);
}

/* ═══════════════════════════════════════════════════════════════
   ARTIFACT MODAL — floating overlay for full content
   ═══════════════════════════════════════════════════════════════ */

/* Overlay */
.art-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.2s ease;
  padding: 24px;
}
.art-modal-overlay--visible {
  opacity: 1;
}

/* Modal box */
.art-modal {
  width: 100%;
  max-width: 720px;
  max-height: calc(100vh - 48px);
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.96) translateY(8px);
  transition: transform 0.2s ease;
  box-shadow: 0 24px 80px rgba(0,0,0,0.5);
}
.art-modal-overlay--visible .art-modal {
  transform: scale(1) translateY(0);
}

/* Top bar */
.art-modal-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
  flex-shrink: 0;
}
.art-modal-topbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.art-modal-icon {
  font-size: 18px;
  flex-shrink: 0;
}
.art-modal-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.art-modal-topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* Modal action buttons */
.art-modal-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--gray1);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
}
.art-modal-btn:hover {
  background: rgba(255,255,255,0.06);
  border-color: var(--gray3);
  color: var(--white);
}
.art-modal-btn svg {
  flex-shrink: 0;
}
.art-modal-btn--close {
  padding: 6px;
  border-color: transparent;
  margin-left: 4px;
}
.art-modal-btn--close:hover {
  background: rgba(255,80,80,0.12);
  color: #ff5050;
  border-color: transparent;
}
.art-modal-btn span {
  display: inline;
}

/* Modal body */
.art-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px 28px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--gray1);
}

/* Prose inside modal */
.art-modal-body .art-prose {
  line-height: 1.7;
}
.art-modal-body .art-h2 {
  font-size: 18px;
  font-weight: 800;
  color: var(--white);
  margin: 20px 0 10px;
}
.art-modal-body .art-h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--white);
  margin: 16px 0 8px;
}
.art-modal-body .art-h4 {
  font-size: 13px;
  font-weight: 700;
  color: var(--gray1);
  margin: 14px 0 6px;
}
.art-modal-body .art-list-item {
  padding-left: 20px;
  margin: 4px 0;
}
.art-modal-body .art-p {
  margin: 12px 0;
}
.art-modal-body strong {
  color: var(--white);
}

/* ── Manifold timeline (inside modal) ──────────────────────── */
.art-manifold-timeline {
  position: relative;
  padding-left: 22px;
}
.art-manifold-timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 12px;
  bottom: 12px;
  width: 2px;
  background: linear-gradient(180deg, var(--gold) 0%, rgba(201,162,39,0.15) 100%);
  border-radius: 1px;
}
.art-manifold-chapter {
  margin-bottom: 4px;
  position: relative;
}
.art-manifold-chapter-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  user-select: none;
  border-radius: 8px;
  transition: background 0.15s;
}
.art-manifold-chapter-header:hover {
  background: rgba(255,255,255,0.04);
}
.art-manifold-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gold);
  flex-shrink: 0;
  border: 2px solid var(--bg2);
  box-shadow: 0 0 0 1px var(--gold);
  position: relative;
  z-index: 1;
}
.art-manifold-chapter-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--white);
  flex: 1;
  min-width: 0;
}
.art-manifold-toggle {
  font-size: 11px;
  color: var(--gray2);
  flex-shrink: 0;
  transition: transform 0.15s;
}
.art-manifold-chapter-body {
  display: none;
  padding: 8px 12px 16px 32px;
  font-size: 13px;
  line-height: 1.65;
  color: var(--gray1);
  max-height: 400px;
  overflow-y: auto;
}
.art-manifold-chapter-body--open {
  display: block;
}

/* ── Transcript cards (inside modal) ───────────────────────── */
.art-transcript-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 12px;
  background: var(--bg3);
}
.art-transcript-card:last-child {
  margin-bottom: 0;
}
.art-transcript-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.art-transcript-num {
  font-size: 12px;
  font-weight: 700;
  color: var(--gold);
}
.art-transcript-badge {
  font-size: 10px;
  font-weight: 600;
  color: var(--gold);
  background: rgba(201,162,39,0.12);
  border: 1px solid rgba(201,162,39,0.2);
  padding: 2px 7px;
  border-radius: 4px;
}
.art-transcript-link {
  font-size: 11px;
  color: var(--gray2);
  text-decoration: none;
  margin-left: auto;
  transition: color 0.15s;
}
.art-transcript-link:hover {
  color: var(--gold);
}
.art-transcript-caption {
  font-size: 12px;
  color: var(--gray2);
  font-style: italic;
  margin-bottom: 8px;
  line-height: 1.4;
}
.art-transcript-text {
  font-size: 13px;
  line-height: 1.6;
  color: var(--gray1);
}

/* ── Responsive: artifacts ─────────────────────────────────── */
@media (max-width: 640px) {
  .art-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .art-modal-overlay {
    padding: 12px;
  }
  .art-modal {
    max-width: 100%;
    max-height: calc(100vh - 24px);
    border-radius: 10px;
  }
  .art-modal-topbar {
    padding: 12px 14px;
  }
  .art-modal-btn span {
    display: none; /* hide label, keep icon */
  }
  .art-modal-btn--close span {
    display: none;
  }
  .art-modal-body {
    padding: 16px;
  }
  .art-manifold-chapter-body {
    padding-left: 20px;
  }
}

/* ═══════════════════════════════════════════════════════════════
   METRICS — Compact session metrics panel (rail)
   ═══════════════════════════════════════════════════════════════ */

/* ── Metrics container ─────────────────────────────────────── */
.cc-metrics {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255,255,255,0.02);
  overflow: hidden;
}

/* ── Single metric row ─────────────────────────────────────── */
.cc-metric-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}
.cc-metric-item:last-child {
  border-bottom: none;
}

/* ── Metric left side (icon + label) ───────────────────────── */
.cc-metric-left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.cc-metric-icon {
  font-size: 14px;
  flex-shrink: 0;
}
.cc-metric-label {
  font-size: 11px;
  color: var(--gray3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Metric value ──────────────────────────────────────────── */
.cc-metric-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  flex-shrink: 0;
}
.cc-metric-value--gold {
  color: var(--gold);
}
.cc-metric-value--dim {
  color: var(--gray3);
  font-weight: 400;
}

/* ══════════════════════════════════════════════════════════════════════════ */
/* ── .tl-* — Process Timeline (Claude Code-style)                         */
/* ══════════════════════════════════════════════════════════════════════════ */

.tl-root {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  min-height: 200px;
  max-height: calc(100vh - 320px);
  padding: 8px 0;
  scroll-behavior: smooth;
}

/* ── Phase wrapper ─────────────────────────────────────────────────────── */

.tl-phase-wrapper {
  margin-bottom: 4px;
}

.tl-phase-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg3);
  border-left: 3px solid var(--gray3);
  border-radius: 0 8px 8px 0;
  cursor: pointer;
  transition: background 0.15s, border-color 0.3s, opacity 0.3s;
  user-select: none;
}

.tl-phase-header:hover {
  background: rgba(255,255,255,0.04);
}

.tl-phase--active {
  border-left-color: var(--gold);
  background: rgba(201,162,39,0.06);
  box-shadow: 0 0 12px rgba(201,162,39,0.08);
}

.tl-phase--active .tl-phase-label {
  color: var(--gold);
}

.tl-phase--done {
  border-left-color: #46d369;
  opacity: 0.8;
}

.tl-phase--done:hover {
  opacity: 1;
}

.tl-phase-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.tl-phase-icon {
  font-size: 18px;
  flex-shrink: 0;
  width: 28px;
  text-align: center;
}

.tl-phase-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.tl-phase-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--white);
  line-height: 1.3;
  transition: color 0.2s;
}

.tl-phase-desc {
  font-size: 11px;
  color: var(--gray2);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tl-phase-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.tl-phase-time {
  font-size: 11px;
  color: var(--gray3);
  font-family: 'SF Mono', SFMono-Regular, monospace;
}

.tl-phase-status {
  width: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tl-phase-check {
  color: #46d369;
  font-weight: 800;
  font-size: 14px;
}

/* ── Phase body (entries) ──────────────────────────────────────────────── */

.tl-phase-body {
  border-left: 1px solid var(--border);
  margin-left: 16px;
  padding: 4px 0 4px 16px;
  transition: max-height 0.3s ease, opacity 0.2s;
  overflow: hidden;
}

.tl-phase-body--collapsed {
  max-height: 0;
  opacity: 0;
  padding: 0 0 0 16px;
}

/* ── Entries ───────────────────────────────────────────────────────────── */

.tl-entry {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 4px 0;
  font-size: 13px;
  color: var(--gray2);
  line-height: 1.5;
}

.tl-entry-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gray3);
  flex-shrink: 0;
  margin-top: 6px;
}

.tl-entry-dot--gold { background: var(--gold); }
.tl-entry-dot--blue { background: #60a5fa; }
.tl-entry-dot--red  { background: #ef4444; }
.tl-entry-dot--green { background: #46d369; }
.tl-entry-dot--stream { background: var(--gold); animation: tl-dot-pulse 1.5s ease-in-out infinite; }

.tl-entry-dot--pulse {
  animation: tl-dot-pulse 1.5s ease-in-out infinite;
}

@keyframes tl-dot-pulse {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.5); opacity: 1; }
}

.tl-entry-content {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.tl-entry-time {
  font-size: 10px;
  color: var(--gray3);
  font-family: 'SF Mono', SFMono-Regular, monospace;
  flex-shrink: 0;
}

/* ── Thinking ──────────────────────────────────────────────────────────── */

.tl-thinking-text {
  color: var(--gray2);
}

.tl-thinking-dots {
  display: inline-flex;
  gap: 2px;
}

.tl-thinking-dots span {
  animation: tl-dots 1.4s ease-in-out infinite;
  opacity: 0.3;
}

.tl-thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.tl-thinking-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes tl-dots {
  0%, 80%, 100% { opacity: 0.3; }
  40% { opacity: 1; }
}

/* ── LLM call ──────────────────────────────────────────────────────────── */

.tl-model-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  background: rgba(201,162,39,0.1);
  border: 1px solid rgba(201,162,39,0.2);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--gold);
  font-family: 'SF Mono', SFMono-Regular, monospace;
}

.tl-token-info {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  color: var(--gray2);
  font-family: 'SF Mono', SFMono-Regular, monospace;
}

.tl-token-in { color: var(--gray2); }
.tl-token-out { color: var(--gray1); }

.tl-step-label {
  font-size: 10px;
  color: var(--gray3);
  font-style: italic;
}

/* ── Tool call ─────────────────────────────────────────────────────────── */

.tl-tool-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  background: rgba(96,165,250,0.1);
  border: 1px solid rgba(96,165,250,0.2);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  color: #60a5fa;
}

.tl-tool-done {
  color: #46d369;
  font-weight: 700;
}

.tl-tool-detail {
  font-size: 10px;
  color: var(--gray3);
}

/* ── Credit ────────────────────────────────────────────────────────────── */

.tl-credit-badge {
  font-size: 11px;
  color: var(--gray2);
}

.tl-credit-badge--commit {
  color: var(--gold);
  font-weight: 600;
}

/* ── Gate ──────────────────────────────────────────────────────────────── */

.tl-entry--gate {
  padding: 6px 0;
}

.tl-gate-text {
  color: var(--gold);
  font-weight: 600;
  font-size: 13px;
}

/* ── Error ─────────────────────────────────────────────────────────────── */

.tl-error-text {
  color: #f87171;
  font-weight: 500;
}

/* ── Complete ──────────────────────────────────────────────────────────── */

.tl-entry--complete {
  padding: 10px 0;
  margin-top: 8px;
}

.tl-complete-text {
  color: #46d369;
  font-weight: 700;
  font-size: 14px;
}

/* ── Result ────────────────────────────────────────────────────────────── */

.tl-result-text {
  color: var(--gray1);
  font-weight: 500;
}

/* ── Stream ────────────────────────────────────────────────────────────── */

.tl-entry--stream {
  padding: 4px 0;
}

.tl-stream-wrapper {
  flex-direction: column;
  align-items: stretch;
}

.tl-stream-text {
  font-family: 'SF Mono', SFMono-Regular, ui-monospace, monospace;
  font-size: 12px;
  line-height: 1.6;
  color: var(--gray1);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  margin: 4px 0 2px;
  max-height: 160px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.tl-entry--stream-done .tl-stream-text {
  max-height: 80px;
  opacity: 0.7;
}

.tl-stream-text--truncated {
  -webkit-mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
  mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
}

/* ── Spinner ───────────────────────────────────────────────────────────── */

.tl-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: tl-spin 0.7s linear infinite;
}

.tl-spinner--sm {
  width: 10px;
  height: 10px;
  border-width: 1.5px;
}

@keyframes tl-spin {
  to { transform: rotate(360deg); }
}

/* ── Responsive (≤640px) ───────────────────────────────────────────────── */

@media (max-width: 640px) {
  .tl-root {
    max-height: calc(100vh - 260px);
  }
  .tl-phase-header {
    padding: 8px 10px;
  }
  .tl-phase-icon {
    font-size: 15px;
    width: 22px;
  }
  .tl-phase-label {
    font-size: 13px;
  }
  .tl-phase-desc {
    display: none;
  }
  .tl-phase-body {
    margin-left: 10px;
    padding-left: 10px;
  }
  .tl-entry {
    font-size: 12px;
  }
  .tl-stream-text {
    font-size: 11px;
    padding: 8px;
    max-height: 120px;
  }
}

