/* ═══════════════════════════════════════════════════════════════
   CLOTO WIZARD — Conversational UI
   Chat-bubble paradigm. Phases as pills. Spiral avatar.

   Architecture:
     #fbw-workspace-chat
       .wiz-chat-header             (logo + label)
       .wiz-conversation            (flex:1, overflow-y:auto)
       .wiz-input                   (sticky bottom)
       .wiz-drawer-overlay          (absolute overlay, z:50)
   ═══════════════════════════════════════════════════════════════ */


/* ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
   §3  CONVERSATION — scrollable column
   ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ */

.wiz-conversation {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 10px 24px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  z-index: 1;
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
}

/* ── Landing mode — centered like Claude/ChatGPT new chat ── */
.fbw-wizard-overlay:has(.wiz-conversation--landing) {
  justify-content: center;
}
.wiz-conversation--landing {
  flex: none;
  justify-content: center;
  align-items: center;
  gap: 0;
  padding-bottom: 0;
  overflow: visible;
}
.wiz-conversation--landing ~ .wiz-input {
  flex: none;
  margin-top: var(--space-8);
}

.wiz-landing {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  text-align: center;
  padding: 0 var(--space-10);
  animation: wiz-landing-in 0.8s var(--ease-sheet) both;
}

.wiz-landing__spiral {
  margin-bottom: var(--space-8);
}

.wiz-landing__greeting {
  font-family: var(--cloto-font-brand);
  font-size: 28px;
  font-weight: 400;
  color: var(--cloto-text-100);
  margin: 0 0 var(--space-3) 0;
  letter-spacing: 0.01em;
}
.wiz-landing__subtitle {
  font-family: var(--cloto-font-ui);
  font-size: var(--cloto-fs-sm, 13px);
  color: var(--cloto-text-50);
  margin: 0 0 var(--space-4) 0;
}

.wiz-landing__sub {
  font-family: var(--cloto-font-ui);
  font-size: var(--cloto-fs-md);
  color: var(--cloto-text-70);
  margin: 0;
  font-style: italic;
}

@keyframes wiz-landing-in {
  0% { opacity: 0; transform: translateY(12px) scale(0.97); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Hero exit animation ── */
.wiz-landing--exit {
    animation: wiz-landing-out 0.35s var(--ease-spring) forwards;
    pointer-events: none;
}
@keyframes wiz-landing-out {
    0%   { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(-12px) scale(0.97); }
}

/* ── Landing: input grande ── */
.wiz-conversation--landing ~ .wiz-input .wiz-input__field {
    min-height: 100px;
    font-size: var(--cloto-fs-md);
    line-height: 1.6;
}

/* ── Chip suggerimenti ── */
.wiz-landing__chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-2);
    margin-top: var(--space-2);
    padding: 0 var(--space-4);
    animation: wiz-landing-in 0.8s var(--ease-sheet) both;
    animation-delay: 0.15s;
}
.wiz-landing__chip {
    font-family: var(--cloto-font-ui);
    font-size: var(--cloto-fs-sm);
    color: var(--cloto-text-70);
    background: rgba(94, 198, 198, 0.12);
    border: 1px solid rgba(94, 198, 198, 0.25);
    border-radius: var(--radius-full);
    padding: var(--space-2) var(--space-6);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-default);
    white-space: nowrap;
}
.wiz-landing__chip:hover {
    background: rgba(94, 198, 198, 0.2);
    border-color: rgba(94, 198, 198, 0.3);
    color: var(--cloto-text-100);
}

/* ── Landing exit: chip scompare prima ── */
.wiz-landing--exit .wiz-landing__chips {
    opacity: 0;
    transition: opacity 0.15s ease;
}

/* ── Responsive ── */
@media (max-width: 640px) {
    .wiz-landing__greeting { font-size: 22px; }
    .wiz-landing__spiral svg { width: 48px !important; height: 48px !important; }
    .wiz-conversation--landing ~ .wiz-input .wiz-input__field {
        min-height: 80px;
    }
    .wiz-landing__chips { gap: var(--space-2); }
    .wiz-landing__chip { font-size: 12px; padding: 6px 12px; }
}

/* Minimal scrollbar */
.wiz-conversation::-webkit-scrollbar { width: 4px; }
.wiz-conversation::-webkit-scrollbar-track { background: transparent; }
.wiz-conversation::-webkit-scrollbar-thumb {
  background: var(--cloto-text-25);
  border-radius: 2px;
}

/* Scroll-to-bottom FAB — absolute in panel, above input area */
.wiz-scroll-bottom {
  position: absolute;
  bottom: 60px;
  right: 16px;
  transform: scale(0.8);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--cloto-text-15);
  background: var(--cloto-zone-chat);
  color: var(--cloto-text-60);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms, transform 200ms;
  z-index: 10;
  box-shadow: 0 2px 8px var(--cloto-black-a15);
  padding: 0;
}
.wiz-scroll-bottom.is-visible {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}
.wiz-scroll-bottom:hover {
  background: var(--cloto-surface-alt);
  color: var(--cloto-text-100);
}


/* ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
   §4  CHAT MESSAGES — cloto · author · thinking · load-more
   ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ */

/* ── A. Cloto message (free text, no bubble) ── */
.cloto-msg {
  margin-bottom: 20px;
  max-width: 88%;
}
.cloto-msg-reflection {
  font-size: var(--cloto-fs-reading, 15px);
  font-family: var(--cloto-font-ui);
  color: var(--cloto-text-40, #5a6370);
  line-height: 1.7;
  margin-bottom: 4px;
}
.cloto-msg-question {
  font-size: var(--cloto-fs-reading, 15px);
  font-family: var(--cloto-font-ui);
  color: var(--cloto-editor-text, rgba(224,220,214,0.92));
  line-height: 1.7;
}
body.fd-light .cloto-msg-reflection { color: #999; }
body.fd-light .cloto-msg-question   { color: #333; }

/* Writing Q&A: subtle gold accent on left border */
.cloto-writing-qa { border-left: 2px solid #d4af5c; padding-left: 10px; margin-left: -12px; }
.cloto-writing-complete {
  border-left: 2px solid var(--cloto-gold, #c9a84c);
  padding-left: 10px;
  margin-left: -12px;
  color: var(--cloto-gold, #c9a84c);
}
body.fd-light .cloto-writing-complete {
  color: #8a6d2b;
  border-left-color: #b8960b;
}

.cloto-credits-cta {
  display: block;
  margin-top: 10px;
  padding: 7px 16px;
  font-family: var(--cloto-font-ui);
  font-size: 13px;
  font-weight: 500;
  color: var(--cloto-gold, #c9a84c);
  background: transparent;
  border: 1px solid var(--cloto-gold, #c9a84c);
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s, color 0.15s;
}
.cloto-credits-cta:hover {
  background: rgba(201, 168, 76, 0.1);
  color: #d4af5c;
}
body.fd-light .cloto-credits-cta {
  color: #b8960b;
  border-color: #b8960b;
}
body.fd-light .cloto-credits-cta:hover {
  background: rgba(184, 150, 11, 0.08);
  color: #9a7d00;
}

/* ── B. Author message (teal bubble, right-aligned) ── */
.author-msg {
  margin-bottom: 20px;
  display: flex;
  justify-content: flex-end;
}
.author-msg-bubble {
  background: rgba(94, 198, 198, 0.04);
  border: none;
  border-left: 2px solid rgba(94, 198, 198, 0.45);
  border-radius: 0;
  padding: 10px 16px;
  max-width: 85%;
  font-size: var(--cloto-fs-reading, 15px);
  font-family: var(--cloto-font-ui);
  color: var(--cloto-editor-text, rgba(224,220,214,0.92));
  line-height: 1.7;
}
body.fd-light .author-msg-bubble {
  background: rgba(29, 158, 117, 0.04);
  border-left-color: rgba(29, 158, 117, 0.3);
  color: #333;
}

/* ── C. Thinking dot (wait indicator) ── */
.cloto-thinking {
  margin-bottom: 8px;
}
.cloto-thinking-dots {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 8px 0;
  height: 32px;
}
.cloto-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cloto-teal, #3ecfcf);
}
body.fd-light .cloto-dot {
  background: #1D9E75;
}
.cloto-dot:nth-child(1) { animation: cloto-dot-pulse 1.4s ease-in-out infinite; }
.cloto-dot:nth-child(2) { animation: cloto-dot-pulse 1.4s ease-in-out 0.2s infinite; }
.cloto-dot:nth-child(3) { animation: cloto-dot-pulse 1.4s ease-in-out 0.4s infinite; }
@keyframes cloto-dot-pulse {
  0%, 100% { opacity: 0.2; transform: scale(0.8); }
  50% { opacity: 0.9; transform: scale(1); }
}
.cloto-thinking-text {
  font-size: 12px;
  font-family: var(--cloto-font-ui);
  color: var(--cloto-text-40, #5a6370);
  opacity: 0;
  transition: opacity 0.4s;
  padding-left: 2px;
  height: 16px;
}
.cloto-thinking-text.visible {
  opacity: 0.5;
}

/* ── D. Load more (message cap) ── */
.cloto-chat-load-more {
  display: block;
  margin: 0 auto 20px;
  padding: 8px 20px;
  font-size: 12px;
  font-family: var(--cloto-font-ui);
  color: var(--cloto-text-40, #5a6370);
  background: none;
  border: 0.5px solid var(--cloto-glass-border, rgba(255,255,255,0.05));
  border-radius: 8px;
  cursor: pointer;
}
.cloto-chat-load-more:hover {
  background: var(--cloto-surface-alt, rgba(255,255,255,0.04));
  color: var(--cloto-text-70, #8b949e);
}

/* ── E. Input area ── */
.cloto-chat-input {
  padding: 0 4px;
  margin-top: auto;
}
.cloto-chat-input-inner {
  background: var(--cloto-surface, #161a24);
  border: 0.5px solid var(--cloto-glass-border-hover, rgba(255,255,255,0.12));
  border-radius: 14px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
}
body.fd-light .cloto-chat-input-inner {
  background: #fff;
  border-color: rgba(0,0,0,0.12);
}
.cloto-chat-input textarea {
  flex: 1;
  font-size: 14px;
  color: var(--cloto-text-100, #e2e4e8);
  background: none;
  border: none;
  outline: none;
  resize: none;
  font-family: var(--cloto-font-ui);
  line-height: 1.5;
  max-height: 120px;
}
body.fd-light .cloto-chat-input textarea { color: #333; }
.cloto-chat-disclaimer {
  font-size: 12px;
  color: var(--cloto-text-40, rgba(255,255,255,0.35));
  text-align: center;
  padding: 5px 0 0;
  line-height: 1.4;
  font-family: var(--cloto-font-ui, system-ui, sans-serif);
}
body.fd-light .cloto-chat-disclaimer { color: rgba(0,0,0,0.45); }
.cloto-chat-input .send-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--cloto-teal, #3ecfcf);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
body.fd-light .cloto-chat-input .send-btn {
  background: #1D9E75;
}
.cloto-chat-input .send-btn:disabled {
  opacity: 0.3;
  cursor: default;
}
.cloto-chat-input.disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* ── F. Scroll-to-bottom FAB ── */
.cloto-chat-fab {
  position: absolute;
  right: 16px;
  bottom: 80px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--cloto-surface-alt, #1c2130);
  border: 0.5px solid var(--cloto-glass-border, rgba(255,255,255,0.05));
  color: var(--cloto-text-70, #8b949e);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 5;
}
.cloto-chat-fab.is-visible {
  opacity: 1;
  pointer-events: auto;
}
.cloto-chat-fab:hover {
  background: var(--cloto-surface-alt, #1c2130);
  color: var(--cloto-text-100, #e2e4e8);
}

/* ── Cloto voice — used for poetic phrases (brand font) ── */
.wiz-cloto-voice {
  font-family: var(--cloto-font-brand);
  font-style: italic;
  letter-spacing: 0.5px;
}

/* Animated ellipsis on loading */
.wiz-ellipsis::after {
  content: '...';
  animation: wiz-ellipsis 1.5s ease-in-out infinite;
}
@keyframes wiz-ellipsis {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}


/* ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
   §5  SPIRAL — avatar SVG, 5 states
   ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ */

/* (wiz-spiral state classes removed — brand classes below use keyframes directly) */

/* ── Keyframes — Respira (brand ref) ── */
@keyframes wiz-sp-breathe-center { 0%, 100% { r: 7; opacity: 1; }   50% { r: 8.5; opacity: 0.75; } }
@keyframes wiz-sp-breathe-inner  { 0%, 100% { opacity: 0.55; }      50% { opacity: 0.75; } }
@keyframes wiz-sp-breathe-outer  { 0%, 100% { opacity: 1; }         50% { opacity: 0.82; } }

/* ── Keyframes — Ascolta (brand ref) ── */
@keyframes wiz-sp-listen {
  0%, 100% { r: 7; } 30% { r: 6; } 60% { r: 8; }
}
@keyframes wiz-sp-listen-inner {
  0%, 100% { opacity: 0.55; } 50% { opacity: 0.75; }
}

/* ── Keyframes — Tesse (brand ref) ── */
@keyframes wiz-sp-weave-outer {
  0%, 10% { stroke-dashoffset: 190; opacity: 0; }
  30%, 70% { stroke-dashoffset: 0; opacity: 1; }
  90%, 100% { stroke-dashoffset: -190; opacity: 0; }
}
@keyframes wiz-sp-weave-inner {
  0%, 10% { stroke-dashoffset: 120; opacity: 0; }
  30%, 70% { stroke-dashoffset: 0; opacity: 0.55; }
  90%, 100% { stroke-dashoffset: -120; opacity: 0; }
}
@keyframes wiz-sp-wcenter {
  0%, 20% { opacity: 0; transform: scale(0.5); }
  40%, 60% { opacity: 1; transform: scale(1); }
  80%, 100% { opacity: 0; transform: scale(0.5); }
}

/* ── Keyframes — Riflette (brand ref) ── */
@keyframes wiz-sp-reflect {
  0%, 100% { r: 7; fill: #d4af5c; }
  50% { r: 9; fill: #c9a84c; }
}
@keyframes wiz-sp-rot {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ── Keyframes — Celebra (brand ref) ── */
@keyframes wiz-sp-celeb-burst {
  0%   { stroke-width: 12; opacity: 1; }
  40%  { stroke-width: 16; opacity: 1; }
  100% { stroke-width: 12; opacity: 0.15; }
}
@keyframes wiz-sp-celeb-center {
  0%   { r: 9; fill: #d4af5c; }
  30%  { r: 14; fill: #c9a84c; }
  60%  { r: 11; fill: #d4af5c; }
  100% { r: 9; fill: #d4af5c; }
}
@keyframes wiz-sp-celeb-glow {
  0%   { filter: drop-shadow(0 0 0 rgba(94,198,198,0)); }
  30%  { filter: drop-shadow(0 0 12px rgba(94,198,198,0.6)); }
  100% { filter: drop-shadow(0 0 0 rgba(94,198,198,0)); }
}

/* ── §5b  Brand spiral keyframes (accoglie, attende) ── */
@keyframes cloto-accoglie-scale {
  0%   { transform: scale(0.4); opacity: 0; }
  50%  { transform: scale(1.03); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes cloto-accoglie-arc {
  0%   { stroke-dashoffset: var(--arc-dash); opacity: 0; }
  100% { stroke-dashoffset: 0; opacity: var(--arc-opacity); }
}
@keyframes cloto-accoglie-center {
  0%   { transform: scale(0); opacity: 0; }
  60%  { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes cloto-await-center {
  0%, 100% { r: 7; fill: #d4af5c; opacity: 1; }
  50%      { r: 7; fill: #c9a84c; opacity: 0.5; }
}
@keyframes cloto-await-outer {
  0%, 100% { stroke-dashoffset: 0; }
  50%      { stroke-dashoffset: 15; }
}

/* ── §5c  Brand spiral classes ── */
.cloto-respira .center    { animation: wiz-sp-breathe-center 8s ease-in-out infinite; }
.cloto-respira .arc-inner { animation: wiz-sp-breathe-inner  8s ease-in-out infinite 0.6s; }
.cloto-respira .arc-outer { animation: wiz-sp-breathe-outer  8s ease-in-out infinite 1.2s; }

.cloto-attende .center    { animation: cloto-await-center 8s ease-in-out infinite; }
.cloto-attende .arc-outer { animation: cloto-await-outer  13s ease-in-out infinite; }

.cloto-tesse .arc-outer { animation: wiz-sp-weave-outer 4s ease-in-out infinite; stroke-dasharray: 190; }
.cloto-tesse .arc-inner { animation: wiz-sp-weave-inner 4s ease-in-out infinite 0.4s; stroke-dasharray: 120; }
.cloto-tesse .center    { animation: wiz-sp-wcenter 4s ease-in-out infinite 0.8s; transform-origin: center; }

.cloto-riflette svg     { animation: wiz-sp-rot 16s linear infinite; }
.cloto-riflette .center { animation: wiz-sp-reflect 5s ease-in-out infinite; }

.cloto-ascolta .center    { animation: wiz-sp-listen 1.4s ease-in-out infinite; }
.cloto-ascolta .arc-inner { animation: wiz-sp-listen-inner 1.4s ease-in-out infinite; }

.cloto-celebra svg        { animation: none; }
.cloto-celebra .arc-outer { animation: wiz-sp-celeb-burst 3.5s ease-out infinite; }
.cloto-celebra .arc-inner { animation: wiz-sp-celeb-burst 3.5s ease-out infinite 0.2s; }
.cloto-celebra .center    { animation: wiz-sp-celeb-center 3.5s ease-out infinite; }

.cloto-accoglie svg        { animation: cloto-accoglie-scale 2s var(--ease-sheet) forwards; }
.cloto-accoglie .arc-outer { --arc-dash: 190; --arc-opacity: 1;
                             stroke-dashoffset: 190; opacity: 0;
                             animation: cloto-accoglie-arc 1.3s ease-out 0.6s forwards; }
.cloto-accoglie .arc-inner { --arc-dash: 120; --arc-opacity: 0.55;
                             stroke-dashoffset: 120; opacity: 0;
                             animation: cloto-accoglie-arc 1.3s ease-out 1.1s forwards; }
.cloto-accoglie .center    { transform: scale(0); opacity: 0; transform-origin: 50px 50px;
                             animation: cloto-accoglie-center 1s ease-out 1.6s forwards; }


/* ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
   §6  REASONING — "perché questa domanda?"
   ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ */

.wiz-reasoning-trigger {
  background: none;
  border: none;
  color: var(--cloto-text-60);
  cursor: pointer;
  padding: 4px 0;
  font-size: 12px;
  font-family: var(--cloto-font-ui);
  font-style: italic;
  transition: color 0.2s;
}
.wiz-reasoning-trigger:hover {
  color: var(--cloto-text-40);
}

.wiz-reasoning-text {
  font-size: 13px;
  color: var(--cloto-text-40);
  font-style: italic;
  padding: 2px 16px 8px;
  line-height: 1.55;
  font-family: var(--cloto-font-ui);
}


/* ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
   §7  PHASE PILLS — separator with lines
   ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ */

.wiz-phase-separator {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 10px 0 4px;
}
.wiz-phase-separator::before,
.wiz-phase-separator::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--cloto-glass-border);
}

.wiz-phase-pill {
  background: transparent;
  border: 1px solid var(--cloto-text-25);
  border-radius: 20px;
  padding: 5px 16px;
  color: var(--cloto-text-70);
  font-size: 11px;
  font-family: var(--cloto-font-ui);
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.wiz-phase-pill--active {
  background: var(--cloto-teal-deep);
  border-color: var(--cloto-teal);
  color: var(--cloto-teal);
  cursor: default;
}

.wiz-phase-pill--collapsed {
  /* default: transparent bg, text-25 border */
}

.wiz-phase-chevron {
  font-size: 9px;
  display: inline-block;
  transition: transform 0.2s;
}
.wiz-phase-pill--expanded .wiz-phase-chevron {
  transform: rotate(90deg);
}

.wiz-phase-progress {
  font-size: var(--cloto-fs-2xs);
  opacity: 0.85;
  font-family: var(--cloto-font-ui);
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}

.wiz-phase-summary {
  font-size: 11px;
  color: var(--cloto-text-50);
  font-family: var(--cloto-font-ui);
  font-style: italic;
  text-align: center;
  margin-top: 4px;
}

/* Messages belonging to a collapsed phase */
.wiz-phase-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.3s ease;
}
.wiz-phase-messages--collapsed {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
}

/* History divider — minimal past-phase summary */
.wiz-history {
  margin: 6px 0 10px;
}
.wiz-history__trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 0;
}
.wiz-history__line {
  flex: 1;
  height: 1px;
  background: var(--cloto-glass-border);
  opacity: 0.5;
}
.wiz-history__label {
  font-size: 11px;
  color: var(--cloto-text-60);
  font-family: var(--cloto-font-ui);
  white-space: nowrap;
  transition: color 0.2s;
}
.wiz-history__trigger:hover .wiz-history__label {
  color: var(--cloto-text-40);
}
.wiz-history__content {
  display: none;   /* collapsed by default */
  margin-top: 8px;
  padding: 8px 0;
  border-left: 1px solid var(--cloto-glass-border);
  margin-left: 12px;
  padding-left: 12px;
  flex-direction: column;
  gap: 8px;
}
.wiz-history--open .wiz-history__content {
  display: flex;   /* visible when expanded */
}
.wiz-history__content .wiz-bubble {
  opacity: 0.85;
  font-size: 0.92em;
}
.wiz-history--open .wiz-history__label::after {
  content: ' \2191';
}

/* ── Analysis card ─────────────────────────────────────────── */
.wiz-analysis-card {
  margin: 12px 0 16px;
  padding: 16px 20px;
  background: var(--cloto-surface);
  border: 1px solid var(--cloto-glass-border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.wiz-analysis-scope {
  margin: 0;
  font-family: var(--cloto-font-brand);
  font-size: 1.15em;
  font-weight: 500;
  font-style: italic;
  color: var(--cloto-text-90);
  letter-spacing: 0.02em;
}
.wiz-analysis-themes,
.wiz-analysis-chars,
.wiz-analysis-conflict {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.wiz-analysis-label {
  font-size: 0.72em;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--cloto-text-60);
}
.wiz-analysis-values {
  font-size: 0.92em;
  color: var(--cloto-text-70);
  line-height: 1.5;
}

/* ── Scope chips ───────────────────────────────────────────── */
.wiz-scope-chips {
  display: flex;
  gap: 8px;
  margin: 8px 0 16px;
  flex-wrap: wrap;
}
.wiz-scope-chip {
  background: transparent;
  border: 1px solid var(--cloto-glass-border);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 0.82em;
  color: var(--cloto-text-60);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}
.wiz-scope-chip:hover {
  border-color: var(--cloto-glass-border-active);
  color: var(--cloto-text-70);
}
.wiz-scope-chip--active {
  border-color: var(--cloto-teal);
  color: var(--cloto-teal);
  background: var(--cloto-teal-deep, rgba(0,210,190,0.15));
}
.wiz-scope-chip--subtle {
  font-style: italic;
  opacity: 0.85;
  border-style: dashed;
}
.wiz-scope-chip--subtle:hover {
  opacity: 1;
}


/* ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
   §8  INPUT AREA — sticky bottom, pill container
   ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ */

.wiz-input {
  position: relative;
  z-index: 2;
  flex-shrink: 0;
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
}

.wiz-input__bar {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  background: var(--cloto-surface);
  border: 1px solid var(--cloto-teal-a25);
  border-radius: 24px;
  padding: 6px 6px 6px 18px;
  transition: border-color 0.3s, box-shadow 0.3s;
}
.wiz-input__bar--focused {
  border-color: var(--cloto-teal);
  box-shadow: var(--shadow-focus-teal);
}
body.fd-light .wiz-input__bar {
  background: #fff;
}

.wiz-input__field {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  box-shadow: none;
  -webkit-appearance: none;
  color: var(--cloto-text-100);
  font-size: var(--cloto-fs-reading);
  line-height: 1.5;
  resize: none;
  font-family: var(--cloto-font-ui);
  padding: 7px 0;
  min-height: 24px;
  max-height: 120px;
  scrollbar-width: none;
}
.wiz-input__field::-webkit-scrollbar {
  display: none;
}
.wiz-input__field:focus {
  outline: none;
  border: none;
  box-shadow: none;
}
.wiz-input__field::placeholder {
  color: var(--cloto-text-50);
  font-style: italic;
}

.wiz-input__send {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}
.wiz-input__send--active {
  background: var(--cloto-teal);
  color: #0b0e15;
  cursor: pointer;
}
.wiz-input__send--inactive {
  background: transparent;
  color: var(--cloto-text-25);
  cursor: default;
  opacity: 0.65;
}

body.fd-light .wiz-input__send--active {
  color: #fff;
}

.wiz-input__send svg {
  transition: stroke 0.2s;
}

/* Disabled state — input stays visible but inactive */
.wiz-input--disabled .wiz-input__field {
  opacity: 0.7;
  pointer-events: none;
  cursor: default;
}
.wiz-input--disabled .wiz-input__send {
  opacity: 0.6;
  pointer-events: none;
}
/* Loading placeholder — disabled textarea visible during first question load */
.wiz-input__bar--loading .wiz-input__field {
  opacity: 0.7;
  cursor: default;
}

/* ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
   §9  DRAWER — bottom sheet overlay
   ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ */

.wiz-drawer-overlay {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
}

.wiz-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: var(--cloto-void-a60);
}

.wiz-drawer-panel {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 82%;
  background: var(--cloto-surface);
  border-radius: 16px 16px 0 0;
  border: 1px solid var(--cloto-glass-border);
  border-bottom: none;
  display: flex;
  flex-direction: column;
  padding: 14px 22px 16px;
  animation: wiz-drawer-slide 0.35s var(--ease-sheet);
}

@keyframes wiz-drawer-slide {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.wiz-drawer-handle {
  width: 32px;
  height: 3px;
  background: var(--cloto-text-25);
  border-radius: 2px;
  margin: 0 auto 14px;
}

.wiz-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.wiz-drawer-title {
  font-size: 11px;
  color: var(--cloto-gold);
  font-family: var(--cloto-font-ui);
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
.wiz-drawer-close {
  background: none;
  border: none;
  color: var(--cloto-text-25);
  cursor: pointer;
  font-size: 14px;
}

.wiz-drawer-body {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.wiz-drawer-body::-webkit-scrollbar { width: 3px; }
.wiz-drawer-body::-webkit-scrollbar-track { background: transparent; }
.wiz-drawer-body::-webkit-scrollbar-thumb {
  background: var(--cloto-text-25);
  border-radius: 2px;
}

.wiz-drawer-footer {
  padding: 12px 0 0;
  border-top: 1px solid var(--cloto-glass-border);
}

/* Generic CTA button (used in drawers and conversation) */
.wiz-cta {
  background: transparent;
  border: 1px solid var(--cloto-glass-border-active);
  color: var(--cloto-teal);
  padding: 8px 20px;
  border-radius: 16px;
  font-size: 13px;
  font-family: var(--cloto-font-ui);
  cursor: pointer;
  transition: all 0.2s;
}
.wiz-cta:hover {
  background: var(--cloto-teal-deep);
  border-color: var(--cloto-teal);
}
.wiz-cta--full {
  width: 100%;
  padding: 14px;
  font-size: 14px;
}


/* ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
   §10  TOPBAR INTEGRATION — close · cost · breadcrumb · progress
   (used by FBW.wizard.renderTopbar → FBW.scaffold.updateTopbar)
   ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ */

.fbw-wizard-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 1px solid var(--cloto-glass-border-hover);
  border-radius: 50%;
  background: transparent;
  color: var(--cloto-text-70);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}
.fbw-wizard-close:hover {
  color: var(--cloto-text-100);
  background: var(--cloto-danger-a8);
  border-color: var(--cloto-danger-a20);
}

.fbw-wizard-cost-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: var(--cloto-fs-xs);
  font-family: var(--cloto-font-mono);
  color: var(--cloto-text-25);
  background: var(--cloto-gold-a6);
  border: 1px solid var(--cloto-gold-a10);
  border-radius: 9999px;
  white-space: nowrap;
}

.fbw-wizard-phases-compact {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.fbw-wizard-phase-chip {
  font-size: var(--cloto-fs-xs);
  color: var(--cloto-text-25);
  padding: 1px 4px;
  border-radius: 4px;
}
.fbw-wizard-phase-chip.is-active {
  color: var(--cloto-text-100);
  font-weight: 600;
  background: var(--cloto-gold-a10);
}
.fbw-wizard-phase-chip.is-completed {
  color: var(--cloto-text-40);
}
.fbw-wizard-phases-compact .fbw-wizard-phase-sep {
  color: var(--cloto-text-15);
  font-size: var(--cloto-fs-2xs);
}

.fbw-wizard-progress-compact {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--cloto-fs-xs);
  font-family: var(--cloto-font-mono);
  color: var(--cloto-text-25);
}
.fbw-wizard-progress-compact progress {
  width: 60px;
  height: 4px;
  appearance: none;
  -webkit-appearance: none;
  border: none;
  border-radius: 2px;
  overflow: hidden;
  background: var(--cloto-glass-border);
}
.fbw-wizard-progress-compact progress::-webkit-progress-bar {
  background: var(--cloto-glass-border);
  border-radius: 2px;
}
.fbw-wizard-progress-compact progress::-webkit-progress-value {
  background: var(--cloto-teal);
  border-radius: 2px;
}
.fbw-wizard-progress-compact progress::-moz-progress-bar {
  background: var(--cloto-teal);
  border-radius: 2px;
}


/* ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
   §11  RESPONSIVE
   ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ */

@media (max-width: 768px) {
  .wiz-conversation {
    padding: 8px 16px 12px;
  }

  .wiz-bubble--cloto .wiz-bubble__body,
  .wiz-bubble--user .wiz-bubble__body,
  .wiz-bubble--loading .wiz-bubble__body {
    max-width: 90%;
  }

  .wiz-input__wrapper {
    padding: 8px 16px 14px;
  }

  .wiz-topbar {
    padding: 0 16px;
  }

  .wiz-drawer-panel {
    max-height: 90%;
    padding: 12px 16px 14px;
  }
}


/* ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
   §12  REDUCED MOTION
   ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ */

@media (prefers-reduced-motion: reduce) {
  .wiz-bubble--animate {
    animation: none;
    opacity: 1;
    transform: none;
  }

  .wiz-spiral--idle .sp-c,
  .wiz-spiral--listening .sp-c,
  .wiz-spiral--weaving .sp-o,
  .wiz-spiral--weaving .sp-2,
  .wiz-spiral--weaving .sp-3,
  .wiz-spiral--weaving .sp-i,
  .wiz-spiral--weaving .sp-c,
  .wiz-spiral--reflecting .sp-c,
  .wiz-spiral--reflecting svg,
  .wiz-spiral--celebrating .sp-o,
  .wiz-spiral--celebrating .sp-2,
  .wiz-spiral--celebrating .sp-3,
  .wiz-spiral--celebrating .sp-i,
  .wiz-spiral--celebrating .sp-c,
  .wiz-spiral--celebrating svg {
    animation: none;
  }

  .wiz-ellipsis::after {
    animation: none;
  }

  .wiz-drawer-panel {
    animation: none;
  }

  .wiz-input--expanded {
    animation: none;
  }
}

/* ══════════════════════════════════════════════════════════════
   CARD DIVIDER — separator when switching cards in chat
   ══════════════════════════════════════════════════════════════ */

.wiz-card-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 8px;
}
.wiz-card-divider::before,
.wiz-card-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--cloto-glass-border);
}
.wiz-card-divider__label {
  font-size: 11px;
  font-family: var(--cloto-font-ui);
  color: var(--cloto-text-30);
  white-space: nowrap;
  letter-spacing: 0.02em;
}


/* ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
   §13  V2 WORKSPACE OVERRIDES — chat inside workspace panel
   ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ */

/* LEGACY: workspace-chat rules — dead when useSommario=true (element doesn't exist) */
/* V2: landing mode in workspace chat */
#fbw-workspace-chat:has(.wiz-conversation--landing) {
  justify-content: center;
}
#fbw-workspace-chat .wiz-conversation--landing ~ .wiz-input {
  flex: none;
  margin-top: var(--space-8);
}
/* V2 landing: smaller greeting font */
#fbw-workspace-chat .wiz-landing__greeting {
  font-size: 22px;
}
#fbw-workspace-chat .wiz-landing__spiral {
  margin-bottom: var(--space-4);
}

/* ── Prefunnel: allow .wiz-conversation to scroll (parent overflow unlocked) ── */
.fbw-outline-v2.is-prefunnel .fbw-wizard-overlay {
  overflow: visible;
}

/* ── Prefunnel: constrain bubble width on desktop ── */
.is-prefunnel #fbw-workspace-chat .wiz-conversation {
  max-width: 700px;
  margin: 0 auto;
  width: 100%;
}
.is-prefunnel #fbw-workspace-chat .wiz-conversation::before {
  content: '';
  flex: 1;
}
.is-prefunnel #fbw-workspace-chat .wiz-input {
  max-width: 700px;
  margin: 0 auto;
  width: 100%;
  background: transparent;
  border-top: none;
}
.is-prefunnel #fbw-workspace-chat .wiz-input__bar {
  background: transparent;
}

/* ── Prefunnel: compact centered landing ── */
.is-prefunnel #fbw-workspace-chat .wiz-landing {
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
}
.is-prefunnel #fbw-workspace-chat .wiz-landing__greeting {
  font-size: 36px;
}
.is-prefunnel #fbw-workspace-chat .wiz-landing__spiral {
  margin-bottom: 20px;
}
/* Chat header (logo+label) stays hidden in prefunnel — qa-header replaces it */
/* Prefunnel landing: input becomes part of centered content */
.is-prefunnel #fbw-workspace-chat .wiz-conversation--landing ~ .wiz-input {
  max-width: 640px;
  width: 100%;
  margin: var(--space-6) auto 0;
  background: transparent;
  border-top: none;
  padding: 0;
}
.is-prefunnel #fbw-workspace-chat .wiz-conversation--landing ~ .wiz-input .wiz-input__bar {
  min-height: 120px;
  align-items: flex-start;
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-3) var(--space-3) var(--space-4);
}
.is-prefunnel #fbw-workspace-chat .wiz-conversation--landing ~ .wiz-input .wiz-input__send {
  align-self: flex-end;
}
.is-prefunnel #fbw-workspace-chat .wiz-conversation--landing ~ .wiz-input .wiz-input__field {
  min-height: 80px;
  font-size: var(--cloto-fs-reading);
  resize: none;
}

/* ── Scope selector (landing dropdown) ── */
.wiz-scope-selector {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-4);
}
.wiz-scope-selector__label {
  font-size: 12px;
  font-family: var(--cloto-font-ui);
  color: var(--cloto-text-30);
  letter-spacing: 0.02em;
}
.wiz-scope-selector__select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--cloto-teal-a8);
  border: 1px solid var(--cloto-teal-a20);
  border-radius: 20px;
  color: var(--cloto-teal);
  font-family: var(--cloto-font-ui);
  font-size: 13px;
  padding: 5px 28px 5px 14px;
  cursor: pointer;
  transition: border-color var(--duration-fast) ease, background var(--duration-fast) ease;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%233ecfcf' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.wiz-scope-selector__select:hover {
  border-color: var(--cloto-teal-a40);
  background-color: var(--cloto-teal-a12);
}
.wiz-scope-selector__select:focus {
  outline: none;
  border-color: var(--cloto-teal);
  box-shadow: 0 0 0 2px var(--cloto-teal-a15);
}
.wiz-scope-selector__select option {
  background: var(--cloto-void);
  color: var(--cloto-text-70);
}
/* Light mode */
[data-theme="light"] .wiz-scope-selector__select {
  background-color: var(--cloto-teal-a6);
  border-color: var(--cloto-teal-a25);
  color: #2a7a7a;
}
[data-theme="light"] .wiz-scope-selector__select option {
  background: #fff;
  color: #1a1c28;
}

/* ── Narrative Q&A: chat header (fixed above scroll area) ── */
/* ── Unified QA Header (close + stepper + title in one row) ── */
.wiz-qa-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px var(--space-4);
  border-bottom: 1px solid var(--cloto-glass-border);
  background: var(--cloto-surface);
  flex-shrink: 0;
  z-index: 10;
}
.wiz-qa-header__close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--cloto-text-50);
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
}
.wiz-qa-header__close:hover {
  color: var(--cloto-text-90);
  background: var(--cloto-white-a8);
}
.wiz-qa-header__stepper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}
.wiz-qa-header__title {
  flex-shrink: 0;
  font-family: var(--cloto-font-ui);
  font-size: 11px;
  font-weight: 400;
  color: var(--cloto-text-30);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 140px;
  text-align: right;
}

/* ── Wizard Stepper (inline inside unified header) ── */
.wiz-stepper__step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 0 var(--space-2);
}
.wiz-stepper__dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1.5px solid var(--cloto-text-25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 7px;
  color: transparent;
  transition: all 0.3s ease;
}
.wiz-stepper__step--completed .wiz-stepper__dot {
  background: var(--cloto-teal);
  border-color: var(--cloto-teal);
  color: #fff;
}
.wiz-stepper__step--active .wiz-stepper__dot {
  border-color: var(--cloto-teal);
  background: var(--cloto-teal-a20);
  animation: wiz-stepper-pulse 2s ease-in-out infinite;
}
@keyframes wiz-stepper-pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--cloto-teal-a25); }
  50%      { box-shadow: 0 0 0 3px var(--cloto-teal-a10); }
}
.wiz-stepper__label {
  font-family: var(--cloto-font-ui);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--cloto-text-25);
  transition: color 0.3s;
}
.wiz-stepper__step--active .wiz-stepper__label {
  color: var(--cloto-text-90);
}
.wiz-stepper__step--completed .wiz-stepper__label {
  color: var(--cloto-teal);
}
.wiz-stepper__line {
  flex: 0 0 20px;
  height: 1px;
  background: var(--cloto-text-25);
  transition: background 0.3s;
}
.wiz-stepper__line--active {
  background: var(--cloto-teal);
}
/* ── QA progress dots (8 dots, light up as questions are answered) ── */
.wiz-qa-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.wiz-qa-dots__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cloto-text-15);
  transition: background 0.4s ease, transform 0.4s ease, box-shadow 0.4s ease;
}
.wiz-qa-dots__dot--filled {
  background: var(--cloto-teal);
}
.wiz-qa-dots__dot--current {
  background: var(--cloto-teal-a40, rgba(0,200,180,0.4));
  animation: wiz-qa-dot-pulse 2s ease-in-out infinite;
}
@keyframes wiz-qa-dot-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 var(--cloto-teal-a25); }
  50%      { transform: scale(1.35); box-shadow: 0 0 0 3px var(--cloto-teal-a10); }
}
/* Show workspace chat header when it has QA dots */
.wiz-chat-header.wiz-chat-header--with-dots {
  display: flex !important;
  align-items: center;
  gap: var(--space-3);
  padding: 6px var(--space-4);
  border-bottom: 1px solid var(--cloto-glass-border);
  flex-shrink: 0;
}

/* ── V2: Input as integrated glass footer ── */
#fbw-workspace-chat .wiz-input {
  max-width: none;
  background: var(--cloto-zone-chat-input);
  border-top: 1px solid var(--cloto-zone-chat-border);
  padding: var(--space-3) var(--space-4);
  transition: background 600ms ease-out, border-color 600ms ease-out;
}
#fbw-workspace-chat .wiz-input__bar {
  border-radius: 24px;
  padding: 4px 4px 4px 14px;
  gap: 6px;
  background: var(--cloto-surface);
  border-color: var(--cloto-teal-a25);
  transition: border-color 0.3s, box-shadow 0.3s;
}
#fbw-workspace-chat .wiz-input__bar--focused {
  border-color: var(--cloto-teal);
  box-shadow: var(--shadow-focus-teal);
}

/* Light mode input contrast */
body.fd-light #fbw-workspace-chat .wiz-input__bar {
  background: #fff;
  border-color: var(--cloto-teal-a25);
}
body.fd-light #fbw-workspace-chat .wiz-input__bar--focused {
  border-color: var(--cloto-teal);
  box-shadow: var(--shadow-focus-teal);
}
#fbw-workspace-chat .wiz-input__field {
  font-size: var(--cloto-fs-md);
  padding: 5px 0;
  min-height: 22px;
}
#fbw-workspace-chat .wiz-input__send {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
}
#fbw-workspace-chat .wiz-input__send--inactive {
  background: var(--cloto-teal-a12) !important;
  color: var(--cloto-teal-mid) !important;
}
#fbw-workspace-chat .wiz-input__send--active {
  background: var(--cloto-teal) !important;
  color: #fff !important;
  box-shadow: 0 0 12px var(--cloto-teal-a50), 0 0 4px var(--cloto-teal-a30) !important;
}
#fbw-workspace-chat .wiz-input__send--active:hover {
  background: var(--cloto-teal-light) !important;
  box-shadow: 0 0 18px rgba(94, 198, 198, 0.6), 0 0 6px var(--cloto-teal-a40) !important;
}
body.fd-light #fbw-workspace-chat .wiz-input__send--inactive {
  background: transparent !important;
  color: var(--cloto-text-25) !important;
  opacity: 0.65;
}
body.fd-light #fbw-workspace-chat .wiz-input__send--active {
  background: var(--cloto-teal) !important;
  color: #fff !important;
  box-shadow: 0 2px 8px rgba(14, 122, 122, 0.4) !important;
}
body.fd-light #fbw-workspace-chat .wiz-input__send--active:hover {
  background: #0a6565 !important;
  box-shadow: 0 2px 12px rgba(14, 122, 122, 0.5) !important;
}

/* Keyboard shortcut hint — fades in on focus */
#fbw-workspace-chat .wiz-input__hint {
  font-size: var(--cloto-fs-2xs);
  color: var(--cloto-text-25);
  font-family: var(--cloto-font-ui);
  text-align: right;
  padding: 2px 6px 0;
  opacity: 0;
  transition: opacity 0.15s;
}
#fbw-workspace-chat .wiz-input__hint.is-visible {
  opacity: 1;
}
#fbw-workspace-chat .wiz-input__disclaimer {
  font-size: 11px;
  color: var(--cloto-text-25);
  font-family: var(--cloto-font-ui);
  text-align: center;
  padding: 4px 6px 0;
  line-height: 1.3;
}
.wiz-scope-selector__select option:disabled {
  color: var(--cloto-text-20);
  font-style: italic;
}

/* ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
   §14  V2 MOBILE — input + landing adjustments
   ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ */

@media (max-width: 768px) {
  /* V2: input bar full-width, larger touch targets */
  #fbw-workspace-chat .wiz-input__field {
    font-size: 16px; /* prevents iOS zoom */
    min-height: 28px;
  }

  #fbw-workspace-chat .wiz-input__send {
    width: 40px;
    height: 40px;
  }

  /* Landing mode mobile: smaller spiral + greeting */
  #fbw-workspace-chat .wiz-landing__greeting {
    font-size: 18px;
  }
  #fbw-workspace-chat .wiz-landing__spiral {
    margin-bottom: var(--space-2);
  }
}


/* ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
   §15  ANALYSIS MODAL (wam- prefix)
   ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ */

/* Backdrop */
.wam-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: var(--cloto-void-a60);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
}
.wam-backdrop.is-open { opacity: 1; }

/* Modal — desktop */
.wam-modal {
  background: var(--cloto-zone-content, #1e2030);
  border-radius: var(--radius-lg, 12px);
  width: 90%;
  max-width: 680px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 80px var(--cloto-black-a50);
  transform: translateY(20px);
  transition: transform 0.2s;
}
.wam-backdrop.is-open .wam-modal {
  transform: translateY(0);
}

/* Modal — mobile bottom sheet */
.wam-modal--mobile {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  max-width: 100%;
  max-height: 90vh;
  border-radius: var(--radius-lg, 12px) var(--radius-lg, 12px) 0 0;
  transform: translateY(100%);
}
.wam-backdrop.is-open .wam-modal--mobile {
  transform: translateY(0);
}

/* Drag handle (mobile) */
.wam-modal__drag {
  display: flex;
  justify-content: center;
  padding: 10px 0 4px;
}
.wam-modal__drag-bar {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--cloto-text-20, rgba(255, 255, 255, 0.2));
}

/* Header */
.wam-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 24px 12px;
  flex-shrink: 0;
}
.wam-modal__header-text {
  flex: 1;
  min-width: 0;
}
.wam-modal__title {
  font-family: var(--cloto-font-display, 'Cardo', serif);
  font-size: 26px;
  font-weight: 400;
  color: var(--cloto-text, #e8e6e1);
  margin: 0;
}
.wam-modal__header--centered {
  justify-content: center;
  text-align: center;
  position: relative;
}
.wam-modal__header--centered .wam-modal__close {
  position: absolute;
  right: 24px;
  top: 20px;
}
.wam-modal__subtitle {
  font-family: var(--cloto-font-ui);
  font-size: 12px;
  font-style: italic;
  color: var(--cloto-text-40);
  margin: 4px 0 0;
}
.wam-modal__close {
  background: none;
  border: none;
  color: var(--cloto-text-40, rgba(255, 255, 255, 0.65));
  font-size: 24px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  transition: color 0.15s;
}
.wam-modal__close:hover {
  color: var(--cloto-text-70);
}

/* Body (scrollable) */
.wam-modal__body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 8px 32px 24px;
}

/* Footer */
.wam-modal__footer {
  flex-shrink: 0;
  padding: 12px 24px 20px;
  border-top: 1px solid var(--cloto-text-08, rgba(255, 255, 255, 0.08));
}
.wam-modal__confirm {
  width: 100%;
  padding: 12px 24px;
  background: var(--cloto-teal, #5ec6c6);
  color: #fff;
  border: none;
  border-radius: var(--radius-md, 8px);
  font-family: var(--cloto-font-ui);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}
.wam-modal__confirm:hover {
  background: var(--cloto-teal-mid);
}

/* Sections */
.wam-section {
  margin-bottom: 20px;
}
.wam-section__title {
  font-family: var(--cloto-font-ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--cloto-text-40, rgba(255, 255, 255, 0.85));
  margin: 0 0 10px;
  text-transform: uppercase;
}
.wam-section__subtitle {
  font-family: var(--cloto-font-ui);
  font-size: 12px;
  font-weight: 400;
  color: var(--cloto-text-50, rgba(255, 255, 255, 0.7));
  margin: -6px 0 10px;
  font-style: italic;
}

/* Fields */
.wam-field {
  margin-bottom: 10px;
}
.wam-field__label {
  display: block;
  font-family: var(--cloto-font-ui);
  font-size: 12px;
  color: var(--cloto-text-40);
  margin-bottom: 4px;
}

/* Form elements */
.wam-select,
.wam-input,
.wam-textarea {
  width: 100%;
  background: var(--cloto-surface);
  border: 1px solid var(--cloto-glass-border);
  border-radius: var(--radius-sm, 6px);
  color: var(--cloto-text-70, rgba(255, 255, 255, 0.7));
  font-family: var(--cloto-font-ui);
  font-size: 13px;
  padding: 8px 10px;
  transition: border-color 0.15s;
  box-sizing: border-box;
}
.wam-select:focus,
.wam-input:focus,
.wam-textarea:focus {
  outline: none;
  border-color: var(--cloto-glass-border-active);
}
.wam-select {
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' fill='none' stroke='%233ecfcf' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 28px;
}
.wam-textarea {
  resize: vertical;
  min-height: 60px;
}
.wam-textarea--readonly {
  opacity: 0.85;
  cursor: default;
}

/* Chips */
.wam-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.wam-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--cloto-text-08, rgba(255, 255, 255, 0.15));
  color: var(--cloto-text-70);
  font-family: var(--cloto-font-ui);
  font-size: 12px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}
.wam-chip__remove {
  background: none;
  border: none;
  color: var(--cloto-text-30);
  font-size: 14px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
}
.wam-chip__remove:hover {
  color: var(--cloto-danger);
}
.wam-chip-add {
  background: none;
  border: 1px dashed var(--cloto-text-15, rgba(255, 255, 255, 0.25));
  color: var(--cloto-text-40);
  font-family: var(--cloto-font-ui);
  font-size: 12px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.wam-chip-add:hover {
  border-color: var(--cloto-teal-mid);
  color: var(--cloto-teal);
}
.wam-chip-input {
  background: var(--cloto-text-05);
  border: 1px solid var(--cloto-teal-mid, var(--cloto-teal-a40));
  border-radius: var(--radius-sm);
  color: var(--cloto-text-70);
  font-family: var(--cloto-font-ui);
  font-size: 12px;
  padding: 4px 8px;
  width: 120px;
  outline: none;
}

/* Character cards */
.wam-characters {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.wam-char-card {
  border: 1px solid var(--cloto-text-08);
  border-radius: var(--radius-md, 8px);
  overflow: hidden;
  transition: border-color 0.15s;
}
.wam-char-card.is-expanded {
  border-color: var(--cloto-text-15);
}
.wam-char-card__header {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}
.wam-char-card__header:hover {
  background: var(--cloto-text-05);
}
.wam-char-card__name {
  font-family: var(--cloto-font-ui);
  font-size: 13px;
  font-weight: 500;
  color: var(--cloto-text-70);
}
.wam-char-card__role {
  font-family: var(--cloto-font-ui);
  font-size: 12px;
  color: var(--cloto-text-40);
  margin-left: 4px;
}
.wam-char-card__toggle {
  background: none;
  border: none;
  color: var(--cloto-text-30);
  font-size: 12px;
  margin-left: auto;
  cursor: pointer;
  padding: 2px 4px;
}
.wam-char-card__remove {
  background: none;
  border: none;
  color: var(--cloto-text-20);
  font-size: 16px;
  cursor: pointer;
  padding: 2px 4px;
  margin-left: 4px;
  transition: color 0.15s;
}
.wam-char-card__remove:hover {
  color: var(--cloto-danger);
}
.wam-char-card__body {
  padding: 0 12px 12px;
}
.wam-char-add {
  background: none;
  border: 1px dashed var(--cloto-text-15);
  color: var(--cloto-text-40);
  font-family: var(--cloto-font-ui);
  font-size: 12px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  text-align: center;
}
.wam-char-add:hover {
  border-color: var(--cloto-teal-mid);
  color: var(--cloto-teal);
}

/* Scope chips in modal */
.wam-scope-chips {
  display: flex;
  gap: 8px;
}
.wam-scope-chip {
  flex: 1;
  padding: 8px 12px;
  background: var(--cloto-text-05);
  border: 1px solid var(--cloto-text-08);
  border-radius: var(--radius-md);
  color: var(--cloto-text-50);
  font-family: var(--cloto-font-ui);
  font-size: 13px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
}
.wam-scope-chip:hover {
  border-color: var(--cloto-text-20);
  color: var(--cloto-text-70);
}
.wam-scope-chip--active {
  background: var(--cloto-teal);
  border-color: var(--cloto-teal);
  color: #fff;
}
.wam-scope-chip--active:hover {
  background: var(--cloto-teal-mid);
  border-color: var(--cloto-teal-mid);
}
.wam-scope-chip--disabled,
.wam-scope-chip--disabled:hover {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: auto;
  color: var(--cloto-text-30);
  border-color: var(--cloto-text-08);
  background: var(--cloto-text-05);
}

/* Scope AI hint */
.wam-scope-hint {
  font-family: var(--cloto-font-ui);
  font-size: 12px;
  font-style: italic;
  color: var(--cloto-text-40);
  margin-top: 8px;
}

/* Question rows */
.wam-question-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 6px;
}
.wam-question-num {
  color: var(--cloto-text-30);
  font-family: var(--cloto-font-ui);
  font-size: 12px;
  flex-shrink: 0;
  width: 20px;
  text-align: right;
  padding-top: 7px;
}
.wam-question-row .wam-input {
  flex: 1;
}
.wam-question-textarea {
  resize: vertical;
  min-height: 44px;
  line-height: 1.4;
}
.wam-question-remove {
  background: none;
  border: none;
  color: var(--cloto-text-20);
  font-size: 16px;
  cursor: pointer;
  padding: 2px 4px;
  flex-shrink: 0;
  transition: color 0.15s;
}
.wam-question-remove:hover {
  color: var(--cloto-danger);
}

/* ── Telaio modal — content sections ── */

/* ═══ TELAIO — Stagger reveal animation ═══ */
.telaio-reveal {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.telaio-reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ═══ THE PACT — Logline (hero text, no header, breathing space) ═══ */
.telaio-logline-wrap {
  margin: 8px 0 32px;
}
.telaio-logline__editable {
  display: block;
  text-align: right;
  font-family: var(--cloto-font-ui);
  font-size: 10px;
  font-style: italic;
  color: var(--cloto-text-50, rgba(255, 255, 255, 0.7));
  margin-top: 4px;
}
.telaio-logline {
  width: 100%;
  font-family: var(--cloto-font-display, 'Cardo', serif);
  font-size: 20px;
  font-weight: 400;
  line-height: 1.7;
  color: var(--cloto-text, #e8e6e1);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm, 4px);
  padding: 8px 4px;
  overflow: hidden;
  resize: none;
  transition: border-color 0.2s, background 0.2s;
}
.telaio-logline:focus {
  outline: none;
  border-color: rgba(45,212,191,0.35);
  background: rgba(255,255,255,0.06);
}
.telaio-logline:disabled,
.telaio-logline[readonly] {
  border-color: transparent;
  background: transparent;
  opacity: 1;
  -webkit-text-fill-color: var(--cloto-text, #e8e6e1);
  color: var(--cloto-text, #e8e6e1);
}
p.telaio-logline {
  border: none;
  padding: 4px 0 8px;
  resize: initial;
  overflow: visible;
  font-style: italic;
  color: var(--cloto-text-50, rgba(255,255,255,0.5));
}

/* ═══ THE PACT — Direction (teal accent, inside details) ═══ */
.telaio-direction {
  background: var(--cloto-surface-a6, rgba(255,255,255,0.08));
  border: none;
  border-left: 3px solid var(--cloto-teal-a20, rgba(0,200,180,0.2));
  border-radius: var(--radius-sm, 4px);
  padding: 16px 20px;
  margin-bottom: 8px;
}
.telaio-direction__header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.telaio-direction__icon.wiz-spiral {
  flex-shrink: 0;
}
.telaio-direction__editable {
  font-family: var(--cloto-font-ui);
  font-size: 10px;
  font-style: italic;
  color: var(--cloto-text-50, rgba(255, 255, 255, 0.5));
  margin-left: auto;
}
.telaio-section__title {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--cloto-teal, #4fd1c5);
  margin: 0;
}
.telaio-direction__textarea {
  width: 100%;
  font: inherit;
  font-size: 0.95em;
  line-height: 1.7;
  color: var(--cloto-text-70);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm, 4px);
  padding: 6px 4px;
  overflow: hidden;
  resize: none;
  transition: border-color 0.2s, background 0.2s;
}
.telaio-direction__textarea:focus {
  outline: none;
  border-color: rgba(45,212,191,0.3);
  background: rgba(255,255,255,0.06);
}
.telaio-direction__textarea:disabled,
.telaio-direction__textarea[readonly] {
  border-color: transparent;
  background: transparent;
}

/* ═══ ENGINE — Details panel (collapsible, discrete) ═══ */
.telaio-details {
  margin-top: 32px;
  border-top: 1px solid var(--cloto-glass-border);
}
.telaio-details__toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 0;
  cursor: pointer;
  font-size: 0.85em;
  font-weight: 600;
  color: var(--cloto-text-40);
  user-select: none;
  transition: color 0.15s;
}
.telaio-details__toggle:hover { color: var(--cloto-text-60); }
.telaio-details__chevron {
  display: inline-block;
  font-size: 0.65em;
  transition: transform 0.2s;
}
.telaio-details__chevron::before { content: '\25B6'; }
.telaio-details.is-open .telaio-details__chevron { transform: rotate(90deg); }
.telaio-details__body { padding: 4px 0 16px; }

/* ═══ ENGINE — Detail fields (static) ═══ */
.telaio-field { margin-bottom: 20px; }
.telaio-field__label {
  display: block;
  font-size: 0.75em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--cloto-text-40);
  margin-bottom: 6px;
}
.telaio-field__text {
  font: inherit;
  font-size: 0.9em;
  line-height: 1.6;
  color: var(--cloto-text-60);
  margin: 0;
}
/* Proto-synopsis — prose styling */
.telaio-field__prose {
  font: inherit;
  font-size: 0.93em;
  font-style: italic;
  line-height: 1.7;
  color: var(--cloto-text-60);
  margin: 0 0 16px;
  padding: 4px 0;
}

/* ═══ ENGINE — Characters (card list, no heavy borders) ═══ */
.telaio-characters { }
.telaio-char {
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.telaio-char:last-child { border-bottom: none; }
.telaio-char__top {
  display: flex;
  gap: 6px;
  align-items: baseline;
  margin-bottom: 2px;
}
.telaio-char__name {
  font-weight: 600;
  font-size: 0.9em;
  color: var(--cloto-text-100);
}
.telaio-char__fn-label {
  font-size: 0.8em;
  color: var(--cloto-text-35, var(--cloto-text-40));
  font-style: italic;
}
.telaio-char__desc {
  font-size: 0.85em;
  color: var(--cloto-text-50);
  line-height: 1.5;
  margin: 0;
}

/* ═══ Fili unified: prefix + modifier classes ═══ */
.telaio-fili { }
.telaio-prefix { font-weight: 600; margin-right: 4px; }
.telaio-prefix--teal { color: var(--cloto-teal); }
.telaio-prefix--gold { color: var(--cloto-gold, #ba9c60); }
.telaio-field__text--delta { font-style: italic; color: var(--cloto-text-70); }
body.fd-light .telaio-prefix--teal { color: #0d7377; }
body.fd-light .telaio-prefix--gold { color: #8a7340; }
.telaio-fili__sep {
  border: none;
  border-top: 1px solid rgba(255,255,255,0.06);
  margin: 12px 0 8px;
}
body.fd-light .telaio-fili__sep { border-top-color: rgba(0,0,0,0.06); }

/* ── Telaio: card-view container ── */
.telaio-card-view {
  padding: 32px 24px 0;
}

/* ── Telaio: action buttons (sticky pill) ── */
.telaio-actions {
  position: sticky;
  bottom: 0;
  padding: 16px 24px;
  background: var(--cloto-zone-content, #1a1a2e);
  border-top: 1px solid rgba(255,255,255,0.06);
  display: flex;
  gap: 12px;
  z-index: 2;
}
body.fd-light .telaio-actions { background: var(--cloto-zone-content, #fff); border-top-color: rgba(0,0,0,0.06); }

.telaio-btn {
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 0.85em;
  font-weight: 500;
  letter-spacing: 0.03em;
  cursor: pointer;
  background: transparent;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s, color 0.15s;
}
.telaio-btn--expand {
  border: 1.5px solid var(--cloto-teal);
  color: var(--cloto-teal);
}
.telaio-btn--expand:hover {
  background: var(--cloto-teal);
  color: white;
}
.telaio-btn--write {
  border: 1.5px solid var(--cloto-gold, #ba9c60);
  color: var(--cloto-gold, #ba9c60);
}
.telaio-btn--write:hover {
  background: var(--cloto-gold, #ba9c60);
  color: white;
}

/* ═══ ENGINE — Relationships ═══ */
.telaio-rel {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.telaio-rel:last-child { border-bottom: none; }
.telaio-rel__names {
  font-weight: 600;
  font-size: 0.92em;
  color: var(--cloto-text-100);
  white-space: nowrap;
}
.telaio-rel__state {
  font-size: 0.85em;
  color: var(--cloto-text-50);
  line-height: 1.4;
}

/* ═══ ENGINE — Genre chips ═══ */
.telaio-genre__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.telaio-chip {
  display: inline-flex;
  align-items: center;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 3px 10px;
  font-size: 0.82em;
  color: var(--cloto-text-50);
}
.telaio-chip--primary {
  background: rgba(186,156,96,0.1);
  border-color: rgba(186,156,96,0.25);
  color: var(--cloto-gold, #ba9c60);
}

/* ═══ TELAIO — Light mode overrides ═══ */
body.fd-light .telaio-direction { background: rgba(0,0,0,0.05); border-left-color: rgba(0,140,130,0.15); }
body.fd-light .telaio-logline:focus { background: rgba(0,0,0,0.04); }
body.fd-light .telaio-direction__textarea:focus { background: rgba(0,0,0,0.04); }
body.fd-light .telaio-char { border-bottom-color: rgba(0,0,0,0.05); }
body.fd-light .telaio-rel { border-bottom-color: rgba(0,0,0,0.05); }
body.fd-light .telaio-chip { background: rgba(0,0,0,0.04); border-color: rgba(0,0,0,0.08); }
body.fd-light .telaio-chip--primary { background: rgba(186,156,96,0.08); border-color: rgba(186,156,96,0.2); }

/* Secondary CTA */
.wiz-cta--ghost {
  background: transparent;
  border: none;
  color: var(--cloto-text-40);
  padding: 6px 16px;
  font-size: 12px;
  cursor: pointer;
  transition: color 0.15s;
}
.wiz-cta--ghost:hover {
  color: var(--cloto-text-60);
}

/* ── Light mode CTA button ── */
body.fd-light .wiz-cta {
  border-color: var(--cloto-glass-border-active);
  color: var(--cloto-teal);
}
body.fd-light .wiz-cta:hover {
  background: var(--cloto-teal);
  border-color: var(--cloto-teal);
  color: #fff;
}
body.fd-light .wiz-cta--ghost {
  color: var(--cloto-text-40);
}
body.fd-light .wiz-cta--ghost:hover {
  background: transparent;
  border-color: transparent;
  color: var(--cloto-text-70);
}

/* ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
   §  SYNOPSIS REVEAL + NAV BUTTONS
   ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ */

/* Synopsis reveal: simple fade-in via inline style (no chunk animation) */

/* Navigation buttons */
.wiz-nav-buttons {
  display: flex;
  justify-content: center;
  padding: var(--space-3, 12px) 0;
}
.wiz-nav-btn {
  background: var(--cloto-gold, #c9a84c);
  color: var(--cloto-bg, #0d0f17);
  border: none;
  padding: 10px 28px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.2s;
}
.wiz-nav-btn:hover { opacity: 0.85; }
.wiz-nav-btn:disabled { opacity: 0.5; cursor: default; }
.wiz-nav-btn--final {
  background: transparent;
  border: 1px solid var(--cloto-gold, #c9a84c);
  color: var(--cloto-gold, #c9a84c);
}
.wiz-nav-btn--pulse {
  animation: wiz-pulse-gold 2s ease-in-out infinite;
  border-color: var(--cloto-gold, #c9a84c);
}
@keyframes wiz-pulse-gold {
  0%, 100% { box-shadow: 0 0 0 0 rgba(212,175,55, 0.4); }
  50% { box-shadow: 0 0 12px 4px rgba(212,175,55, 0.15); }
}

/* Light mode */
body.fd-light .wiz-nav-btn { color: #fff; }
body.fd-light .wiz-nav-btn--final { color: var(--cloto-gold); }

/* ── Light mode overrides ── */
body.fd-light .wam-backdrop {
  background: rgba(0, 0, 0, 0.3);
}
body.fd-light .wam-modal__confirm {
  background: var(--cloto-teal);
}
body.fd-light .wam-modal__confirm:hover {
  background: var(--cloto-teal-mid);
}
body.fd-light .wam-scope-chip--active {
  background: var(--cloto-teal);
  border-color: var(--cloto-teal);
}
body.fd-light .wam-scope-chip--active:hover {
  background: var(--cloto-teal-mid);
  border-color: var(--cloto-teal-mid);
}

/* ── Wizard Complete CTA ── */
.wiz-complete-cta {
  margin-top: var(--space-4);
  align-self: flex-start;
  animation: wiz-cta-appear 0.5s ease-out 0.8s both;
}
@keyframes wiz-cta-appear {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Start Here Badge ── */
.fbw-card-start-badge {
  font-family: var(--cloto-font-ui);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--cloto-teal);
  background: var(--cloto-teal-a10);
  border: 1px solid var(--cloto-teal-a20);
  border-radius: var(--radius-full);
  padding: 2px 8px;
  margin: 4px 0 2px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.fbw-card-start-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cloto-teal);
  flex-shrink: 0;
  animation: fbw-start-dot-pulse 1.5s ease-in-out infinite;
}
@keyframes fbw-start-dot-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 var(--cloto-teal-a20); }
  50%      { opacity: 0.5; box-shadow: 0 0 0 4px var(--cloto-teal-a8); }
}

/* ── Workspace: logline header (altitude reference) ── */
/* ── Workspace: logline (italic, muted, under title) ── */
.cw-ws-logline-header {
  font-size: 0.95em;
  font-style: italic;
  color: rgba(255,255,255,0.5);
  padding: 0 24px 8px;
  line-height: 1.5;
}
body.fd-light .cw-ws-logline-header { color: rgba(0,0,0,0.45); }

.cw-ws-expand-loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 48px 24px; font-size: 15px; color: var(--cloto-text-50); }
.cw-ws-spinner-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--cloto-teal); border-top-color: transparent; animation: cw-spin 0.8s linear infinite; flex-shrink: 0; }
@keyframes cw-spin { to { transform: rotate(360deg); } }

/* ── Wizard chat: logline header ── */
.wiz-logline-header { font-size: 0.85em; color: rgba(255,255,255,0.5); padding: 12px 16px; border-bottom: 1px solid rgba(255,255,255,0.08); font-style: italic; }
body.fd-light .wiz-logline-header { color: rgba(0,0,0,0.45); border-bottom-color: rgba(0,0,0,0.08); }

/* ── Fili narrativi (narrative threads) — sans-serif, muted ── */
.cw-ws-fili { margin: 8px 0; border-top: 1px solid rgba(255,255,255,0.06); }
.cw-ws-fili-summary { padding: 12px 24px; font-size: 0.85em; font-weight: 600; color: var(--cloto-text-70); cursor: pointer; text-transform: uppercase; letter-spacing: 0.5px; list-style: none; }
.cw-ws-fili-summary::-webkit-details-marker { display: none; }
.cw-ws-fili-summary::marker { display: none; content: ''; }
.cw-ws-fili-content { padding: 0 24px 16px; }
body.fd-light .cw-ws-fili { border-top-color: rgba(0,0,0,0.06); }
body.fd-light .cw-ws-fili-summary { color: rgba(0,0,0,0.5); }

/* ── Synopsis Card (centered, distinct) ── */
.cloto-chat-synopsis-card {
  background: var(--cloto-surface-alt, #22242f);
  border: 1px solid var(--cloto-glass-border);
  border-radius: 12px;
  padding: 20px 24px;
  max-width: 85%;
  margin: 16px auto;
  font-size: 15px;
  line-height: 1.7;
  color: var(--cloto-text-70);
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}
.cloto-synopsis-title {
  font-weight: 500;
  font-size: 16px;
  color: var(--cloto-teal);
  display: block;
  margin-bottom: 10px;
}
.cloto-synopsis-text {
  /* no italic — clean readable text */
}
body.fd-light .cloto-chat-synopsis-card {
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* ═══════════════════════════════════════════════════════════════
   WRITING COMPANION PANEL — structured reference for the author
   Replaces chat column when editor is open.
   ═══════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════════
   Writing panel — context column during editor-open.
   Design: single font (UI), single muted palette, tight spacing.
   ═══════════════════════════════════════════════════════════════ */

.cloto-writing-panel {
  padding: 20px 14px;
  max-width: 100%;
  height: 100%;
  overflow-y: auto;
  font-family: var(--cloto-font-ui, system-ui, -apple-system, sans-serif);
  font-size: 13px;
  line-height: 1.55;
  color: var(--cloto-text-60);
}
body.fd-light .cloto-writing-panel { color: #555; }

/* ── Slug line (narrative path breadcrumb) — Tier 3: chrome ── */
.cloto-wp__slug {
  font-size: 12px;
  font-weight: 400;
  letter-spacing: normal;
  line-height: 1.4;
  color: var(--cloto-text-40);
  margin-bottom: 16px;
}
body.fd-light .cloto-wp__slug { color: #7a7e88; }

/* ── Section (characters, locations, objects) ── */
.cloto-wp__section { margin-bottom: 18px; }

/* Section labels — Tier 3: chrome */
.cloto-wp__label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
  color: var(--cloto-text-30);
  margin-bottom: 8px;
}
body.fd-light .cloto-wp__label { color: #8d919a; }

.cloto-wp__char {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  padding: 4px 0;
}
.cloto-wp__char-header {
  display: inline;
}
.cloto-wp__char-header .cloto-wp__char-role { margin-left: 6px; }
.cloto-wp__char--tap .cloto-wp__char-header {
  cursor: pointer;
}
.cloto-wp__char--tap .cloto-wp__char-header:hover .cloto-wp__char-name {
  color: var(--cloto-text-100);
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
  text-decoration-color: var(--cloto-text-40);
}
body.fd-light .cloto-wp__char--tap .cloto-wp__char-header:hover .cloto-wp__char-name { color: #1a1c24; }

/* Entity names — Tier 1: readable but subordinate to editor text */
.cloto-wp__char-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--cloto-text-70);
}
body.fd-light .cloto-wp__char-name { color: #4a4e58; }

/* Roles/tags — Tier 3: chrome */
.cloto-wp__char-role {
  font-size: 13px;
  color: var(--cloto-text-30);
}
body.fd-light .cloto-wp__char-role { color: #8d919a; }

/* Expanded descriptions — Tier 2: body */
.cloto-wp__char-desc {
  display: none;
  width: 100%;
  font-size: 13px;
  line-height: 1.5;
  color: var(--cloto-text-50);
  padding-top: 2px;
}
body.fd-light .cloto-wp__char-desc { color: #6a6e78; }
.cloto-wp__char.is-open .cloto-wp__char-desc { display: block; }

/* ── Divider ── */
.cloto-wp__divider {
  border: none;
  border-top: 1px solid #252d3a;
  margin: 14px 0;
}
body.fd-light .cloto-wp__divider { border-top-color: #e5e7eb; }

/* ── Logline — Tier 2: body ── */
.cloto-wp__logline {
  font-size: 13px;
  font-style: italic;
  color: var(--cloto-text-50);
  line-height: 1.6;
  margin: 0 0 14px;
}
body.fd-light .cloto-wp__logline { color: #6a6e78; }

/* ── Dramatic question — Tier 2: body ── */
.cloto-wp__question {
  font-size: 13px;
  font-style: italic;
  color: var(--cloto-text-50);
  padding-left: 12px;
  border-left: 2px solid var(--cloto-text-25);
  line-height: 1.6;
}
body.fd-light .cloto-wp__question { color: #6a6e78; border-left-color: #ddd; }

/* ── Author notes — Tier 2: body ── */
.cloto-wp__note {
  font-size: 15px;
  font-style: italic;
  color: var(--cloto-text-50);
  line-height: 1.6;
  margin: 0 0 8px;
}
.cloto-wp__note:last-child { margin-bottom: 0; }
body.fd-light .cloto-wp__note { color: #6a6e78; }

/* ── Synopsis expandable details ── */
.cloto-synopsis-details {
  margin-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
  padding-top: 8px;
}
body.fd-light .cloto-synopsis-details { border-top-color: rgba(0,0,0,0.06); }
.cloto-synopsis-details__toggle {
  background: none;
  border: none;
  font-size: 12px;
  color: var(--cloto-text-40);
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}
.cloto-synopsis-details__toggle:hover { color: var(--cloto-text-60); }
body.fd-light .cloto-synopsis-details__toggle { color: rgba(0,0,0,0.4); }
body.fd-light .cloto-synopsis-details__toggle:hover { color: rgba(0,0,0,0.6); }
.cloto-synopsis-details__body {
  padding-top: 10px;
}
.cloto-synopsis-detail-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 10px;
}
.cloto-synopsis-detail-row:last-child { margin-bottom: 0; }
.cloto-synopsis-detail-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
  color: var(--cloto-text-30);
}
body.fd-light .cloto-synopsis-detail-label { color: rgba(0,0,0,0.35); }
.cloto-synopsis-detail-row > span:not(.cloto-synopsis-detail-label) {
  font-size: 13px;
  color: var(--cloto-text-60);
}
body.fd-light .cloto-synopsis-detail-row > span:not(.cloto-synopsis-detail-label) { color: rgba(0,0,0,0.55); }
.cloto-synopsis-char {
  display: block;
  font-size: 13px;
  color: var(--cloto-text-70);
}
body.fd-light .cloto-synopsis-char { color: rgba(0,0,0,0.65); }
.cloto-synopsis-char-note {
  color: var(--cloto-text-40);
  font-size: 12px;
}
body.fd-light .cloto-synopsis-char-note { color: rgba(0,0,0,0.4); }

/* ── Chat Divider ── */
.cloto-chat-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 16px 8px;
  font-size: 12px;
  color: var(--cloto-text-40);
  font-weight: 500;
  letter-spacing: 0.02em;
}
.cloto-chat-divider::before,
.cloto-chat-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--cloto-glass-border);
}

/* ── Index Panel ── */
.cloto-index-node {
  padding: 5px 8px 5px 12px;
  font-size: 13px;
  color: var(--cloto-text-40);
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: default;
  user-select: none;
  transition: background 0.15s, color 0.15s;
}
.cloto-index-node[data-depth="1"] { padding-left: 24px; }
.cloto-index-node[data-depth="2"] { padding-left: 36px; }
.cloto-index-node[data-depth="3"] { padding-left: 48px; }

.cloto-index-node--outlined  { opacity: 0.75; }
.cloto-index-node--exploring { color: var(--cloto-text-60); }
.cloto-index-node--confirmed { color: var(--cloto-text-70); }
.cloto-index-node--expanded  { color: var(--cloto-text-60); }
.cloto-index-node--writing   { color: var(--cloto-text-100); font-weight: 500; }
.cloto-index-node--woven     { color: var(--cloto-text-40); text-decoration: line-through; }
.cloto-index-node--skipped   { color: var(--cloto-text-40); text-decoration: line-through; font-style: italic; }

/* Skip writing link */
/* ── Skip writing link ── */
.cloto-skip-writing-wrap { width: 100%; margin-top: 6px; text-align: left; }
.cloto-skip-writing-link {
  font-size: 13px; color: #999; text-decoration: none;
  padding: 4px 0; display: inline-block; cursor: pointer;
  background: none; border: none;
}
.cloto-skip-writing-link:hover { color: #bbb; }
body.fd-light .cloto-skip-writing-link { color: #999; }
body.fd-light .cloto-skip-writing-link:hover { color: #666; }

/* ── Skip disclaimer card ── */
.cloto-skip-confirm {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 12px 14px;
  margin-top: 8px;
}
body.fd-light .cloto-skip-confirm {
  background: #F7F4EE;
  border-color: #e0dbd0;
}
.cloto-skip-confirm__text {
  font-size: 13px;
  color: rgba(255,255,255,0.55);
  line-height: 1.55;
  margin: 0 0 10px;
}
body.fd-light .cloto-skip-confirm__text { color: #6B6355; }
.cloto-skip-actions { display: flex; align-items: center; gap: 10px; }
/* .cloto-skip-yes styles moved to cloto-three-col.css (skip confirm row) */
.cloto-skip-no {
  font-size: 12px; color: rgba(255,255,255,0.35);
  text-decoration: none; cursor: pointer;
  padding: 6px 14px; background: none; border: none;
}
.cloto-skip-no:hover { color: rgba(255,255,255,0.5); }
body.fd-light .cloto-skip-no { color: #9A9387; }
body.fd-light .cloto-skip-no:hover { color: #6B6355; }

.cloto-index-node.is-current {
  background: #1e4848;
  border-radius: 0;
  color: var(--cloto-text-100);
  font-weight: 500;
}

.cloto-index-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cloto-teal);
  box-shadow: 0 0 4px var(--cloto-teal);
  flex-shrink: 0;
  animation: cloto-idx-pulse 2s ease-in-out infinite;
}
@keyframes cloto-idx-pulse {
  0%, 100% { opacity: 0.7; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.15); }
}

/* ── System font for UI panels ── */
#cloto-workspace,
#cloto-index-panel,
#fbw-workspace-chat,
.wiz-bubble,
.wiz-input {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
.cw-scene-textarea,
.cw-tessuto-view {
  font-family: 'Cardo', Georgia, serif;
}
#cloto-index-panel { font-size: 13px; }
#fbw-workspace-chat .wiz-bubble__content { font-size: 15px; }

/* ── Keep old class for backward compat ── */
.cloto-chat-bubble--synopsis { display: none; }

/* ═══════════════════════════════════════════════════════════════
   QUADERNO — Manuscript typeset view
   ═══════════════════════════════════════════════════════════════ */

.cloto-quaderno {
  max-width: 620px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 3rem;
}

.cloto-quaderno__title {
  font-family: var(--cloto-font-brand, 'Cardo', serif);
  font-size: 1.75rem;
  font-weight: 700;
  text-align: center;
  color: var(--cloto-gold, #c9a84c);
  margin: 0 0 0.4rem;
  line-height: 1.3;
}

.cloto-quaderno__logline {
  font-family: var(--cloto-font-brand, 'Cardo', serif);
  font-size: 1rem;
  text-align: center;
  color: var(--cloto-text-50, rgba(255,255,255,0.35));
  margin: 0 0 1.5rem;
  line-height: 1.5;
}

.cloto-quaderno__divider {
  border: none;
  border-top: 1px solid var(--cloto-border, rgba(255,255,255,0.08));
  margin: 0 auto 2rem;
  width: 40%;
}

.cloto-quaderno__scene {
  margin-bottom: 1.8rem;
}

.cloto-quaderno__scene-title {
  font-family: var(--cloto-font-brand, 'Cardo', serif);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--cloto-text-50, rgba(255,255,255,0.5));
  margin: 0 0 0.4rem;
  line-height: 1.3;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.cloto-quaderno__scene-title--link {
  cursor: pointer;
  transition: color 0.15s;
}
.cloto-quaderno__scene-title--link:hover {
  color: var(--cloto-text-80, rgba(255,255,255,0.7));
}
.cloto-quaderno__write-hint {
  font-size: 0.8em;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--cloto-gold, #c9a84c);
}

.cloto-quaderno__text {
  font-family: var(--cloto-font-brand, 'Cardo', serif);
  font-size: 1.05rem;
  font-weight: 400;
  color: var(--cloto-editor-text, rgba(224,220,214,0.92));
  line-height: 1.8;
  margin: 0 0 0.8rem;
}
.cloto-quaderno__text--logline {
  opacity: 0.5;
}
.cloto-quaderno__text--synopsis {
  opacity: 0.7;
}
.cloto-quaderno__text--author {
  text-indent: 0;
}


/* Part title — root card in multi-root projects */
.cloto-quaderno__part {
  margin-top: 3rem;
}
.cloto-quaderno__part:first-child {
  margin-top: 0;
}
.cloto-quaderno__part-title {
  font-family: var(--cloto-font-brand, 'Cardo', serif);
  font-size: 1.5rem;
  font-weight: 400;
  text-align: center;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cloto-text-60, rgba(255,255,255,0.5));
  margin: 2rem 0 0.5rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--cloto-border, rgba(255,255,255,0.08));
  border-bottom: 1px solid var(--cloto-border, rgba(255,255,255,0.08));
}
.cloto-quaderno__part:first-child .cloto-quaderno__part-title {
  border-top: none;
  margin-top: 0;
}

/* Group title — intermediate container nodes */
.cloto-quaderno__group-title {
  font-family: var(--cloto-font-brand, 'Cardo', serif);
  font-weight: 400;
  text-align: center;
  color: var(--cloto-text-50, rgba(255,255,255,0.4));
  letter-spacing: 0.04em;
}
.cloto-quaderno__group-title--h2 {
  font-size: 1.2rem;
  margin: 2.5rem 0 1.2rem;
}
.cloto-quaderno__group-title--h3 {
  font-size: 1.05rem;
  margin: 2rem 0 1rem;
}
.cloto-quaderno__group-title--h4 {
  font-size: 0.95rem;
  margin: 1.5rem 0 0.8rem;
  font-style: italic;
}

/* Scene break — *** between sibling scenes */
.cloto-quaderno__scene-break {
  text-align: center;
  margin: 1.5rem 0;
  color: var(--cloto-text-30, rgba(255,255,255,0.15));
  font-size: 0.9rem;
  letter-spacing: 0.5em;
}
.cloto-quaderno__scene-break::before {
  content: '*\00a0\00a0*\00a0\00a0*';
}

/* "nuovo" badge inside quaderno */
.cloto-quaderno__new {
  display: inline-block;
  font-family: var(--cloto-font-ui, sans-serif);
  font-size: 0.65rem;
  font-weight: 600;
  font-style: normal;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 3px;
  margin-left: 8px;
  vertical-align: middle;
  animation: cloto-badge-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.cloto-quaderno__new--territory {
  background: var(--cloto-teal-a20, rgba(0,210,190,0.15));
  color: var(--cloto-teal, #3ecfcf);
}
.cloto-quaderno__new--written {
  background: var(--cloto-gold-a20, rgba(201,168,76,0.15));
  color: var(--cloto-gold, #c9a84c);
}
body.fd-light .cloto-quaderno__new--territory {
  background: rgba(29, 158, 117, 0.12);
  color: #1D9E75;
}
body.fd-light .cloto-quaderno__new--written {
  background: rgba(184, 150, 11, 0.12);
  color: #8a6d2b;
}

/* Legacy separator (backward compat) */
.cloto-quaderno__separator {
  text-align: center;
  margin: 1.2rem 0;
  color: var(--cloto-text-30, rgba(255,255,255,0.15));
  font-size: 0.9rem;
  letter-spacing: 0.5em;
}
.cloto-quaderno__separator::before {
  content: '\2022  \2022  \2022';
}

.cloto-quaderno__empty {
  font-family: var(--cloto-font-brand, 'Cardo', serif);
  font-size: 1.05rem;
  font-style: italic;
  text-align: center;
  color: var(--cloto-text-30, rgba(255,255,255,0.2));
  padding: 3rem 0;
}

/* Light theme */
body.fd-light .cloto-quaderno__title { color: #8a6d2b; }
body.fd-light .cloto-quaderno__logline { color: rgba(0,0,0,0.4); }
body.fd-light .cloto-quaderno__divider { border-top-color: rgba(0,0,0,0.1); }
body.fd-light .cloto-quaderno__scene-title { color: rgba(0,0,0,0.45); }
body.fd-light .cloto-quaderno__text { color: #333; }
body.fd-light .cloto-quaderno__part-title { color: rgba(0,0,0,0.5); border-color: rgba(0,0,0,0.1); }
body.fd-light .cloto-quaderno__group-title { color: rgba(0,0,0,0.4); }
body.fd-light .cloto-quaderno__scene-break { color: rgba(0,0,0,0.15); }
body.fd-light .cloto-quaderno__separator { color: rgba(0,0,0,0.15); }
body.fd-light .cloto-quaderno__empty { color: rgba(0,0,0,0.25); }

/* ── Quaderno mobile: tighter padding, larger text ── */
@media (max-width: 768px) {
  .cloto-quaderno {
    padding: 1.2rem 0.8rem 2rem;
  }
  .cloto-quaderno__text {
    font-size: 1.1rem;
  }
  .cloto-quaderno__title {
    font-size: 1.5rem;
    margin-top: 2rem;
  }
  .cloto-quaderno__logline {
    font-size: 0.95rem;
  }
}

/* Small viewport — compact textarea */
@media (max-height: 700px) {
  .wiz-input__field {
    max-height: 80px;
  }
}
