/* Gerador workspace shell — partilhado (carregar após design-tokens, app-shell, workspace-dark) */

/* ══════════════════════════════════════════════════
   DESIGN TOKENS LOCAIS (fallback)
══════════════════════════════════════════════════ */
:root {
  --gold:       #E8A847;
  --gold-dim:   rgba(232,168,71,.12);
  --gold-line:  rgba(232,168,71,.25);
  --gold-glow:  rgba(232,168,71,.35);
  --green:      #10B981;
  --blue:       #3B82F6;
  --amber:      #F59E0B;
  --red:        #EF4444;
  --purple:     #7C3AED;

  --bg:         #0B1120;
  --surface:    #111827;
  --surface2:   #1E293B;
  --border:     rgba(148,163,184,.14);
  --border-md:  rgba(148,163,184,.22);
  --text:       #F1F5F9;
  --text-2:     #94A3B8;
  --text-3:     #64748B;
  --muted:      #475569;

  --radius-xs:  4px;
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  14px;
  --radius-xl:  20px;

  --font-body:    'Inter', system-ui, sans-serif;
  --font-heading: 'Outfit', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, monospace;

  --col-nav:    220px;
  /* Painel Sofia: mais leitura — evita coluna estreita + texto denso */
  --col-sofia:  clamp(360px, 28vw, 460px);
  --col-form:   1fr;
}

/* ── Reset / Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  font-family: var(--font-body);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ══════════════════════════════════════════════════
   LAYOUT PRINCIPAL — 2 COLUNAS (Sofia agora é popup flutuante)
══════════════════════════════════════════════════ */
.workspace {
  display: grid;
  grid-template-columns: var(--col-nav) 1fr;
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "header header"
    "nav    form";
  min-height: calc(100vh - 56px); /* app-shell topbar */
  gap: 0;
}

/* ── Page Header ── */
.ws-header {
  grid-area: header;
  padding: 24px 28px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  background: linear-gradient(
    to bottom,
    rgba(196,154,60,.06) 0%,
    transparent 100%
  );
}
.ws-header-left { flex: 1; }
.ws-header-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--gold);
  background: var(--gold-dim);
  border: 1px solid var(--gold-line);
  padding: 3px 10px;
  border-radius: 20px;
  display: inline-block;
  margin-bottom: 10px;
}
.ws-header-title {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 400;
  color: var(--text);
  letter-spacing: -.01em;
  line-height: 1.2;
}
.ws-header-sub {
  font-size: 12px;
  color: var(--text-2);
  margin-top: 4px;
  line-height: 1.5;
  max-width: 560px;
}
.ws-header-right { flex-shrink: 0; }
.btn-emp-select {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface2);
  border: 1px solid var(--border-md);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: border-color .2s, color .2s;
}
.btn-emp-select:hover { border-color: var(--gold-line); color: var(--gold); }
.btn-emp-select .dot-live {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px rgba(16,185,129,.6);
  flex-shrink: 0;
}
.btn-emp-select .emp-name {
  color: var(--text);
  font-weight: 600;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.btn-emp-select .emp-name.empty { color: var(--text-3); font-weight: 400; font-style: italic; }

/* ── Nav Lateral ── */
.ws-nav {
  grid-area: nav;
  border-right: 1px solid var(--border);
  padding: 20px 12px;
  overflow-y: auto;
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px - 65px);
}
.ws-nav::-webkit-scrollbar { width: 3px; }
.ws-nav::-webkit-scrollbar-thumb { background: var(--border-md); border-radius: 2px; }

.nav-section-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 0 10px;
  margin-bottom: 8px;
  margin-top: 20px;
}
.nav-section-label:first-child { margin-top: 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .2s;
  text-decoration: none;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 2px;
}
.nav-item:hover {
  background: rgba(196,154,60,.06);
  border-color: var(--gold-line);
  color: var(--text);
}
.nav-item.active {
  background: var(--gold-dim);
  border-color: var(--gold-line);
  color: var(--gold);
  box-shadow: 0 0 0 1px rgba(196,154,60,.12) inset;
}
.nav-item .nav-icon {
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  background: var(--surface2);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 13px;
  color: var(--text-2);
  transition: background .2s, border-color .2s, color .2s;
}
.nav-item .nav-icon svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: block;
}
.nav-item.active .nav-icon {
  background: rgba(196,154,60,.18);
  border-color: var(--gold-line);
  color: var(--gold);
}
.nav-item .nav-label { line-height: 1.3; }
.nav-item .nav-sub {
  font-size: 10px;
  color: var(--text-3);
  display: block;
  margin-top: 1px;
  font-weight: 400;
}
.nav-item.active .nav-sub { color: rgba(196,154,60,.65); }

/* ── Separador nav ── */
.nav-divider { height: 1px; background: var(--border); margin: 14px 10px; }

/* ── Área do Formulário ── */
.ws-form {
  grid-area: form;
  padding: 24px 28px;
  overflow-y: auto;
  min-height: calc(100vh - 56px - 65px);
}
.ws-form::-webkit-scrollbar { width: 4px; }
.ws-form::-webkit-scrollbar-thumb { background: var(--border-md); border-radius: 2px; }

/* ── Empreendimento Banner ── */
.emp-banner {
  display: none;
  align-items: center;
  gap: 12px;
  background: rgba(16,185,129,.07);
  border: 1px solid rgba(16,185,129,.2);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  margin-bottom: 20px;
  font-size: 12px;
  color: var(--green);
  animation: fadeIn .3s ease;
}
.emp-banner.visible { display: flex; }
.emp-banner svg { flex-shrink: 0; opacity: .75; }
.emp-banner strong { color: var(--text); }

/* Toast (validação empreendimento / erros) */
#gerador-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(120px);
  z-index: 500;
  max-width: min(440px, calc(100vw - 32px));
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--gold-line);
  border-radius: var(--radius-lg);
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s ease, opacity 0.25s ease;
}
#gerador-toast.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}
#gerador-toast.is-error {
  border-color: rgba(239, 68, 68, 0.45);
  color: #fecaca;
}

/* ── Step Cards ── */
.step-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  margin-bottom: 16px;
  transition: border-color .2s;
}
.step-card:hover { border-color: var(--border-md); }
.step-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.step-num {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .2em;
  color: var(--gold);
  text-transform: uppercase;
}
.step-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.step-divider { flex: 1; height: 1px; background: var(--border); }

/* ── Fields ── */
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: 6px;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border-md);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(196,154,60,.1);
}
.field input::placeholder,
.field textarea::placeholder { color: var(--muted); opacity: .7; }
.field textarea { resize: vertical; min-height: 80px; }
.field 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='%2364748B' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
  cursor: pointer;
}
.field select option { background: var(--surface2); }

/* Campos preenchidos ao escolher empreendimento no topo (não é "automático" sem projeto) */
.badge-auto {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--green);
  background: rgba(16,185,129,.1);
  border: 1px solid rgba(16,185,129,.22);
  padding: 2px 7px;
  border-radius: 20px;
  margin-left: 6px;
  vertical-align: middle;
}

.field-row { display: grid; gap: 14px; margin-bottom: 14px; }
.cols2 { grid-template-columns: 1fr 1fr; }
.cols3 { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 700px) { .cols2, .cols3 { grid-template-columns: 1fr; } }

/* ── Disclaimer ── */
.disclaimer {
  background: rgba(245,158,11,.06);
  border: 1px solid rgba(245,158,11,.22);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 11.5px;
  color: rgba(251,191,36,.75);
  line-height: 1.6;
  margin-bottom: 16px;
}
.disclaimer strong { color: var(--amber); }

/* ── Botão Gerar ── */
.btn-gerar {
  width: 100%;
  background: linear-gradient(135deg, var(--gold), #C9944A);
  border: none;
  border-radius: var(--radius-lg);
  padding: 15px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: box-shadow .3s, transform .2s;
  box-shadow: 0 4px 24px rgba(196,154,60,.2);
  letter-spacing: .02em;
}
.btn-gerar::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,.15), transparent);
  opacity: 0;
  transition: opacity .2s;
}
.btn-gerar:hover:not(:disabled) {
  box-shadow: 0 6px 32px rgba(196,154,60,.38);
  transform: translateY(-1px);
}
.btn-gerar:hover:not(:disabled)::before { opacity: 1; }
.btn-gerar:disabled { opacity: .45; cursor: not-allowed; transform: none; }

/* Botões secundários */
.btn-secondary {
  background: transparent;
  border: 1px solid var(--border-md);
  border-radius: var(--radius-md);
  padding: 10px 18px;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  transition: border-color .2s, color .2s;
}
.btn-secondary:hover { border-color: var(--gold-line); color: var(--gold); }
.btn-row { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }

/* ── Preview Box ── */
.preview-wrap { display: none; animation: fadeIn .3s ease; }
.preview-wrap.visible { display: block; }
.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}
.preview-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(16,185,129,.1);
  border: 1px solid rgba(16,185,129,.25);
  border-radius: 20px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--green);
  padding: 3px 10px;
  letter-spacing: .05em;
}
.preview-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 2;
  color: var(--text-2);
  white-space: pre-wrap;
  max-height: 440px;
  overflow-y: auto;
}
.preview-box::-webkit-scrollbar { width: 3px; }
.preview-box::-webkit-scrollbar-thumb { background: var(--border-md); border-radius: 2px; }
.preview-box .ph {
  color: var(--amber);
  font-weight: 600;
}

/* ── Opportunity Banner ── */
.opp-banner {
  display: none;
  animation: slideDown .35s cubic-bezier(.34,1.3,.64,1);
}
.opp-banner.show { display: block; }
.opp-card {
  background: linear-gradient(
    135deg,
    rgba(196,154,60,.1) 0%,
    rgba(16,185,129,.06) 100%
  );
  border: 1px solid rgba(196,154,60,.3);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-top: 16px;
}
.opp-icon { font-size: 28px; flex-shrink: 0; line-height: 1; }
.opp-body { flex: 1; }
.opp-title { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.opp-desc { font-size: 12px; color: var(--text-2); line-height: 1.6; margin-bottom: 12px; }
.opp-actions { display: flex; align-items: center; gap: 10px; }
.btn-opp {
  background: linear-gradient(135deg, var(--gold), #C9944A);
  border: none;
  border-radius: var(--radius-md);
  padding: 8px 16px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  transition: box-shadow .2s, transform .15s;
  text-decoration: none;
  display: inline-block;
}
.btn-opp:hover { box-shadow: 0 4px 16px rgba(196,154,60,.35); transform: translateY(-1px); }
.btn-opp-dismiss {
  background: none;
  border: none;
  font-size: 11px;
  color: var(--text-3);
  cursor: pointer;
  transition: color .15s;
}
.btn-opp-dismiss:hover { color: var(--text-2); }

/* ══════════════════════════════════════════════════
   SOFIA CO-PILOT — PAINEL LATERAL FIXO
══════════════════════════════════════════════════ */
/* Links nas respostas da Sofia (URLs e wa.me) */
.sofia-link {
  color: var(--gold);
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-all;
}
.sofia-link:hover {
  color: var(--text);
}

/* ══════════════════════════════════════════════════
   SOFIA FAB — Botão flutuante sempre visível
══════════════════════════════════════════════════ */
.sofia-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-blue, #3B82F6), var(--color-blue-deep, #1D4ED8));
  border: none;
  box-shadow: 0 4px 20px rgba(59,130,246,.4);
  z-index: 900;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .2s, box-shadow .2s;
  color: #fff;
}
.sofia-fab:hover { transform: scale(1.08); box-shadow: 0 6px 28px rgba(59,130,246,.55); }
.sofia-fab-letter {
  font-family: var(--font-heading);
  font-size: 22px;
  font-style: italic;
  line-height: 1;
  pointer-events: none;
}
/* Badge — oportunidade detectada */
.sofia-fab--badge { position: relative; }
.sofia-fab--badge::after {
  content: '';
  position: absolute;
  top: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--red);
  border: 2px solid var(--bg);
  animation: fadeIn .3s ease;
}
/* Pulse — contexto mudou, Sofia tem dica */
.sofia-fab--pulse {
  animation: sofiaPulse 2s ease-in-out 3;
}
@keyframes sofiaPulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(59,130,246,.4); }
  50% { box-shadow: 0 4px 20px rgba(59,130,246,.4), 0 0 0 14px rgba(59,130,246,.12); }
}
/* Ocultar FAB quando popup está aberto */
.sofia-fab.hidden { opacity: 0; pointer-events: none; transform: scale(.8); }

/* ── Sofia Lite Kit Popup — overlay do gerador em modo kit_lp ── */
.sofia-lite-kit-popup {
  position: fixed;
  bottom: 90px;
  right: 20px;
  width: min(420px, calc(100vw - 32px));
  max-height: calc(100dvh - 120px);
  overflow-y: auto;
  z-index: 950;
  border-radius: 18px;
  box-shadow: 0 16px 48px rgba(0,0,0,.45);
  background: #0F172A;
  padding: 1rem;
}
.sofia-lite-kit-popup[hidden] { display: none; }
.sofia-lite-kit-close {
  position: absolute;
  top: .6rem;
  right: .7rem;
  background: rgba(255,255,255,.08);
  border: 0;
  color: #94A3B8;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}
.sofia-lite-kit-close:hover { background: rgba(255,255,255,.15); color: #F1F5F9; }
@media (max-width: 480px) {
  .sofia-lite-kit-popup {
    bottom: 80px;
    right: 8px;
    left: 8px;
    width: auto;
  }
}

/* ── Sofia Capture Bubble — balão contextual (capital social) ── */
@keyframes bubbleIn {
  from { opacity: 0; transform: translateY(10px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.sofia-capture-bubble {
  position: fixed;
  bottom: 88px;
  right: 24px;
  width: 220px;
  background: rgba(10, 16, 30, 0.92);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(51, 65, 85, 0.8);
  border-left: 3px solid rgba(196, 154, 60, 0.85);
  border-radius: 0 12px 12px 0;
  padding: 12px 14px 12px 16px;
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.6;
  z-index: 998;
  display: none;
  animation: bubbleIn .3s cubic-bezier(.34,1.3,.64,1);
}
.sofia-capture-bubble.show { display: block; }
.sofia-capture-bubble p { margin: 0 0 10px; }
.sofia-capture-bubble .sofia-capture-close {
  position: absolute;
  top: 6px;
  right: 8px;
  background: none;
  border: none;
  color: var(--text-3);
  font-size: 14px;
  cursor: pointer;
  line-height: 1;
  padding: 2px 4px;
}
.sofia-capture-bubble .sofia-capture-close:hover { color: var(--text-1); }
.sofia-capture-bubble .btn-mini {
  background: linear-gradient(135deg, var(--gold), #C9944A);
  border: none;
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  font-family: var(--font-body);
  transition: opacity .2s;
}
.sofia-capture-bubble .btn-mini:hover { opacity: .85; }

/* ══════════════════════════════════════════════════
   SOFIA POPUP — Modal glass flutuante
══════════════════════════════════════════════════ */
.sofia-popup {
  position: fixed;
  bottom: 88px;
  right: 24px;
  width: min(400px, calc(100vw - 48px));
  height: min(520px, calc(100vh - 160px));
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(51, 65, 85, 0.9);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.5), 0 0 0 1px rgba(196,154,60,.06);
  z-index: 901;
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.sofia-popup.open {
  display: flex;
  animation: sofiaPopupIn .25s ease-out;
}
@keyframes sofiaPopupIn {
  from { opacity: 0; transform: translateY(16px) scale(.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
/* Close button inside popup header */
.sofia-close-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(148,163,184,.1);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-3);
  font-size: 14px;
  transition: background .15s, color .15s;
  flex-shrink: 0;
  margin-left: auto;
}
.sofia-close-btn:hover { background: rgba(239,68,68,.15); color: var(--red); }

/* ── Sofia Header ── */
.sofia-head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  background: linear-gradient(
    to bottom,
    rgba(196,154,60,.04),
    transparent
  );
}
.sofia-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--green));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-size: 16px;
  font-style: italic;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 2px 12px rgba(196,154,60,.3);
}
.sofia-head-info { flex: 1; }
.sofia-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.sofia-status {
  font-size: 10px;
  color: var(--green);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 1px;
}
.sofia-status::before {
  content: '';
  display: inline-block;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 5px rgba(16,185,129,.7);
}
.sofia-context-badge {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--gold);
  background: var(--gold-dim);
  border: 1px solid var(--gold-line);
  padding: 2px 8px;
  border-radius: 20px;
}

/* ── Sofia Context Strip ── */
.sofia-context-strip {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,.15);
  flex-shrink: 0;
}
.sofia-ctx-label {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--text-3);
  margin-bottom: 6px;
}
.sofia-ctx-pills { display: flex; flex-wrap: wrap; gap: 5px; }
.sofia-ctx-pill {
  font-size: 10px;
  color: var(--text-2);
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 3px 9px;
  border-radius: 20px;
  cursor: pointer;
  transition: all .15s;
  font-family: var(--font-mono);
}
.sofia-ctx-pill:hover { border-color: var(--gold-line); color: var(--gold); }

.sofia-follow-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.sofia-follow-chip {
  font-size: 10px;
  color: var(--text-2);
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font-body, inherit);
}
.sofia-follow-chip:hover { border-color: var(--gold-line); color: var(--gold); }

/* ── Sofia Messages ── */
.sofia-msgs {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}
.sofia-msgs::-webkit-scrollbar { width: 6px; }
.sofia-msgs::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.35); border-radius: 6px; }

.msg {
  max-width: 100%;
  width: 100%;
  font-size: 13px;
  line-height: 1.72;
  letter-spacing: 0.01em;
  border-radius: 14px;
  padding: 0;
  animation: msgIn .22s ease;
  word-break: break-word;
  overflow-wrap: anywhere;
  hyphens: auto;
  -webkit-hyphens: auto;
}
.msg.bot {
  background: rgba(30, 41, 59, 0.75);
  border: 1px solid rgba(51, 65, 85, 0.85);
  color: rgba(226, 232, 240, 0.95);
  align-self: stretch;
  border-bottom-left-radius: 4px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
}
.msg.user {
  max-width: 92%;
  width: auto;
  align-self: flex-end;
  background: var(--gold-dim);
  border: 1px solid var(--gold-line);
  color: var(--text);
  border-bottom-right-radius: 4px;
  padding: 12px 16px;
}
/* Corpo do texto: parágrafos com cadência (resp. longas da API) */
.msg-body {
  padding: 14px 18px 16px;
}
.msg-body--cadenced p {
  margin: 0 0 0.95em;
  max-width: 62ch;
}
.msg-body--cadenced p:last-child {
  margin-bottom: 0;
}
.msg--welcome .msg-lead {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 0.75em;
}
.msg--welcome .msg-cta {
  margin-top: 0.5em;
  font-size: 12.5px;
  color: var(--gold);
  font-weight: 500;
}
.msg.bot .msg-body strong {
  color: rgba(251, 191, 36, 0.95);
  font-weight: 600;
}
.msg.typing {
  padding: 14px 18px !important;
  width: auto !important;
  max-width: 56px !important;
  align-self: flex-start !important;
}
.msg.typing .dot {
  display: inline-block;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--text-3);
  animation: typingDot .9s infinite;
  margin: 0 2px;
}
.msg.typing .dot:nth-child(2) { animation-delay: .15s; }
.msg.typing .dot:nth-child(3) { animation-delay: .3s; }

/* ── Sofia Atalhos Inteligentes (menos peso visual que a conversa) ── */
.sofia-opp-inline {
  margin: 0 18px 12px;
  padding: 12px 14px 12px 16px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(51, 65, 85, 0.9);
  border-left: 3px solid rgba(196, 154, 60, 0.75);
  border-radius: 0 10px 10px 0;
  font-size: 12px;
  display: none;
  animation: fadeIn .3s ease;
}
.sofia-opp-inline.show { display: block; }
.sofia-opp-inline strong { color: var(--gold); display: block; font-size: 11.5px; margin-bottom: 6px; letter-spacing: 0.02em; }
.sofia-opp-inline p { color: var(--text-2); line-height: 1.62; margin-bottom: 10px; max-width: 58ch; }
.sofia-opp-inline .btn-mini {
  background: linear-gradient(135deg, var(--gold), #C9944A);
  border: none;
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  font-family: var(--font-body);
  transition: opacity .2s;
}
.sofia-opp-inline .btn-mini:hover { opacity: .85; }

/* ── Sofia Input ── */
.sofia-input-wrap {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  background: rgba(0,0,0,.12);
  flex-shrink: 0;
}
.sofia-input-row { display: flex; gap: 8px; }
.sofia-input {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border-md);
  border-radius: var(--radius-md);
  padding: 11px 15px;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: border-color .2s;
  line-height: 1.45;
}
.sofia-input:focus { border-color: var(--gold); }
.sofia-input::placeholder { color: var(--muted); }
.sofia-send {
  background: linear-gradient(135deg, var(--gold), #C9944A);
  border: none;
  border-radius: var(--radius-md);
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: #fff;
  transition: opacity .2s;
  flex-shrink: 0;
}
.sofia-send:hover { opacity: .85; }
.sofia-hint {
  font-size: 10px;
  color: var(--text-3);
  margin-top: 7px;
  line-height: 1.45;
}

/* ══════════════════════════════════════════════════
   MODAL EMPREENDIMENTO
══════════════════════════════════════════════════ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(5,10,20,.8);
  z-index: 500;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--surface);
  border: 1px solid var(--border-md);
  border-radius: var(--radius-xl);
  padding: 26px;
  width: min(480px, 96vw);
  box-shadow: 0 24px 64px rgba(0,0,0,.6);
  animation: modalIn .22s cubic-bezier(.34,1.3,.64,1);
}
.modal-box h3 {
  font-family: var(--font-heading);
  font-size: 17px;
  color: var(--text);
  margin-bottom: 18px;
}
.modal-list { display: flex; flex-direction: column; gap: 6px; }
.modal-emp-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.modal-emp-item:hover { border-color: var(--gold-line); background: rgba(196,154,60,.05); }
.modal-emp-item .emp-n { font-size: 13px; font-weight: 600; color: var(--text); }
.modal-emp-item .emp-m { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.modal-emp-item .emp-badge {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-3);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 2px 7px;
  border-radius: 20px;
}
.modal-close-btn {
  margin-top: 16px;
  width: 100%;
  background: transparent;
  border: 1px solid var(--border-md);
  border-radius: var(--radius-md);
  padding: 10px;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  transition: border-color .2s;
}
.modal-close-btn:hover { border-color: var(--border-md); color: var(--text); }

/* ══════════════════════════════════════════════════
   ANIMAÇÕES
══════════════════════════════════════════════════ */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(.95); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes typingDot {
  0%, 80%, 100% { transform: scale(1); opacity: .4; }
  40%           { transform: scale(1.3); opacity: 1; }
}

/* ══════════════════════════════════════════════════
   RESPONSIVO
══════════════════════════════════════════════════ */
/* Tablet: nav still visible */
@media (max-width: 1100px) {
  .ws-form { padding: 20px; }
}
/* Mobile: nav collapses */
@media (max-width: 720px) {
  .workspace {
    grid-template-columns: 1fr;
    grid-template-areas:
      "header"
      "form";
  }
  .ws-nav { display: none; }
  .ws-form { padding: 16px; }
  .ws-header { padding: 16px; }
  /* Sofia popup fills more of the screen */
  .sofia-popup {
    width: calc(100vw - 16px);
    height: 70vh;
    bottom: 8px;
    right: 8px;
    border-radius: 14px;
  }
  .sofia-fab {
    width: 48px;
    height: 48px;
    bottom: 16px;
    right: 16px;
  }
  .sofia-fab-letter { font-size: 19px; }
}

/* ── Bloco vazio (formulário escondido antes de selecionar ato) ── */
.empty-state-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  color: var(--text-3);
  text-align: center;
  gap: 10px;
}
.empty-state-form svg { opacity: .3; }
.empty-state-form p { font-size: 13px; line-height: 1.6; max-width: 280px; }

/* ═══ Gerador universal: .ato-tab / links dentro de .ws-nav ═══ */
.ws-nav .doc-nav-group-title {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 6px 10px 4px;
}
.ws-nav .doc-nav-link {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: background .2s, color .2s;
}
.ws-nav .doc-nav-link:hover {
  color: var(--text);
  background: rgba(196,154,60,.06);
}
.ws-nav .ato-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .2s;
  text-align: left;
  width: 100%;
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-body);
  margin-bottom: 2px;
}
.ws-nav .ato-tab:hover {
  background: rgba(196,154,60,.06);
  border-color: var(--gold-line);
  color: var(--text);
}
.ws-nav .ato-tab.active {
  background: var(--gold-dim);
  border-color: var(--gold-line);
  color: var(--gold);
  box-shadow: 0 0 0 1px rgba(196,154,60,.12) inset;
}
.ws-nav .doc-nav-scroll {
  max-height: none;
  overflow-y: visible;
  padding: 0;
  width: 100%;
}
.ws-nav .doc-nav-group {
  margin-bottom: 12px;
}
.ws-nav .ato-tab.doc-nav-btn--tipo {
  font-size: 11px;
  line-height: 1.35;
}

/* Botão principal (gerador universal usa .btn-submit) */
.btn-submit {
  width: 100%;
  background: linear-gradient(135deg, var(--gold), #C9944A);
  border: none;
  border-radius: var(--radius-lg);
  padding: 15px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: box-shadow .3s, transform .2s;
  box-shadow: 0 4px 24px rgba(196,154,60,.2);
  letter-spacing: .02em;
}
.btn-submit:hover:not(:disabled) {
  box-shadow: 0 6px 32px rgba(196,154,60,.38);
  transform: translateY(-1px);
}
.btn-submit:disabled {
  opacity: .45;
  cursor: not-allowed;
  transform: none;
}