@charset "UTF-8";

:root {
  --ink: #1A1A18;
  --paper: #FAFAF7;
  --paper-dim: #F1F0EA;
  --line: #D8D6CC;
  --line-strong: #8C8C82;
  --accent: #b3142a;
  --accent-dim: #F7DEE1;
  --done: #3D7A5C;
  --done-dim: #DEEBE3;
  --err: #B42318;
  --err-dim: #FDECEA;
  --shadow: 0 4px 12px rgba(26,26,24,0.08);
  --display: 'Archivo Expanded', 'Archivo', sans-serif;
  --head: 'Archivo', sans-serif;
  --mono: 'Space Mono', monospace;
  --body: 'Inter', sans-serif;
  --radius: 4px;
  --transition: 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* ---------- RESET E BASE ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--paper-dim); /* Padrão para Login e Admin */
  color: var(--ink);
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Garante que o dashboard herda a cor correta automaticamente */
body:has(.shell) {
  background: var(--paper);
}

::selection { background: var(--accent); color: var(--paper); }
a { color: inherit; text-decoration: none; transition: color var(--transition); }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
}

/* Efeito de Foco Inteligente e Suave (Focus Ring) */
button:focus-visible, 
input:focus-visible, 
select:focus-visible, 
[tabindex]:focus-visible, 
textarea:focus-visible {
  outline: none;
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px var(--accent-dim) !important;
}

[hidden] { display: none !important; }

/* ---------- COMPONENTES PARTILHADOS ---------- */

/* Topbar / Marcas */
.topbar {
  background: var(--paper);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 28px;
  gap: 16px;
}
.dashboard-layout .topbar { padding: 22px 0 18px; } /* Ajuste fino do dashboard */

.brand { display: flex; align-items: center; gap: 12px; }
.brand[role="button"] { cursor: pointer; border-radius: var(--radius); transition: opacity var(--transition); }
.brand[role="button"]:hover { opacity: 0.72; }
.brand[role="button"]:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-dim); }
.brand-mark { width: 56px; height: 56px; object-fit: contain; display: block; }
.topbar .brand-mark { width: 38px; height: 38px; flex-shrink: 0; }

/* Menu de navegação central do topbar (Projetos / Portfólio) */
.nav-tabs { display: flex; align-items: center; gap: 4px; }
.nav-tab {
  position: relative;
  font-family: var(--head);
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: 0.01em;
  color: var(--line-strong);
  padding: 8px 14px;
  border-radius: var(--radius);
  transition: color var(--transition), background var(--transition);
}
.nav-tab:hover { color: var(--ink); background: var(--paper-dim); }
.nav-tab.is-active { color: var(--ink); }
/* Indicador visual sutil sob a aba ativa */
.nav-tab.is-active::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: -2px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}
@media (max-width: 640px) {
  .nav-tab { font-size: 12.5px; padding: 6px 10px; }
  .nav-tab.is-active::after { left: 10px; right: 10px; }
}

.brand-name { font-family: var(--display); font-weight: 800; font-size: 20px; letter-spacing: 0.01em; line-height: 1.1; }
.topbar .brand-name { font-size: 16px; }

.brand-sub { font-family: var(--mono); font-size: 11px; color: var(--line-strong); letter-spacing: 0.06em; text-transform: uppercase; margin-top: 4px; }
.topbar .brand-sub { font-size: 10.5px; margin-top: 0; }

.who { display: flex; align-items: center; gap: 16px; }
.who-email { font-family: var(--mono); font-size: 12px; color: #545454; }

/* Notificações (Alertas) */
.notice {
  font-family: var(--body); font-size: 13px; line-height: 1.45;
  padding: 12px 14px; margin-bottom: 22px;
  border: 1.5px solid var(--line);
  display: none;
  border-radius: var(--radius);
  transition: all var(--transition);
}
.notice.show { display: block; }
.notice.error { color: var(--err); background: var(--err-dim); border-color: #F1C4BF; }
.notice.ok { color: var(--done); background: #E7F1EC; border-color: #BFD9CC; }
.notice.info { color: var(--ink); background: var(--paper-dim); }

/* ============================================================
   SISTEMA DE NOTIFICAÇÕES GLOBAIS (toast + confirmação)
   ------------------------------------------------------------
   Toast fixo no canto superior direito, injetado dinamicamente. A cor de
   destaque (--notification-color) é definida por tipo. Segue os raios de
   arredondamento (--radius) e as fontes do projeto.
   ============================================================ */
.notification {
  --notification-color: var(--accent-900, #49a87d);
  color: var(--ink);
  font-family: var(--body);
  position: fixed;
  display: flex;
  font-size: 14px;
  line-height: 1.4;
  gap: 1.25rem;
  top: 0;
  right: 0;
  margin: 2rem;
  width: 24rem;
  background-color: var(--paper);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  max-width: calc(100% - 4rem);
  z-index: 9999;
  padding: 1.25rem;
  overflow: clip;
  transform: translateX(calc(100% + 2rem));
  transition: transform 0.3s cubic-bezier(0.33, 1, 0.68, 1);
  pointer-events: all;
}
.notification.active { transform: translateX(0); }
.notification:before {
  content: "";
  display: block;
  inset: 0 0 auto;
  height: 0.4rem;
  background-color: var(--notification-color);
  position: absolute;
}
.notification__text { margin: 0.2rem 0 0; opacity: 0.8; }
.notification__header {
  color: var(--ink);
  margin: 0;
  font-family: var(--head);
  font-size: 16px;
  font-weight: 600;
}
.notification__action { margin-left: auto; }
.notification-close-btn {
  background: none; border: none; cursor: pointer;
  font-size: 14px; color: var(--line-strong); line-height: 1;
}
.notification-close-btn:hover { color: var(--ink); }
.notification__icon {
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  background-color: var(--notification-color);
  color: #fff;
  flex-shrink: 0;
}
.notification__icon .material-symbols-rounded { font-size: 22px; line-height: 1; }

/* Cor de destaque por tipo (variável --accent-900 solicitada). */
.notification--success { --notification-color: var(--accent-900, #2E8B57); }
.notification--warning { --notification-color: var(--accent-900, #E08A00); }
.notification--danger  { --notification-color: var(--accent-900, #C0392B); }
.notification--info    { --notification-color: var(--accent-900, #545454); }

body.dark-theme .notification { background-color: #202634; border-color: #2C3444; }

/* ----- Diálogo de confirmação (substitui window.confirm) ----- */
.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(26, 26, 24, 0.45);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.confirm-overlay.active { opacity: 1; }
.confirm-overlay[hidden] { display: none; }
.confirm-dialog {
  --notification-color: var(--accent);
  width: min(24rem, 100%);
  background: var(--paper);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.25);
  padding: 1.5rem;
  text-align: center;
  transform: translateY(8px) scale(0.98);
  transition: transform 0.2s cubic-bezier(0.33, 1, 0.68, 1);
}
.confirm-overlay.active .confirm-dialog { transform: translateY(0) scale(1); }
.confirm--warning .confirm-dialog { --notification-color: #E08A00; }
.confirm--danger  .confirm-dialog { --notification-color: #C0392B; }
.confirm--success .confirm-dialog { --notification-color: #2E8B57; }
.confirm-icon {
  width: 3rem; height: 3rem; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1rem;
  background-color: var(--notification-color);
  color: #fff;
}
.confirm-icon .material-symbols-rounded { font-size: 26px; }
.confirm-title { font-family: var(--head); font-size: 17px; font-weight: 700; margin: 0 0 6px; color: var(--ink); }
.confirm-text { font-size: 14px; line-height: 1.5; color: #545454; margin: 0 0 1.25rem; }
.confirm-actions { display: flex; gap: 10px; justify-content: center; }
.confirm-actions .btn { min-width: 120px; justify-content: center; }
.confirm--danger .confirm-ok { background: var(--accent); border-color: var(--accent); }
body.dark-theme .confirm-dialog { background: #202634; border-color: #2C3444; }
body.dark-theme .confirm-text { color: #AEBACA; }

/* ---------- BOTÕES ---------- */
.btn, .btn-ghost, .btn-danger, .btn-sm {
  border-radius: var(--radius);
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn {
  border: 1.5px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  font-family: var(--head);
  font-weight: 600;
  font-size: 13.5px;
  padding: 12px 22px;
  letter-spacing: 0.02em;
}
.btn:hover {
  background: #000;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}
.btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.btn:disabled, .btn[disabled] { opacity: .6; cursor: default; transform: none; box-shadow: none; }

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1.5px solid var(--line-strong);
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 8px 14px;
}
.btn-ghost:hover { border-color: var(--ink); background: var(--paper-dim); transform: translateY(-1px); }

.btn-accent { background: var(--accent); border-color: var(--accent); color: var(--paper); }
.btn-accent:hover { background: #8F1022; }

.btn-sm { padding: 8px 14px; font-size: 12px; }

.btn-danger { color: var(--err); border-color: #E7B5B0; background: transparent; font-family: var(--mono); font-size: 11px; padding: 6px 12px; text-transform: uppercase; }
.btn-danger:hover { background: var(--err-dim); transform: translateY(-1px); }

/* ---------- FORMULÁRIOS & INPUTS ---------- */
.input-group { margin-bottom: 22px; }
.input-label, .label { display: block; font-family: var(--mono); font-size: 11px; color: var(--ink); letter-spacing: 0.05em; text-transform: uppercase; font-weight: 700; }

.input-field, .input, .select, .search {
  width: 100%; padding: 14px 16px; border: 1.5px solid var(--line);
  background: var(--paper); font-family: var(--body); font-size: 14px; color: var(--ink);
  border-radius: var(--radius);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.input-field:focus, .input:focus, .select:focus, .search:focus { border-color: var(--ink); }
.input-field::placeholder, .input::placeholder, .search::placeholder { color: #A5A499; }
/* Impede o arrasto horizontal das áreas de texto (Objetivos, Direção de estilo,
   etc.): o usuário só pode aumentar a altura, preservando o layout da página. */
textarea.input-field, textarea.input { resize: vertical; }
.search { padding: 13px 16px; margin-bottom: 20px; }

/* ---------- PAINÉIS, CARDS E CANTOS (Aceleração Visual) ---------- */
.login-panel, .card, .panel, .project-card, .concept-card, .slide-row, .export-panel {
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  transition: all var(--transition);
}

/* Protege imagens e fundos para não vazar o border-radius */
.ref-thumb, .concept-visual, .slide-thumb, .rail, .gen-track, .gen-fill, .mode-toggle {
  border-radius: var(--radius);
  overflow: hidden;
}

/* ---------- LOGIN (index.html) ---------- */
.login-shell { width: 100%; max-width: 440px; padding: 24px; margin: auto; }
.login-panel { padding: 48px 40px; box-shadow: var(--shadow); }
.login-header { display: flex; flex-direction: column; align-items: center; text-align: center; margin-bottom: 32px; gap: 16px; }
.login-panel .btn { width: 100%; padding: 14px 22px; } 

.intro { text-align: center; font-size: 13px; color: #545454; line-height: 1.5; margin-bottom: 26px; }
.hint { font-family: var(--mono); font-size: 10px; color: var(--line-strong); letter-spacing: 0.03em; margin-top: 6px; }
.foot { text-align: center; margin-top: 26px; font-family: var(--mono); font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--line-strong); }

.mode-toggle { display: flex; margin-bottom: 26px; border: 1.5px solid var(--line); }
.mode-btn { flex: 1; background: var(--paper); border: none; border-right: 1.5px solid var(--line); padding: 12px 10px; font-family: var(--head); font-weight: 600; font-size: 13px; color: var(--line-strong); transition: background var(--transition), color var(--transition); }
.mode-btn:last-child { border-right: none; }
.mode-btn.active { background: var(--ink); color: var(--paper); }


/* ---------- DASHBOARD (dashboard.html) ---------- */
/* A .shell agora vive à direita da barra lateral e preenche toda a largura
   restante — todas as etapas seguem o mesmo padrão amplo. */
.shell { width: 100%; max-width: none; margin: 0; padding: 32px clamp(20px, 3vw, 48px) 80px; flex: 1; min-width: 0; }

/* Segmented Control: navegação interna entre as etapas do projeto (Briefing /
   Conceitos / Apresentação). Container em cinza claro com cantos arredondados;
   o botão ativo ganha fundo claro elevado e a cor de destaque. */
.seg-nav {
  display: inline-flex;
  gap: 4px;
  margin-bottom: 24px;
  padding: 4px;
  background: var(--paper-dim);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.seg-nav .rail-step {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 8px 16px;
  border: none;
  border-radius: calc(var(--radius) - 3px);
  background: transparent;
  color: var(--line-strong);
  cursor: pointer;
  transition: background var(--transition), color var(--transition), box-shadow var(--transition);
}
.seg-nav .rail-step:hover { color: var(--ink); }
.seg-nav .rail-step:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-dim); }
.seg-nav .rail-step .seg-nav-ico { font-size: 18px; line-height: 1; display: block; }
.seg-nav .rail-step .label {
  font-family: var(--head);
  font-weight: 600;
  font-size: 12.5px;
  line-height: 1;
  letter-spacing: 0.01em;
  transition: color var(--transition);
}

/* Etapa atual: destacada como uma "pílula" clara e elevada com a cor da marca. */
.seg-nav .rail-step.is-active {
  background: var(--paper);
  color: var(--accent);
  box-shadow: var(--shadow);
}
.seg-nav .rail-step.is-active .label { color: var(--accent); }

/* Etapas já percorridas mantêm a aparência neutra, sem poluir o controle. */
.seg-nav .rail-step.is-done { color: var(--ink); }

/* No cabeçalho do projeto o controle fica alinhado à direita do título. */
.stage-head .seg-nav { margin-bottom: 0; align-self: center; }

/* Menu de ferramentas persistente do projeto ativo: barra estática no topo do
   contentor, FORA da área que sofre fade. Herda o recuo/largura da .shell (tal
   como o cabeçalho do Briefing) e mantém o mesmo espaçamento inferior. */
.project-tools { margin-bottom: 24px; }
.project-tools .seg-nav { margin-bottom: 0; }
@media (max-width: 620px) {
  .seg-nav { display: flex; width: 100%; }
  .seg-nav .rail-step { flex: 1; padding: 8px 6px; }
  .seg-nav .rail-step .label { font-size: 11.5px; }
}
body.dark-theme .seg-nav .rail-step.is-active { background: var(--line); color: var(--accent); }

.stage-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.stage-eyebrow { font-family: var(--mono); font-size: 11px; color: var(--accent); letter-spacing: 0.08em; text-transform: uppercase; display: block; margin-bottom: 6px; }
.stage-title { font-family: var(--display); font-weight: 800; font-size: clamp(24px, 3.4vw, 34px); letter-spacing: -0.01em; line-height: 1.05; margin: 0; }
.stage-desc { font-size: 14px; color: #545454; max-width: 520px; margin-top: 6px; line-height: 1.5; }
.stage-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); }

.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.project-card { padding: 20px; text-align: left; display: flex; flex-direction: column; gap: 10px; position: relative; cursor: pointer; }
.project-card:hover, .concept-card:hover { transform: translateY(-4px); box-shadow: 0 12px 24px rgba(26, 26, 24, 0.08); border-color: var(--ink); }

.project-card .pid { font-family: var(--mono); font-size: 11px; color: var(--line-strong); letter-spacing: 0.04em; }
.project-card .pname { font-family: var(--head); font-weight: 700; font-size: 17px; letter-spacing: -0.005em; }
.project-card .pmeta { font-size: 12.5px; color: #68675C; line-height: 1.5; }

.status-chip { align-self: flex-start; font-family: var(--mono); font-size: 10px; letter-spacing: 0.05em; text-transform: uppercase; padding: 4px 8px; border: 1px solid var(--line-strong); color: var(--line-strong); border-radius: var(--radius); }
.status-chip.ready { border-color: var(--accent); color: var(--accent); }

.briefing-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
/* min-width:0 evita que conteúdos internos (nomes longos, chips) estourem a
   coluna e quebrem a divisão meio a meio quando a barra lateral é aberta. */
.briefing-layout > * { min-width: 0; }
@media (max-width: 860px) { .briefing-layout { grid-template-columns: 1fr; } }

.panel-head { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.panel-head h3 { font-family: var(--head); font-size: 12.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; margin: 0; color: #545454; }
.panel-body { padding: 20px; }

.brief-field { margin-bottom: 16px; }
.brief-field:last-child { margin-bottom: 0; }
.brief-field .k { font-family: var(--mono); font-size: 10.5px; color: var(--line-strong); letter-spacing: 0.05em; text-transform: uppercase; display: block; margin-bottom: 4px; }
.brief-field .v { font-size: 14.5px; line-height: 1.55; }
.brief-field .v.num { font-family: var(--mono); font-size: 14px; }

.ref-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ref-thumb { aspect-ratio: 1; border: 1px solid var(--line); background: var(--paper-dim); display: flex; align-items: center; justify-content: center; position: relative; }
.ref-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ref-thumb .tag { position: absolute; bottom: 0; left: 0; right: 0; background: rgba(26,26,24,0.82); color: var(--paper); font-family: var(--mono); font-size: 9px; padding: 4px 6px; letter-spacing: 0.03em; border: none; border-radius: 0; }

.gen-wrap { padding: 48px 32px; text-align: center; background: linear-gradient(var(--paper), var(--paper)) padding-box; border-radius: var(--radius); }
.gen-title { font-family: var(--display); font-weight: 800; font-size: 20px; margin: 0 0 6px; }
.gen-sub { font-family: var(--mono); font-size: 12px; color: var(--line-strong); margin-bottom: 28px; }
.gen-track { max-width: 420px; margin: 0 auto 20px; height: 3px; background: var(--line); position: relative; }
.gen-track .fill { position: absolute; top: 0; left: 0; height: 100%; background: var(--accent); width: 0%; transition: width .3s ease; }
.gen-log { font-family: var(--mono); font-size: 12px; color: #545454; max-width: 420px; margin: 0 auto; text-align: left; line-height: 2; min-height: 96px; }
.gen-log .row { display: flex; gap: 10px; }
.gen-log .row .mk { color: var(--line-strong); width: 16px; flex-shrink: 0; }
.gen-log .row.on .mk { color: var(--done); }

.concept-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 900px) { .concept-grid { grid-template-columns: 1fr; } }

.concept-card { display: flex; flex-direction: column; position: relative; cursor: pointer; }
.concept-card.is-picked { border-color: var(--ink); box-shadow: var(--shadow); }
.concept-visual { aspect-ratio: 4/3; background: var(--paper-dim); border-bottom: 1.5px solid var(--line); position: relative; }
.concept-visual img { width: 100%; height: 100%; object-fit: cover; display: block; }
.concept-code { position: absolute; top: 10px; left: 10px; font-family: var(--mono); font-size: 10.5px; background: var(--ink); color: var(--paper); padding: 3px 8px; letter-spacing: 0.04em; border-radius: calc(var(--radius) / 2); }
.concept-body { padding: 18px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.concept-name { font-family: var(--head); font-weight: 700; font-size: 16.5px; }
.concept-desc { font-size: 13px; color: #545454; line-height: 1.55; flex: 1; }
.concept-specs { display: flex; flex-wrap: wrap; gap: 6px; }
.spec-tag { font-family: var(--mono); font-size: 10px; color: var(--line-strong); border: 1px solid var(--line); padding: 3px 7px; letter-spacing: 0.02em; border-radius: calc(var(--radius) / 2); }

.pick-row { display: flex; align-items: center; gap: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.pick-row label { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.03em; text-transform: uppercase; color: #545454; cursor: pointer; }
.pick-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; border-radius: 4px; }

.slide-list { display: flex; flex-direction: column; gap: 14px; }
.slide-row { display: grid; grid-template-columns: 120px 1fr auto; gap: 18px; align-items: center; padding: 16px; }
@media (max-width: 700px) { .slide-row { grid-template-columns: 1fr; } .slide-row .slide-thumb { width: 100%; aspect-ratio: 16/10; } }
.slide-thumb { width: 120px; aspect-ratio: 4/3; background: var(--paper-dim); border: 1px solid var(--line); }
.slide-thumb img { width: 100%; height: 100%; object-fit: cover; }
.slide-info .stitle { font-family: var(--head); font-weight: 700; font-size: 14.5px; margin-bottom: 4px; }
.slide-info .stext { font-size: 12.5px; color: #68675C; line-height: 1.5; }
.slide-copy-btn { white-space: nowrap; }

.copied-flag { font-family: var(--mono); font-size: 10.5px; color: var(--done); letter-spacing: 0.03em; }

.export-panel { margin-top: 24px; border: 1.5px dashed var(--line-strong); padding: 22px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; background: transparent; }
.export-panel .et { font-family: var(--head); font-weight: 700; font-size: 14.5px; margin-bottom: 4px; }
.export-panel .ed { font-size: 12.5px; color: #68675C; }

.api-note { font-family: var(--mono); font-size: 10.5px; color: var(--line-strong); letter-spacing: 0.02em; display: flex; align-items: center; gap: 6px; margin-top: 10px; }
.api-dot { width: 6px; height: 6px; background: var(--accent); border-radius: 50%; flex-shrink: 0; }

.back-link { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 11.5px; color: var(--line-strong); letter-spacing: 0.03em; margin-bottom: 16px; background: none; border: none; padding: 0; cursor: pointer; transition: color var(--transition); }
.back-link:hover { color: var(--ink); }

/* ---------- ADMIN (admin.html) ---------- */
.wrap { max-width: 900px; margin: 0 auto; padding: 32px 28px 64px; }
/* Variação "larga" do painel admin: mais espaço para editar vários usuários
   lado a lado. Aplicada tanto em .wrap quanto em .shell para reuso futuro. */
.wrap.admin-wide,
.shell.admin-wide { max-width: 1200px; }
.page-title { font-family: var(--display); font-weight: 800; font-size: 26px; margin: 8px 0 4px; }
.page-sub { color: #545454; font-size: 14px; margin-bottom: 28px; }

.card { padding: 26px 26px; margin-bottom: 28px; box-shadow: var(--shadow); }
.card h2 { font-family: var(--head); font-weight: 700; font-size: 15px; text-transform: uppercase; letter-spacing: 0.04em; margin: 0 0 18px; }

.row { display: flex; gap: 16px; flex-wrap: wrap; }
.field { flex: 1 1 180px; margin-bottom: 16px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-family: var(--mono); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--line-strong); padding: 10px 12px; border-bottom: 1.5px solid var(--line); }
td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: none; }

.tag { font-family: var(--mono); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; padding: 3px 8px; border: 1.5px solid var(--line); border-radius: calc(var(--radius) / 2); }
.tag.admin { color: var(--accent); border-color: var(--accent); background: var(--accent-dim); }

.muted { color: var(--line-strong); font-family: var(--mono); font-size: 11px; }
.empty { text-align: center; color: var(--line-strong); padding: 26px; font-size: 13px; }

/* ---------- ADMIN: LISTA DE USUÁRIOS EDITÁVEL ---------- */
/* Cabeçalho da lista com o botão global "Salvar alterações" à direita. */
.users-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.users-head h2 { margin: 0; }

/* Inputs compactos dentro das células/campos editáveis da tabela. */
.cell-input, .cell-select {
  width: 100%;
  padding: 9px 11px;
  border: 1.5px solid var(--line);
  background: var(--paper);
  font-family: var(--body);
  font-size: 13.5px;
  color: var(--ink);
  border-radius: calc(var(--radius) / 1.5);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.cell-input:focus, .cell-select:focus { border-color: var(--ink); }
.cell-input::placeholder { color: #A5A499; }
/* Destaque sutil de linhas com alterações não salvas. */
tr.is-dirty td { background: var(--accent-dim); }

/* Botão primário "Salvar alterações": cinza/inerte enquanto nada mudou,
   passa à cor de destaque assim que existe alteração pendente. */
.btn-save {
  border: 1.5px solid var(--accent);
  background: var(--accent);
  color: var(--paper);
  font-family: var(--head);
  font-weight: 600;
  font-size: 13.5px;
  padding: 12px 22px;
  letter-spacing: 0.02em;
  border-radius: var(--radius);
  transition: all var(--transition);
}
.btn-save:hover:not([disabled]) { background: #8F1022; border-color: #8F1022; transform: translateY(-2px); box-shadow: 0 6px 16px rgba(179, 20, 42, 0.2); }
.btn-save[disabled] {
  background: var(--line);
  border-color: var(--line);
  color: var(--paper);
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
  box-shadow: none;
}

/* Em telas estreitas, o botão global ocupa a largura toda. */
@media (max-width: 640px) {
  .users-head { flex-direction: column; align-items: stretch; }
  .btn-save { width: 100%; }
}

/* ---------- ETAPA 01: CRIAÇÃO DE PROJETOS ---------- */
.creation-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 48px;
}
@media (max-width: 860px) {
  .creation-layout { grid-template-columns: 1fr; }
}

/* ---------- ÁREA DE CRIAÇÃO TRAVADA (mesmo padrão do Workspace) ----------
   O container preenche a altura útil da tela e a página inteira não rola. Só a
   coluna de dados (esquerda) rola individualmente, com o botão de ação alinhado
   ao rodapé — igual ao painel "Briefing da reunião". A Drop Zone da IA fica
   estritamente contida dentro do espaço visível do container pai. */
body:has(#view-create:not(.hidden)) { overflow: hidden; }

#view-create {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 120px);
  min-height: 440px;
}
#view-create .stage-head { flex-shrink: 0; }
#view-create .creation-layout {
  flex: 1;
  min-height: 0;
  margin-bottom: 0;
  align-items: stretch;
}
#view-create .creation-layout > .panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  margin: 0;
}
#view-create .creation-layout > .panel > .panel-head { flex-shrink: 0; }
#view-create .creation-layout > .panel > .panel-body { flex: 1; min-height: 0; }

/* Coluna de dados: rolagem individual; o formulário estica e fixa o botão no fim. */
#view-create .creation-layout > .panel:first-child > .panel-body { overflow-y: auto; }
#view-create #new-project-form { display: flex; flex-direction: column; min-height: 100%; }
#view-create #save-project-btn { margin-top: auto; }

/* Coluna da IA: a Drop Zone nunca ultrapassa o espaço visível. */
#view-create .ai-drop-body { height: 100%; min-height: 0; overflow: hidden; }
#view-create .ai-drop-body .drop-zone { min-height: 0; }
#view-create #file-list { flex-shrink: 0; overflow-y: auto; max-height: 40%; }

/* No mobile a coluna única volta a rolar normalmente. */
@media (max-width: 860px) {
  body:has(#view-create:not(.hidden)) { overflow: auto; }
  #view-create { height: auto; min-height: 0; }
  #view-create .creation-layout > .panel,
  #view-create .creation-layout > .panel:first-child > .panel-body,
  #view-create .ai-drop-body { overflow: visible; }
}

.section-divider {
  font-family: var(--display);
  font-size: 16px;
  font-weight: 800;
  margin: 48px 0 24px;
  padding-top: 48px;
  border-top: 1px solid var(--line);
}

/* Área de IA (Drag & Drop) */
.ai-drop-body {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 320px;
}
.drop-zone {
  border: 2px dashed var(--line-strong);
  border-radius: var(--radius);
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px;
  background: var(--paper-dim);
  transition: all var(--transition);
  position: relative;
}
.drop-zone.dragover {
  background: var(--accent-dim);
  border-color: var(--accent);
}
/* Arraste global de arquivos: sinaliza a zona-alvo da vista atual antes mesmo
   de o ponteiro chegar nela, e destaca-a com um leve pulsar. */
body.is-file-dragging .drop-zone { border-color: var(--accent); }
body.is-file-dragging .drop-zone.dragover {
  box-shadow: 0 0 0 3px var(--accent-dim);
  animation: drop-pulse 1s ease-in-out infinite;
}
@keyframes drop-pulse { 50% { box-shadow: 0 0 0 6px var(--accent-dim); } }
/* Workspace recebendo um recurso arrastado da janela "Recursos". */
.concept-chat .panel-body.is-ref-target { outline: 2px dashed var(--accent); outline-offset: -6px; border-radius: var(--radius); }
.drop-icon {
  font-size: 40px;
  margin-bottom: 16px;
  display: block;
}
.drop-content h4 {
  font-family: var(--head);
  font-size: 16px;
  margin: 0 0 8px;
}
.drop-content p {
  font-size: 13px;
  color: #545454;
  line-height: 1.5;
  margin: 0;
}

/* Animação de Loading da IA */
.drop-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Spinner inline para botões em estado de carregamento (Entrar / Sair).
   Usa currentColor, portanto adapta-se à cor do texto do botão. */
.btn-spinner {
  display: inline-block;
  width: 15px;
  height: 15px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: -2px;
  flex: none;
}

/* Skeleton screens das grades (projetos / portfólio / manuais): placeholders
   animados exibidos enquanto os dados chegam, para a tela nunca ficar vazia. */
.skeleton-card {
  height: 150px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(100deg,
    var(--paper-dim) 30%, var(--line) 50%, var(--paper-dim) 70%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.2s ease-in-out infinite;
}
@keyframes skeleton-shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* ---------- UTILITÁRIOS ---------- */
.hidden { display: none !important; }

/* Mensagens vazias / de carregamento dentro das grades */
.grid-msg {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--line-strong);
  line-height: 1.6;
  grid-column: 1 / -1;
  margin: 4px 0;
}
.grid-msg strong { color: var(--ink); }

/* Notice fixado no topo do dashboard para não deslocar o layout */
.shell > .notice { margin-top: 4px; }

/* ---------- LISTA DE ARQUIVOS (criação + briefing) ---------- */
.file-list {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.file-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  font-size: 13px;
}
.file-chip .file-ico { font-size: 16px; flex-shrink: 0; line-height: 1; }
.file-chip .file-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.file-tag {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border: 1px solid var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
  border-radius: calc(var(--radius) / 2);
  flex-shrink: 0;
}

.file-remove {
  font-family: var(--mono);
  font-size: 16px;
  line-height: 1;
  color: var(--line-strong);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: all var(--transition);
}
.file-remove:hover { color: var(--err); background: var(--err-dim); }

/* Arquivos agrupados por categoria na revisão do briefing */
.file-cat { margin-bottom: 18px; }
.file-cat:last-child { margin-bottom: 0; }
.file-cat-title {
  display: block;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--line-strong);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.file-cat .file-chip { margin-bottom: 6px; }
.file-cat .file-chip:last-child { margin-bottom: 0; }

/* Anexos baixáveis: o chip inteiro é um link, com feedback claro no hover. */
.file-chip .file-ico { transition: transform var(--transition); }
.file-chip-link {
  cursor: pointer;
  color: var(--ink);
  transition: border-color var(--transition), background var(--transition),
    box-shadow var(--transition), transform var(--transition);
}
.file-chip-link:hover,
.file-chip-link:focus-visible {
  border-color: var(--accent);
  background: var(--accent-dim);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(179, 20, 42, 0.12);
  outline: none;
}
.file-chip-link:hover .file-ico,
.file-chip-link:focus-visible .file-ico { transform: translateY(1px); }
.file-chip .file-dl {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  flex-shrink: 0;
  opacity: 0.6;
  transition: opacity var(--transition), transform var(--transition);
}
.file-chip-link:hover .file-dl,
.file-chip-link:focus-visible .file-dl {
  opacity: 1;
  transform: translateY(1px);
}

/* Formulário de visualização/edição do briefing em grade de 2 colunas: pares
   "Cliente / Feira" e "Área / Verba" na mesma linha; textos longos ocupam a
   largura total. Compacta a altura antes esticada verticalmente. */
.brief-edit-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  align-items: start;
}
.brief-edit-form .input-group { margin-bottom: 0; }
.brief-edit-form .brief-span-2 { grid-column: span 2; }
@media (max-width: 560px) {
  .brief-edit-form { grid-template-columns: 1fr; }
  .brief-edit-form .brief-span-2 { grid-column: auto; }
}

/* Autoria do upload no briefing. */
.brief-field.upload-author { border-top: 1px solid var(--line); padding-top: 14px; }
.brief-field .v.author-email {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--line-strong);
  word-break: break-all;
}

/* ---------- EXCLUSÃO DE PROJETO NO CARD ---------- */
.card-delete {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--paper);
  color: var(--line-strong);
  opacity: 0;
  transition: all var(--transition);
}
.project-card:hover .card-delete,
.project-card:focus-within .card-delete { opacity: 1; }
.card-delete:hover {
  border-color: var(--err);
  background: var(--err-dim);
  color: var(--err);
  transform: translateY(-1px);
}

/* ---------- AÇÕES DOS ARQUIVOS (baixar / excluir) ---------- */
.file-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.file-action {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 5px 9px;
  border-radius: calc(var(--radius) / 2);
  border: 1px solid var(--line);
  transition: all var(--transition);
  white-space: nowrap;
  cursor: pointer;
}
.file-action-view { color: var(--accent); border-color: var(--accent); background: var(--accent-dim); }
.file-action-view:hover { background: var(--accent); color: var(--paper); transform: translateY(-1px); }
.file-action-del { color: var(--line-strong); background: var(--paper); }
.file-action-del:hover {
  color: var(--err);
  border-color: var(--err);
  background: var(--err-dim);
  transform: translateY(-1px);
}

/* ---------- CONSULTOR IA — WIDGET FLUTUANTE ---------- */
/* Botão flutuante (FAB) redondo, fixo no canto inferior direito. */
.chat-fab {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  width: 58px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  color: var(--paper);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
}
.chat-fab[hidden] { display: none; }
.chat-fab:hover { transform: translateY(-2px) scale(1.05); box-shadow: 0 10px 26px rgba(0, 0, 0, 0.22); }
.chat-fab:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--accent-dim); }
.chat-fab .material-symbols-rounded { font-size: 26px; line-height: 1; }
body.dark-theme .chat-fab { color: #fff; }

/* Janela do chat: fixa acima do FAB, oculta por padrão, abre com transição. */
.chat-panel {
  position: fixed;
  bottom: 90px;
  right: 20px;
  z-index: 1000;
  width: min(480px, calc(100vw - 40px));
  max-height: min(760px, calc(100vh - 120px));
  display: flex;
  flex-direction: column;
  margin: 0;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.22);
  transform-origin: bottom right;
  opacity: 0;
  transform: translateY(16px) scale(0.96);
  pointer-events: none;
  transition: opacity var(--transition), transform var(--transition);
}
.chat-panel.is-open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.chat-panel .panel-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.chat-head-titles { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.chat-close {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--paper);
  color: var(--line-strong);
  cursor: pointer;
  transition: all var(--transition);
}
.chat-close:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-dim); }
.chat-close .material-symbols-rounded { font-size: 18px; line-height: 1; }

@media (max-width: 480px) {
  .chat-panel { bottom: 84px; right: 12px; left: 12px; width: auto; }
  .chat-fab { bottom: 16px; right: 16px; }
}

.chat-hint {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--line-strong);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.chat-history {
  max-height: 360px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 4px 4px 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
/* Dentro do widget flutuante, o histórico preenche o espaço e rola sozinho. */
.chat-panel .chat-history { flex: 1; max-height: none; min-height: 120px; }
.chat-empty {
  font-size: 13px;
  color: var(--line-strong);
  text-align: center;
  padding: 24px 12px;
}
.chat-msg { display: flex; flex-direction: column; gap: 5px; max-width: 85%; }
.chat-msg-user { align-self: flex-end; align-items: flex-end; }
.chat-msg-assistant { align-self: flex-start; align-items: flex-start; }
.chat-role {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--line-strong);
}
.chat-bubble {
  font-size: 14px;
  line-height: 1.55;
  padding: 12px 15px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  overflow-wrap: anywhere;
  word-break: break-word;
}
/* Markdown renderizado dentro da bolha (títulos, parágrafos, listas, etc.) */
.chat-bubble > *:first-child { margin-top: 0; }
.chat-bubble > *:last-child { margin-bottom: 0; }
.chat-bubble p { margin: 0 0 0.6em; }
.chat-bubble h1,
.chat-bubble h2,
.chat-bubble h3,
.chat-bubble h4 {
  font-family: var(--head, inherit);
  font-weight: 700;
  line-height: 1.3;
  margin: 0.8em 0 0.4em;
}
.chat-bubble h1 { font-size: 1.25em; }
.chat-bubble h2 { font-size: 1.15em; }
.chat-bubble h3 { font-size: 1.05em; }
.chat-bubble h4 { font-size: 1em; }
.chat-bubble ul,
.chat-bubble ol { margin: 0.4em 0 0.6em; padding-left: 1.4em; }
.chat-bubble li { margin: 0.2em 0; }
.chat-bubble li > p { margin: 0; }
.chat-bubble strong { font-weight: 700; }
.chat-bubble em { font-style: italic; }
.chat-bubble a { color: var(--accent); text-decoration: underline; }
.chat-bubble code {
  font-family: var(--mono);
  font-size: 0.9em;
  background: rgba(0, 0, 0, 0.06);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}
.chat-bubble pre {
  background: rgba(0, 0, 0, 0.06);
  padding: 10px 12px;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 0.5em 0;
}
.chat-bubble pre code { background: none; padding: 0; }
.chat-bubble blockquote {
  margin: 0.5em 0;
  padding-left: 0.8em;
  border-left: 3px solid var(--line-strong);
  color: var(--line-strong);
}
.chat-msg-user .chat-bubble code,
.chat-msg-user .chat-bubble pre { background: rgba(255, 255, 255, 0.15); }
.chat-msg-user .chat-bubble {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.chat-msg-assistant .chat-bubble { background: var(--paper); color: var(--ink); }
.chat-bubble.is-streaming::after {
  content: '▍';
  color: var(--accent);
  animation: chat-blink 1s steps(2) infinite;
}
@keyframes chat-blink { 50% { opacity: 0; } }
.chat-form { display: flex; gap: 12px; align-items: flex-end; }
.chat-input { flex: 1; resize: vertical; min-height: 48px; }
.chat-send { flex-shrink: 0; }

/* ---------- ETAPA 02: COLUNA DIREITA (arquivos do cliente) ---------- */
.briefing-right {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

/* Área de arquivos compactada: os anexos fluem horizontalmente como "chips"
   (tags) que quebram de linha, em vez de uma lista vertical esticada. */
.files-panel #ref-grid {
  max-height: 220px;
  overflow-y: auto;
}
/* A galeria (grid de cards 1:1) tem a sua própria altura e rolagem. */
.files-panel #ref-grid.files-gallery { max-height: 360px; }

/* ---------- GALERIA DE ARQUIVOS DO CLIENTE (grid 1:1) ---------- */
.files-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-bottom: 12px;
}
.files-toolbar-count {
  margin-right: auto;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--accent);
}
.files-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
}
.fcard {
  position: relative;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-dim);
  overflow: hidden;
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}
.fcard:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.fcard:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-dim); }
.fcard.is-selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-dim); }
.fcard-media { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.fcard-img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Skeleton wave: mesma animação/gradiente da lista de projetos. */
.fcard--skeleton,
.fcard.is-loading .fcard-media {
  background: linear-gradient(100deg,
    var(--paper-dim) 30%, var(--line) 50%, var(--paper-dim) 70%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.2s ease-in-out infinite;
}
.fcard--skeleton { cursor: default; }
.fcard.is-loading .fcard-img { opacity: 0; }
.fcard-img { transition: opacity var(--transition); }

/* Documentos: ícone/logo SVG representativo (PDF, TXT, CSV…). */
.fcard-doc { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.fcard-svg { width: 46%; height: 46%; }
.fcard-svg-page { fill: var(--paper); stroke: var(--line-strong); stroke-width: 2; }
.fcard-svg-fold { fill: var(--line); }
.fcard--doc[data-kind="pdf"] .fcard-svg-page { stroke: var(--accent); }
.fcard--doc[data-kind="pdf"] .fcard-svg-label { fill: var(--accent); }
.fcard-svg-label { font-family: var(--mono); font-size: 11px; font-weight: 700; fill: var(--line-strong); }

/* Nome oculto por padrão, revelado no hover (transição de opacidade). */
.fcard-name {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 14px 8px 6px;
  font-size: 10.5px;
  line-height: 1.3;
  color: #fff;
  background: linear-gradient(to top, rgba(0,0,0,0.78), rgba(0,0,0,0));
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fcard:hover .fcard-name,
.fcard:focus-visible .fcard-name { opacity: 1; }

/* Tag de categoria discreta no canto inferior esquerdo. */
.fcard-cat {
  position: absolute;
  bottom: 6px; left: 6px;
  z-index: 2;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(26,26,24,0.7);
  color: #fff;
  transition: opacity var(--transition);
}
.fcard:hover .fcard-cat { opacity: 0; }

/* Checkbox circular estilizado no canto superior direito. */
.fcard-check {
  position: absolute;
  top: 8px; right: 8px;
  z-index: 3;
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: rgba(26,26,24,0.35);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  cursor: pointer;
  padding: 0;
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
}
.fcard-check:hover { transform: scale(1.1); }
.fcard-check.is-checked {
  background: var(--accent);
  border-color: var(--accent);
}
.fcard-check.is-checked::after {
  content: "";
  position: absolute;
  left: 6px; top: 2px;
  width: 5px; height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* ---------- LIGHTBOX DE PDF (visualizador embutido) ---------- */
.pdf-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3vh 3vw;
  background: rgba(26,26,24,0.82);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.pdf-lightbox.active { opacity: 1; }
.pdf-lightbox[hidden] { display: none; }
.pdf-lightbox-inner {
  width: min(960px, 100%);
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0,0,0,0.4);
}
.pdf-lightbox-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}
.pdf-lightbox-name {
  font-family: var(--head);
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pdf-lightbox-open { margin-left: auto; color: var(--line-strong); display: flex; }
.pdf-lightbox-open:hover { color: var(--accent); }
.pdf-lightbox-close {
  background: none; border: none; cursor: pointer;
  font-size: 18px; color: var(--line-strong); line-height: 1;
}
.pdf-lightbox-close:hover { color: var(--ink); }
.pdf-lightbox-frame { flex: 1; width: 100%; border: none; background: #fff; }
body.dark-theme .pdf-lightbox-inner { background: #202634; }
.files-panel .file-cat {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}
.files-panel .file-cat-title { flex-basis: 100%; margin-bottom: 2px; }
.files-panel .file-chip {
  width: auto;
  max-width: 100%;
  margin-bottom: 0 !important;
  padding: 6px 10px;
  gap: 7px;
  font-size: 12px;
  background: var(--paper-dim);
}
.files-panel .file-chip .file-ico { font-size: 14px; }
.files-panel .file-chip .file-name { flex: 0 1 auto; max-width: 150px; }
.files-panel .file-chip .file-action { padding: 3px 7px; font-size: 9px; }

/* ---------- ZONA DE UPLOAD COMPACTA E CONTÍNUA (Etapa 02) ---------- */
.ref-dropzone-wrap { margin-top: 16px; }
.drop-zone-compact {
  flex: none;
  min-height: 0;
  padding: 16px;
}
.drop-zone-compact .drop-content {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
}
.drop-zone-compact .drop-add {
  font-family: var(--head);
  font-weight: 700;
  font-size: 14px;
}
.drop-zone-compact p {
  font-size: 12px;
  margin: 0;
  color: #545454;
  line-height: 1.5;
}
.drop-zone-compact .spinner { width: 26px; height: 26px; border-width: 3px; }
.ref-drop-browse { color: var(--accent); font-weight: 600; cursor: pointer; }
.ref-drop-browse:hover { text-decoration: underline; }
.ref-drop-full { color: var(--line-strong); font-family: var(--mono); font-size: 11px; }

/* Bloqueia a área apenas quando o projeto atinge o limite absoluto de arquivos. */
.ref-dropzone-wrap.is-disabled { opacity: 0.55; }
.ref-dropzone-wrap.is-disabled .drop-zone-compact {
  cursor: not-allowed;
  background: var(--paper-dim);
  border-color: var(--line);
}

/* ---------- PORTFÓLIO (portfolio.html) ---------- */
/* Grade de projetos concluídos */
.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}
.portfolio-card {
  position: relative;
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all var(--transition);
}
.pf-edit {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--paper);
  color: var(--line-strong);
  cursor: pointer;
  opacity: 0;
  transition: all var(--transition);
}
.portfolio-card:hover .pf-edit,
.portfolio-card:focus-within .pf-edit { opacity: 1; }
.pf-edit:hover { border-color: var(--accent); background: var(--accent-dim); color: var(--accent); transform: translateY(-1px); }
.pf-edit .material-symbols-rounded { font-size: 1.1rem; }
.portfolio-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(26, 26, 24, 0.08);
  border-color: var(--ink);
}
.portfolio-thumb {
  aspect-ratio: 4/3;
  background: var(--paper-dim);
  border-bottom: 1.5px solid var(--line);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.portfolio-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.portfolio-thumb .thumb-empty { font-size: 34px; opacity: 0.4; }
.portfolio-thumb .thumb-count {
  position: absolute;
  bottom: 8px;
  right: 8px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.03em;
  background: rgba(26,26,24,0.82);
  color: var(--paper);
  padding: 3px 7px;
  border-radius: calc(var(--radius) / 2);
}
.portfolio-body { padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.portfolio-body .pf-title { font-family: var(--head); font-weight: 700; font-size: 16px; letter-spacing: -0.005em; }
.portfolio-body .pf-desc {
  font-size: 13px;
  color: #545454;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Formulário de adição ao portfólio */
.portfolio-form-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 48px;
}
@media (max-width: 860px) { .portfolio-form-layout { grid-template-columns: 1fr; } }

/* Pré-visualização das imagens selecionadas no Drag & Drop */
.pf-previews {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 8px;
  margin-top: 16px;
}
.pf-preview {
  position: relative;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) / 2);
  overflow: hidden;
  background: var(--paper-dim);
}
.pf-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pf-preview .pf-preview-del {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  line-height: 1;
  border-radius: 50%;
  background: rgba(26,26,24,0.82);
  color: var(--paper);
  transition: background var(--transition);
}
.pf-preview .pf-preview-del:hover { background: var(--err); }

/* ==========================================================================
   RESPONSIVIDADE / MOBILE-FIRST
   Ajustes para ecrãs pequenos. Empilha linhas de inputs, compacta o
   cabeçalho e a trilha de progresso e amplia as áreas de toque.
   ========================================================================== */
@media (max-width: 768px) {
  /* 1. Layout geral e inputs -------------------------------------------- */
  /* Mais espaço de ecrã para o conteúdo. */
  .shell { padding: 0 16px 64px; }

  /* Inputs "Área / Verba" e o formulário de edição empilham um sob o outro. */
  .row { flex-direction: column; gap: 12px; }
  /* Mantém as linhas do log de geração na horizontal (marcador + texto). */
  .gen-log .row { flex-direction: row; gap: 10px; }

  /* 2. Cabeçalho responsivo (.topbar) ----------------------------------- */
  /* Permite a quebra de linha e centra a marca, navegação e o utilizador. */
  .topbar {
    flex-wrap: wrap;
    justify-content: center;
    text-align: center;
    gap: 12px;
    padding: 14px 16px;
  }
  .brand { justify-content: center; }
  .who { justify-content: center; }
  /* Poupa espaço: mantém visível apenas o botão "Sair". */
  .who-email { display: none; }

  /* 3. Trilha de progresso compacta (.rail) ----------------------------- */
  /* Remove a largura fixa: a trilha passa a ocupar toda a largura disponível. */
  .stage-head .rail { min-width: 100%; width: 100%; }
  .stage-head .rail .rail-step { padding: 8px 6px; }

  /* 4. Áreas de toque (UX / touch targets) ------------------------------ */
  /* Botões pequenos ganham altura mínima confortável para o dedo. */
  .btn-sm { min-height: 44px; padding: 10px 16px; }
  .file-actions { gap: 8px; }
  .file-action { min-height: 40px; padding: 9px 12px; }

  /* Espaçamento mais generoso nas listas e no histórico do chat. */
  .file-list { gap: 12px; }
  .chat-history { gap: 20px; }
  .chat-msg { max-width: 92%; }
}

/* Ecrãs muito pequenos: a trilha vira "pílulas" compactas de estado,
   escondendo o texto das etiquetas para não quebrar o layout horizontal. */
@media (max-width: 480px) {
  .stage-head .rail .rail-step {
    padding: 12px 4px;
    min-height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .stage-head .rail .rail-step .label { display: none; }
}

/* ============================================================
   ETAPA 03 — GERADOR DE IMAGENS IA (chat em tela cheia)
   ============================================================ */
/* O Workspace ocupa 100% da altura útil do painel. A página NÃO cresce: o
   #stage-3 vira uma coluna flex de altura fixa (viewport menos o cabeçalho de
   ferramentas) e só o histórico de mensagens rola. */
#stage-3 {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 150px);
  min-height: 420px;
}
.concept-chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin: 0;
}
.concept-chat .panel-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  gap: 14px;
}
/* Único elemento com rolagem: a área de histórico. */
.concept-chat .gen-history {
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  margin-bottom: 0;
}
.concept-chat .gen-form { flex-shrink: 0; }

/* Impede que a página inteira role enquanto o Workspace está ativo. */
body:has(#stage-3:not(.hidden)) { overflow: hidden; }

/* ----- Barra de ferramentas + Recursos ----- */
.gen-tools-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.gen-tools { margin-bottom: 0; }

/* ----- Janela flutuante "Recursos" (contexto arrastável) ----- */
.resources-panel {
  position: fixed;
  top: 50%;
  left: 20px;
  transform: translateY(-50%) scale(0.96);
  z-index: 1000;
  width: min(360px, calc(100vw - 40px));
  max-height: min(660px, calc(100vh - 80px));
  display: flex;
  flex-direction: column;
  margin: 0;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.22);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition), transform var(--transition);
}
.resources-panel.is-open { opacity: 1; transform: translateY(-50%) scale(1); pointer-events: auto; }
/* Cabeçalho como "alça" de arrasto; enquanto arrasta, desliga a transição para
   acompanhar o ponteiro sem atraso. */
.resources-panel .panel-head { cursor: grab; user-select: none; }
.resources-panel.is-repositioning { transition: none; }
.resources-panel.is-repositioning .panel-head { cursor: grabbing; }
.resources-panel .panel-body {
  display: flex;
  flex-direction: column;
  gap: 22px;
  overflow-y: auto;
  min-height: 0;
}
@media (max-width: 640px) {
  .resources-panel { left: 12px; right: 12px; width: auto; }
}
.ctx-group { display: flex; flex-direction: column; gap: 10px; }
.ctx-group-title {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--line-strong);
}
.ctx-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  padding: 10px 12px 22px;
  cursor: grab;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}
.ctx-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.ctx-card:active { cursor: grabbing; }
.ctx-card .ctx-label {
  display: block;
  font-family: var(--head);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--ink);
  margin-bottom: 3px;
}
.ctx-card .ctx-value {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.5;
  color: #555;
}
.ctx-card .ctx-grab {
  position: absolute;
  right: 10px;
  bottom: 6px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.06em;
  color: var(--line-strong);
  text-transform: uppercase;
}
.ctx-thumbs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.ctx-thumb {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: grab;
  background: var(--paper-dim);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.ctx-thumb:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.ctx-thumb:active { cursor: grabbing; }
.ctx-thumb img { display: block; width: 100%; height: 96px; object-fit: cover; }
.ctx-thumb-name {
  display: block;
  padding: 5px 7px;
  font-size: 10.5px;
  line-height: 1.3;
  color: #555;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-top: 1px solid var(--line);
}
.is-dragging { opacity: 0.45; }

/* ----- Chat gerador ----- */
.concept-chat .chat-msg { max-width: 100%; }
.gen-caption {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--line-strong);
  margin-bottom: 8px;
}
.gen-gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.gen-shot {
  display: block;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--paper-dim);
  transition: transform var(--transition), box-shadow var(--transition);
}
.gen-shot:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.gen-shot img { display: block; width: 100%; height: auto; }
.gen-loading { display: inline-flex; align-items: center; gap: 10px; color: var(--line-strong); font-size: 13px; }
.gen-error { color: var(--err); font-size: 13.5px; }
.gen-msg-refs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

.spinner-sm { width: 16px; height: 16px; border-width: 2px; }

/* Formulário do gerador */
.gen-form { display: flex; flex-direction: column; gap: 14px; }
.gen-inputwrap {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  padding: 8px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.gen-inputwrap.is-dropping {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.gen-chips { display: none; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.gen-chips.has-chips { display: flex; }
.gen-input { border: none; padding: 6px; resize: vertical; min-height: 66px; width: 100%; background: transparent; }
.gen-input:focus { outline: none; box-shadow: none; }

.gen-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--paper-dim);
  font-size: 11.5px;
  color: var(--ink);
  max-width: 100%;
}
.gen-chip-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; }
.gen-chip-image { border-color: var(--accent); background: var(--accent-dim); }
.gen-chip-ico { font-size: 12px; line-height: 1; }
.gen-chip-x {
  border: none;
  background: none;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  color: var(--line-strong);
  padding: 0 2px;
}
.gen-chip-x:hover { color: var(--accent); }

/* ---------- FERRAMENTA "MELHORAR IMAGENS" ---------- */
/* Seletores não aplicáveis (Modelo/Proporção/Quantidade) ficam esmaecidos e
   inertes enquanto a ferramenta de melhoria está ativa. */
.gen-indicator.is-disabled,
.gen-indicator:disabled { opacity: 0.45; pointer-events: none; cursor: default; }

/* Realce do workspace inteiro durante o arrasto de imagens (apenas nesta
   ferramenta), reaproveitando o realce de destaque padrão. */
#stage-3.is-enhance-drop { outline: 2px dashed var(--accent); outline-offset: -8px; border-radius: var(--radius); }

.enhance-tray { margin-top: 8px; border-top: 1px dashed var(--line); padding-top: 10px; }
.enhance-tray-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.enhance-tray-title { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--ink); }
.enhance-tray-title .material-symbols-rounded { font-size: 18px; color: var(--accent); }
.enhance-clear {
  border: 1px solid var(--line); background: var(--paper); cursor: pointer;
  font-size: 11px; color: var(--line-strong); padding: 3px 10px; border-radius: var(--radius);
}
.enhance-clear:hover { color: var(--accent); border-color: var(--accent); }

.enhance-thumbs { display: none; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.enhance-thumbs.has-thumbs { display: flex; }
.enhance-thumb { position: relative; width: 72px; height: 72px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.enhance-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.enhance-thumb-ready {
  position: absolute; bottom: 2px; left: 2px; font-size: 16px; color: var(--done);
  background: var(--paper); border-radius: 50%; line-height: 1;
}
.enhance-thumb-x {
  position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; border: none;
  border-radius: 50%; background: rgba(26,26,24,0.7); color: #fff; cursor: pointer;
  font-size: 13px; line-height: 1; display: flex; align-items: center; justify-content: center; padding: 0;
}
.enhance-thumb-x:hover { background: var(--accent); }

.enhance-hint { margin: 0; font-size: 11.5px; color: var(--line-strong); }
.enhance-hint.is-ready { color: var(--done); font-weight: 600; }
.enhance-browse { color: var(--accent); text-decoration: underline; cursor: pointer; }

/* Seletores visuais compactos (dropdown em pílula) + botão, na mesma linha.
   Grade de 4 colunas: 3 seletores + o botão "Gerar Imagens" alinhado à base. */
.gen-controls {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 14px;
  align-items: flex-end;
}
@media (max-width: 560px) { .gen-controls { grid-template-columns: 1fr; } }
.gen-control { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.gen-control-action { justify-content: flex-end; }
.gen-control-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--line-strong);
}

/* ----- Dropdown/popover compacto de cada seletor ----- */
.gen-dropdown { position: relative; }

/* Indicador: replica o aspecto de uma pílula de navegação (.seg-nav .rail-step),
   mostrando apenas o valor ativo. */
.gen-indicator {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  width: 100%;
  padding: 8px 12px;
  background: var(--paper-dim);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  cursor: pointer;
  transition: background var(--transition), color var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.gen-indicator .seg-nav-ico { font-size: 18px; line-height: 1; display: block; color: var(--line-strong); }
.gen-indicator .label {
  flex: 1;
  min-width: 0;
  font-family: var(--head);
  font-weight: 600;
  font-size: 12.5px;
  line-height: 1;
  letter-spacing: 0.01em;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gen-indicator .gen-caret { font-size: 18px; line-height: 1; color: var(--line-strong); transition: transform var(--transition); }
.gen-indicator:hover { border-color: var(--line-strong); }
.gen-indicator:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-dim); }
.gen-indicator.is-active {
  background: var(--paper);
  color: var(--accent);
  border-color: var(--accent-dim);
  box-shadow: var(--shadow);
}
.gen-indicator.is-active .label { color: var(--accent); }
.gen-indicator.is-active .seg-nav-ico { color: var(--accent); }
.gen-indicator.is-active .gen-caret { transform: rotate(180deg); color: var(--accent); }

/* Container flutuante com as demais opções (abre para cima). */
.gen-popover {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 60;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  padding: 6px;
}
.gen-popover[hidden] { display: none; }

.seg { display: flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
/* Dentro do popover a lista vira uma coluna de opções. */
.gen-popover .seg { flex-direction: column; gap: 4px; border: none; border-radius: 0; overflow: visible; }
.seg-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 7px 6px;
  border: none;
  border-right: 1px solid var(--line);
  background: var(--paper);
  cursor: pointer;
  color: var(--ink);
  transition: background var(--transition), color var(--transition);
}
.seg-btn:last-child { border-right: none; }
.seg-btn:hover { background: var(--paper-dim); }
.seg-btn.is-active { background: var(--ink); color: var(--paper); }
.gen-popover .seg-btn {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
  border-right: none;
  border-radius: calc(var(--radius) - 3px);
  padding: 8px 10px;
}
.seg-main { font-family: var(--head); font-weight: 600; font-size: 12px; }
.seg-sub { font-size: 9.5px; color: var(--line-strong); }
.seg-btn.is-active .seg-sub { color: #B8B7AE; }

.gen-btn { width: 100%; }

/* ============================================================
   ETAPA 04 — MONTAGEM DE APRESENTAÇÃO (Área ampla + Drag & Drop)
   ============================================================ */

/* Layout amplo: antes exclusivo da Etapa 04. Agora que TODAS as etapas já
   preenchem a largura à direita da barra lateral (.shell full-width), este
   modificador é neutro — mantido apenas por compatibilidade com o HTML. */
.stage-wide {
  width: auto;
  max-width: none;
  margin-left: 0;
  margin-right: 0;
  padding-left: 0;
  padding-right: 0;
}

.ppt-block { margin-bottom: 26px; }
.ppt-block .panel-head .chat-hint { font-family: var(--mono); font-size: 11px; color: var(--line-strong); }

/* ---------- BIBLIOTECA DE IMAGENS (conceitos gerados) ---------- */
.ppt-library .panel-body { padding: 18px; }
.ppt-lib-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}
.ppt-lib-item {
  position: relative;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--paper-dim);
  cursor: grab;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.ppt-lib-item:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--line-strong); }
.ppt-lib-item.is-dragging { opacity: 0.5; }
.ppt-lib-item img { display: block; width: 100%; aspect-ratio: 16/9; object-fit: cover; }
.ppt-lib-cap {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  padding: 8px 10px; font-family: var(--head); font-weight: 600; font-size: 12px; color: var(--ink);
}
.ppt-lib-grab { font-family: var(--mono); font-size: 10px; color: var(--line-strong); }
.ppt-lib-add {
  border: none; background: var(--accent); color: var(--paper);
  font-family: var(--head); font-weight: 700; font-size: 11px;
  border-radius: var(--radius); width: 22px; height: 22px; cursor: pointer; line-height: 1;
  transition: background var(--transition), transform var(--transition);
}
.ppt-lib-add:hover { background: #8F1022; transform: scale(1.08); }
.ppt-lib-used { font-family: var(--mono); font-size: 10px; color: var(--done); }

/* ---------- ORGANIZADOR DE SLIDES (trilha estilo Canva) ---------- */
.ppt-track {
  display: flex; align-items: stretch; gap: 14px;
  overflow-x: auto; padding: 20px;
  scroll-behavior: smooth;
}
.ppt-track::-webkit-scrollbar { height: 10px; }
.ppt-track::-webkit-scrollbar-thumb { background: var(--line); border-radius: var(--radius); }

.ppt-slide {
  position: relative; flex: 0 0 auto; width: 220px;
  border: 1.5px solid var(--line); border-radius: var(--radius);
  background: var(--paper); overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.ppt-slide.is-fixed { border-style: dashed; border-color: var(--line-strong); }
.ppt-slide.is-concept { cursor: grab; }
.ppt-slide.is-concept:hover { box-shadow: var(--shadow); border-color: var(--accent); }
.ppt-slide.is-dragging { opacity: 0.45; }
.ppt-slide.is-dragover { border-color: var(--accent); transform: scale(1.02); }

.ppt-slide-media { position: relative; width: 100%; aspect-ratio: 16/9; background: var(--paper-dim); }
.ppt-slide-media img { width: 100%; height: 100%; object-fit: cover; display: block; }

.ppt-slide-badge {
  position: absolute; top: 8px; left: 8px;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.04em;
  background: rgba(26,26,24,0.82); color: var(--paper);
  padding: 3px 8px; border-radius: var(--radius);
}
.ppt-slide.is-concept .ppt-slide-badge { background: var(--accent); }

.ppt-slide-del {
  position: absolute; top: 6px; right: 6px;
  width: 24px; height: 24px; border-radius: var(--radius); border: none;
  background: rgba(26,26,24,0.7); color: #fff; cursor: pointer; font-size: 14px; line-height: 1;
  opacity: 0; transition: opacity var(--transition), background var(--transition);
}
.ppt-slide:hover .ppt-slide-del { opacity: 1; }
.ppt-slide-del:hover { background: var(--accent); }

.ppt-slide-edit {
  position: absolute; bottom: 8px; right: 8px;
  border: none; border-radius: var(--radius); cursor: pointer;
  background: rgba(26,26,24,0.78); color: #fff;
  font-family: var(--head); font-weight: 600; font-size: 11px;
  padding: 5px 10px; line-height: 1;
  opacity: 0; transition: opacity var(--transition), background var(--transition);
}
.ppt-slide:hover .ppt-slide-edit { opacity: 1; }
.ppt-slide-edit:hover { background: var(--accent); }

.ppt-slide-cap { padding: 9px 11px; font-family: var(--head); font-weight: 600; font-size: 12px; color: var(--ink); }
.ppt-slide-lock { font-family: var(--mono); font-size: 10px; color: var(--line-strong); }

/* Dados do briefing sobrepostos ao slide 02 */
.ppt-brief-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(241,240,234,0.96) 0%, rgba(241,240,234,0.86) 42%, rgba(241,240,234,0) 100%);
  padding: 10px 12px; display: flex; flex-direction: column; justify-content: center; gap: 5px;
}
.ppt-brief-row { line-height: 1.15; }
.ppt-brief-row .k { display: block; font-family: var(--mono); font-size: 8px; letter-spacing: 0.06em; color: var(--accent); text-transform: uppercase; }
.ppt-brief-row .v { display: block; font-family: var(--head); font-weight: 700; font-size: 11px; color: var(--ink); }

/* Zona de soltar entre os slides fixos */
.ppt-drop {
  flex: 0 0 auto; align-self: stretch; min-width: 150px;
  display: flex; align-items: center; justify-content: center; text-align: center;
  border: 2px dashed var(--line); border-radius: var(--radius);
  color: var(--line-strong); font-size: 12px; padding: 14px; background: var(--paper-dim);
  transition: all var(--transition);
}
.ppt-drop.is-dragover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.ppt-arrow { flex: 0 0 auto; align-self: center; color: var(--line-strong); font-size: 20px; }

/* ---------- CHAT IA + DOWNLOAD ---------- */
.ppt-chat .panel-body { display: flex; flex-direction: column; }
.ppt-chat .chat-history { min-height: 180px; max-height: 360px; overflow-y: auto; margin-bottom: 14px; }
.ppt-chat .chat-msg { max-width: 100%; }
.ppt-chat-form { display: flex; gap: 10px; align-items: flex-end; }
.ppt-chat-form .chat-input { flex: 1; }

.ppt-download-wrap { margin-top: 14px; }
.ppt-file-card {
  display: flex; align-items: center; gap: 14px;
  border: 1.5px solid var(--done); background: var(--done-dim);
  border-radius: var(--radius); padding: 14px 16px;
  animation: ppt-pop 0.35s var(--transition);
}
.ppt-file-ico { font-size: 24px; }
.ppt-file-meta { flex: 1; }
.ppt-file-meta .n { font-family: var(--head); font-weight: 700; font-size: 13.5px; color: var(--ink); }
.ppt-file-meta .s { font-size: 12px; color: #545454; }
@keyframes ppt-pop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.ppt-empty { color: var(--line-strong); font-size: 13px; padding: 8px 2px; }

/* Etapa 04 — geração direta do PowerPoint */
.ppt-gen-desc { color: #545454; font-size: 13px; margin: 0 0 14px; }
.btn-lg { font-size: 13px; padding: 13px 22px; }
.ppt-gen-btn { display: inline-flex; align-items: center; gap: 8px; }
.ppt-gen-btn:disabled { opacity: 0.7; cursor: progress; }

@media (max-width: 700px) {
  .ppt-slide, .ppt-drop { width: 180px; min-width: 180px; }
  .ppt-chat-form { flex-direction: column; align-items: stretch; }
}

/* ==========================================================================
   BARRA LATERAL FIXA (dashboard) + LAYOUT PRINCIPAL
   Casca visual baseada no componente de sidebar anexado, adaptada para
   consumir as variáveis nativas do projeto (--paper, --ink, --accent,
   --line, --radius, --shadow) para parecer parte do design system.
   ========================================================================== */
.app-layout { display: flex; flex: 1; min-height: 100vh; width: 100%; }
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--paper); }

.material-symbols-rounded {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  user-select: none;
  line-height: 1;
}

/* ----- Estrutura da barra lateral ----- */
.sidebar {
  position: sticky;
  top: 0;
  align-self: flex-start;
  width: 264px;
  height: 100vh;
  display: flex;
  flex-shrink: 0;
  flex-direction: column;
  background: var(--paper);
  border-right: 1.5px solid var(--line);
  box-shadow: var(--shadow);
  transition: width var(--transition);
  z-index: 30;
}
.sidebar.collapsed { width: 84px; }

.sidebar-header {
  padding: 18px 16px;
  display: flex;
  position: relative;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  min-height: 78px;
}
.sidebar-header .header-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  display: block;
  cursor: pointer;
  border-radius: var(--radius);
  transition: opacity var(--transition);
}
.sidebar-header .header-logo:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-dim); }
.sidebar.collapsed .header-logo { opacity: 0; pointer-events: none; }

.sidebar-toggle {
  height: 38px;
  width: 38px;
  border: none;
  cursor: pointer;
  display: flex;
  position: absolute;
  right: 16px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--paper-dim);
  transition: all var(--transition);
}
.sidebar-toggle:hover { background: var(--accent-dim); color: var(--accent); }
.sidebar.collapsed .sidebar-header .sidebar-toggle { transform: translateX(-1px); height: 46px; width: 48px; }
.sidebar-header .sidebar-toggle span { font-size: 1.6rem; transition: transform var(--transition); }
.sidebar.collapsed .sidebar-toggle span { transform: rotate(180deg); }

.sidebar-content {
  flex: 1;
  padding: 18px 16px;
  overflow: hidden auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.sidebar.collapsed .sidebar-content { scrollbar-width: none; }

.search-form {
  border-radius: var(--radius);
  min-height: 46px;
  margin: 2px 0 18px;
  display: flex;
  align-items: center;
  padding: 0 13px;
  white-space: nowrap;
  background: var(--paper-dim);
  border: 1.5px solid var(--line);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.search-form:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.search-form span { color: var(--line-strong); font-size: 1.3rem; }
.search-form input {
  background: none;
  outline: none;
  border: none;
  width: 100%;
  margin-left: 12px;
  font-family: var(--body);
  font-size: 14px;
  color: var(--ink);
}
.search-form input::placeholder { color: var(--line-strong); }
/* Recolhida: mesma posição de ícone dos itens de menu (12.5px + 1.5px de borda
   = 14px, alinhando com o padding dos links, que não têm borda). */
.sidebar.collapsed .search-form { padding: 0 12.5px; }
.sidebar.collapsed .search-form input { opacity: 0; width: 0; margin: 0; }

.menu-list { display: flex; gap: 4px; list-style: none; flex-direction: column; margin: 0; padding: 0; }
.menu-link {
  display: flex;
  gap: 14px;
  white-space: nowrap;
  border-radius: var(--radius);
  padding: 11px 14px;
  align-items: center;
  text-decoration: none;
  cursor: pointer;
  color: var(--ink);
  font-family: var(--head);
  font-weight: 600;
  font-size: 14px;
  border: none;
  background: none;
  width: 100%;
  /* Só o essencial anima (cor/fundo). Padding e gap mudam de forma instantânea
     para não competir com a animação de largura da barra (evita o "pulo"). */
  transition: background var(--transition), color var(--transition);
}
.menu-link .material-symbols-rounded { font-size: 1.4rem; }
.menu-label { white-space: nowrap; overflow: hidden; transition: opacity var(--transition); }
/* Recolhida: o ícone permanece ancorado à esquerda (mesma geometria da barra
   aberta), então NÃO se move durante a transição. O rótulo apenas some. */
.sidebar.collapsed .menu-label { opacity: 0; pointer-events: none; }
.menu-link:hover { background: var(--paper-dim); }
.menu-link.active { color: #fff; background: var(--accent); }

.sidebar-footer {
  padding: 16px;
  white-space: nowrap;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sidebar-user { display: flex; align-items: center; gap: 14px; padding: 6px 14px; color: var(--line-strong); overflow: hidden; }
.sidebar-user .material-symbols-rounded { font-size: 1.4rem; }
.sidebar-user-email { font-family: var(--mono); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar.collapsed .sidebar-user-email { opacity: 0; }

.theme-toggle {
  width: 100%;
  min-height: 46px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  cursor: pointer;
  border: 1.5px solid var(--line);
  padding: 0 14px;
  white-space: nowrap;
  color: var(--ink);
  background: var(--paper-dim);
  transition: background var(--transition), border-color var(--transition);
}
.theme-toggle:hover { border-color: var(--line-strong); }
.theme-label { display: flex; gap: 10px; align-items: center; }
.theme-label .material-symbols-rounded { font-size: 1.4rem; }
.theme-text { font-family: var(--head); font-weight: 600; font-size: 13.5px; }
/* Recolhida: ícone ancorado à esquerda como os demais (12.5px + 1.5px de borda
   = 14px). O rótulo e o "trilho" somem; o trilho perde o margin-left:auto para
   não empurrar o ícone para fora do eixo vertical. */
.sidebar.collapsed .theme-toggle { padding: 0 12.5px; }
.sidebar.collapsed .theme-toggle :where(.theme-text, .theme-toggle-track) { opacity: 0; width: 0; margin: 0; overflow: hidden; }

.theme-toggle-track {
  height: 22px;
  width: 44px;
  border-radius: 999px;
  margin-left: auto;
  background: var(--line);
  position: relative;
  flex-shrink: 0;
  transition: background var(--transition);
}
body.dark-theme .theme-toggle-track { background: var(--accent); }
.theme-toggle-indicator {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: transform var(--transition);
}
body.dark-theme .theme-toggle-indicator { transform: translateX(22px); }

.menu-logout {
  display: flex;
  gap: 14px;
  align-items: center;
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--err);
  background: none;
  border: none;
  font-family: var(--head);
  font-weight: 600;
  font-size: 14px;
  transition: background var(--transition), color var(--transition);
}
.menu-logout .material-symbols-rounded { font-size: 1.4rem; }
.menu-logout:hover { background: var(--err-dim); }

/* Caixa de ícone unificada: todos os ícones da barra ocupam exatamente 24px,
   não encolhem durante a animação de largura e centralizam o glifo. É o que
   mantém o mesmo eixo vertical entre menu, busca, perfil, tema e "Sair". */
.menu-link .material-symbols-rounded,
.menu-logout .material-symbols-rounded,
.theme-label .material-symbols-rounded,
.sidebar-user .material-symbols-rounded,
.search-form span {
  min-width: 24px;
  flex-shrink: 0;
  text-align: center;
}

/* Barra superior compacta: apenas no mobile, para abrir a barra lateral. */
.site-nav {
  display: none;
  position: sticky;
  top: 0;
  z-index: 25;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: var(--paper);
  border-bottom: 1.5px solid var(--line);
}
.site-nav .sidebar-toggle { position: static; }
.site-nav .mobile-logo { width: 34px; height: 34px; object-fit: contain; }

/* ----- Responsivo: a barra lateral vira "gaveta" sobre o conteúdo ----- */
@media (max-width: 768px) {
  .app-layout { display: block; }
  .site-nav { display: flex; }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: 264px;
    z-index: 40;
    transition: left var(--transition);
  }
  .sidebar.collapsed { left: -290px; width: 264px; }
  /* Aberta no mobile, mostra sempre os rótulos por extenso. */
  .sidebar .header-logo,
  .sidebar .menu-label,
  .sidebar .theme-text { opacity: 1; }
  .sidebar .search-form input { opacity: 1; width: 100%; margin-left: 12px; }
  body:has(.sidebar:not(.collapsed))::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 35;
  }
}

/* ==========================================================================
   DARK MODE
   Redefine as variáveis de cor do design system para um esquema escuro,
   mantendo a cor da marca (--accent) em harmonia. Ativado pela classe
   .dark-theme no <body> (alternada pelo botão da barra lateral).
   ========================================================================== */
body.dark-theme {
  --ink: #F1F5F9;
  --paper: #1F2937;
  --paper-dim: #111827;
  --line: #374151;
  --line-strong: #7B8794;
  --accent: #F0455C;
  --accent-dim: #3A1D24;
  --done: #4ADE80;
  --done-dim: #16311F;
  --err: #F87171;
  --err-dim: #3A1A1A;
  --shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}

/* Fundo da página/dashboard um degrau mais escuro que os cards. */
body.dark-theme { background: var(--paper-dim); }
body.dark-theme:has(.shell) { background: var(--paper-dim); }
body.dark-theme .app-main { background: var(--paper-dim); }

/* Textos auxiliares que estavam fixos em cinza-claro ganham contraste. */
body.dark-theme .stage-desc,
body.dark-theme .intro,
body.dark-theme .page-sub,
body.dark-theme .drop-content p,
body.dark-theme .concept-desc,
body.dark-theme .ppt-gen-desc,
body.dark-theme .portfolio-body .pf-desc,
body.dark-theme .project-card .pmeta,
body.dark-theme .slide-info .stext,
body.dark-theme .export-panel .ed,
body.dark-theme .ctx-card .ctx-value,
body.dark-theme .ctx-thumb-name { color: #AEBACA; }
body.dark-theme .panel-head h3 { color: var(--ink); }

body.dark-theme .who-email { color: var(--line-strong); }

/* Botões de destaque (ex.: "+ Criar Novo Projeto", "+ Adicionar ao Portfólio"):
   no escuro o --paper fica escuro, então o texto sobre o vermelho da marca é
   forçado para branco, garantindo contraste. */
body.dark-theme .btn-accent { color: #FFFFFF; }

body.dark-theme .input-field::placeholder,
body.dark-theme .input::placeholder,
body.dark-theme .search::placeholder,
body.dark-theme .gen-input::placeholder,
body.dark-theme .chat-input::placeholder { color: #6B7684; }

/* Blocos de código do chat: fundo claro translúcido no escuro. */
body.dark-theme .chat-bubble code,
body.dark-theme .chat-bubble pre { background: rgba(255, 255, 255, 0.08); }

/* Selos/etiquetas com fundo escuro translúcido precisam de texto branco
   (no claro o --paper já era quase branco). */
body.dark-theme .ref-thumb .tag,
body.dark-theme .ppt-slide-badge,
body.dark-theme .portfolio-thumb .thumb-count,
body.dark-theme .ppt-slide-del,
body.dark-theme .pf-preview .pf-preview-del { color: #fff; }

/* Sobreposição do briefing no slide 02 (Etapa 04) acompanha o fundo escuro. */
body.dark-theme .ppt-brief-overlay {
  background: linear-gradient(90deg, rgba(31, 41, 55, 0.96) 0%, rgba(31, 41, 55, 0.86) 42%, rgba(31, 41, 55, 0) 100%);
}

/* ============================================================
   SPA — MOTOR VISUAL DE TRANSIÇÃO ÚNICO (fade-out / fade-in)
   ------------------------------------------------------------
   Usado tanto na navegação global da barra lateral (troca de
   página via fetch/DOM swap) como na troca de etapas dentro de
   um projeto. Sem spinner: apenas opacidade. A barra lateral
   permanece estática — só o conteúdo principal (#app) esmaece.
   ============================================================ */
#app { transition: opacity 0.2s ease; }
.fade-out { opacity: 0; transition: opacity 0.2s ease; }
.fade-in  { opacity: 1; }

/* ============================================================
   LIGHTBOX REUTILIZÁVEL DE MÍDIA (zoom com scroll + pan com arrasto)
   ------------------------------------------------------------
   Overlay em tela cheia acionado por qualquer elemento .zoomable-media
   (ver /assets/spa-router.js). O visual é intencionalmente escuro e
   neutro, independente do tema claro/escuro.
   ============================================================ */
/* Dica visual: elementos amplificáveis convidam ao clique. */
.zoomable-media { cursor: pointer; }

.media-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: zoom-out;                 /* clicar no fundo escuro fecha */
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}
.media-lightbox.is-open { opacity: 1; visibility: visible; }

.media-lightbox-img {
  max-width: 92vw;
  max-height: 92vh;
  object-fit: contain;
  transform-origin: center center;
  will-change: transform;
  user-select: none;
  -webkit-user-drag: none;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
  background: #111;
}

.media-lightbox-close {
  position: absolute;
  top: 18px;
  right: 22px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  line-height: 1;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  cursor: pointer;
  z-index: 2;
  transition: background 0.15s ease, transform 0.15s ease;
}
.media-lightbox-close:hover { background: rgba(255, 255, 255, 0.2); transform: scale(1.06); }
.media-lightbox-close:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.35); }

/* ============================================================
   ACERVOS — MENU EXPANSÍVEL (ACORDEÃO) NA BARRA LATERAL
   ------------------------------------------------------------
   O item "Acervos" é um <button> (não navega) que revela os
   subitens "Portfólio" e "Manuais". A navegação real acontece
   nos <a.submenu-link> (rotas da SPA). Herda todo o visual de
   .menu-link; só adiciona a seta e o painel dos subitens.
   ============================================================ */
.menu-group-toggle { justify-content: flex-start; }
.menu-group-toggle .menu-caret {
  margin-left: auto;
  font-size: 1.25rem !important;
  transition: transform var(--transition);
}
.menu-group.open > .menu-group-toggle .menu-caret { transform: rotate(180deg); }

/* Painel dos subitens: fechado por padrão, revela com transição suave. */
.submenu {
  list-style: none;
  margin: 2px 0 0;
  padding: 0 0 0 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height var(--transition), opacity var(--transition);
}
.menu-group.open > .submenu { max-height: 240px; opacity: 1; }

/* Linha vertical guia à esquerda dos subitens (leve). */
.submenu { border-left: 1.5px solid var(--line); margin-left: 18px; }
.submenu .menu-link { padding: 9px 12px; font-size: 13.5px; font-weight: 600; }
.submenu .menu-link .material-symbols-rounded { font-size: 1.2rem; }

/* Recolhida: some com os subitens e com a seta; o ícone do grupo permanece. */
.sidebar.collapsed .submenu { display: none; }
.sidebar.collapsed .menu-caret { opacity: 0; width: 0; }

/* ============================================================
   PORTFÓLIO — BLUR LOADING (carregamento preguiçoso borrado)
   ------------------------------------------------------------
   A capa nasce desfocada e revela o foco quando a imagem termina
   de carregar (classe .is-loaded adicionada via JS). O leve scale
   evita que as bordas borradas mostrem o fundo do contentor.
   ============================================================ */
.portfolio-thumb .pf-cover.blur-load {
  filter: blur(8px);
  transform: scale(1.05);
  transition: filter 0.3s ease, transform 0.3s ease;
}
.portfolio-thumb .pf-cover.is-loaded {
  filter: blur(0);
  transform: scale(1);
}

/* ============================================================
   MANUAIS — BARRA DE PESQUISA PROEMINENTE (estilo Google Drive)
   ============================================================ */
.drive-searchbar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 22px;
  margin-bottom: 26px;
  box-shadow: var(--shadow);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.drive-searchbar:focus-within { border-color: var(--ink); }
.drive-searchbar .material-symbols-rounded { color: var(--line-strong); font-size: 1.4rem; }
.drive-searchbar input {
  flex: 1;
  border: none;
  background: none;
  outline: none;
  font-family: var(--body);
  font-size: 15px;
  color: var(--ink);
}
.drive-searchbar input::placeholder { color: #A5A499; }

/* ============================================================
   MANUAIS — GRADE DE ARQUIVOS (cards de PDF elegantes)
   ============================================================ */
.manuals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.manual-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.manual-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 24px rgba(26, 26, 24, 0.08);
  border-color: var(--ink);
}
.manual-icon {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  background: var(--accent-dim);
  color: var(--accent);
}
.manual-icon .material-symbols-rounded { font-size: 1.7rem; }
.manual-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.manual-name {
  font-family: var(--head);
  font-weight: 700;
  font-size: 14.5px;
  letter-spacing: -0.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.manual-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.manual-year {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--line-strong);
  letter-spacing: 0.03em;
}
.manual-year-empty { font-style: italic; }
.manual-badge {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.02em;
  padding: 2px 7px;
  border-radius: var(--radius);
}
.manual-badge-ok { color: var(--done); background: var(--done-dim); }
.manual-badge-warn { color: #8A6D00; background: #FBF1CC; }
.manual-download {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  color: var(--line-strong);
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
}
.manual-download:hover { background: var(--paper-dim); color: var(--ink); }
.manual-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 2px; }
.manual-delete {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: var(--radius);
  color: var(--line-strong);
  transition: background var(--transition), color var(--transition);
}
.manual-delete:hover { background: var(--err-dim); color: var(--err); }
.manual-delete .material-symbols-rounded { font-size: 1.25rem; }

/* ============================================================
   MANUAIS — MODAL DE UPLOAD DE PDF
   ============================================================ */
.manual-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(26, 26, 24, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(2px);
}
.manual-modal[hidden] { display: none; }
.manual-modal-card {
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}
.manual-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}
.manual-modal-head h3 {
  font-family: var(--display);
  font-weight: 800;
  font-size: 18px;
  margin: 0;
}
.manual-modal-close {
  border: none;
  background: none;
  font-size: 26px;
  line-height: 1;
  color: var(--line-strong);
  cursor: pointer;
  padding: 0 4px;
  transition: color var(--transition);
}
.manual-modal-close:hover { color: var(--ink); }
.manual-modal-body { padding: 22px; display: flex; flex-direction: column; gap: 18px; }
.manual-modal-desc { font-size: 13.5px; color: #545454; line-height: 1.55; margin: 0; }
.manual-modal-desc code {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--paper-dim);
  padding: 1px 5px;
  border-radius: 4px;
}
.manual-selected {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-dim);
}
.manual-selected .material-symbols-rounded { color: var(--accent); }
.manual-selected-name {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.manual-selected-del {
  border: none;
  background: none;
  font-size: 20px;
  line-height: 1;
  color: var(--line-strong);
  cursor: pointer;
  transition: color var(--transition);
}
.manual-selected-del:hover { color: var(--err); }
.manual-hints { display: grid; grid-template-columns: 1fr 120px; gap: 14px; }
.manual-hints .hint-opt { color: var(--line-strong); font-weight: 400; font-size: 11px; }
@media (max-width: 480px) { .manual-hints { grid-template-columns: 1fr; } }

/* ============================================================
   BRIEFING — TAG DE STATUS DO MANUAL (cruzamento com o Acervo)
   ============================================================ */
.manual-status-badge {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.02em;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.manual-status-badge[hidden] { display: none; }
.manual-status-badge.ok { color: var(--done); background: var(--done-dim); border: 1px solid #BFD9CC; }
.manual-status-badge.warn { color: #8A6D00; background: #FBF1CC; border: 1px solid #EAD79A; }
.manual-status-badge.checking { color: var(--line-strong); background: var(--paper-dim); border: 1px solid var(--line); }

/* ============================================================
   DARK MODE — heranças do design shell wide
   ============================================================ */
body.dark-theme .drive-searchbar,
body.dark-theme .manual-card,
body.dark-theme .manual-modal-card { background: var(--paper); border-color: var(--line); }
body.dark-theme .drive-searchbar input,
body.dark-theme .manual-name { color: var(--ink); }
body.dark-theme .manual-modal-desc { color: #AEBACA; }
body.dark-theme .manual-icon { background: var(--accent-dim); color: var(--accent); }
body.dark-theme .manual-badge-warn,
body.dark-theme .manual-status-badge.warn { color: #F5D77A; background: #3A320F; border-color: #5A4E17; }
body.dark-theme .manual-selected { background: var(--paper-dim); }

/* ============================================================
   BRIEFING — INDICADOR DE MANUAL (ícone + tooltip + animação)
   ------------------------------------------------------------
   Substitui a antiga tag textual por um ícone Material Symbols:
   • A verificar  -> folder_info, amarelo, piscando suavemente (fade)
   • Encontrado   -> folder_check_2, verde, estático
   • Não encontr. -> folder_info, amarelo, estático
   ============================================================ */
@keyframes manual-fade {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.25; }
}
.manual-status-icon {
  font-size: 1.5rem;
  line-height: 1;
  cursor: help;
  user-select: none;
  vertical-align: middle;
}
.manual-status-icon[hidden] { display: none; }
/* Amarelo (âmbar) para "a verificar" e "não encontrado". */
.manual-status-icon.checking,
.manual-status-icon.not-found { color: #C79A00; }
/* Verde para "encontrado". */
.manual-status-icon.found { color: var(--done); }
/* Só o estado "a verificar" pisca. */
.manual-status-icon.checking { animation: manual-fade 1.4s ease-in-out infinite; }
body.dark-theme .manual-status-icon.checking,
body.dark-theme .manual-status-icon.not-found { color: #F5D77A; }
body.dark-theme .manual-status-icon.found { color: #7FBF9C; }

/* ============================================================
   BARRA DE CONTROLOS DA LISTA (toggle de vista + filtros)
   ------------------------------------------------------------
   Componente unificado usado em Projetos, Portfólio e Manuais.
   ============================================================ */
.list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.list-filters { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.filter-select {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.02em;
  color: var(--ink);
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 14px;
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.filter-select:hover { border-color: var(--line-strong); }
.filter-select:focus-visible {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.view-toggle {
  display: inline-flex;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--paper);
  flex: 0 0 auto;
}
.view-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 36px;
  border: none;
  background: none;
  color: var(--line-strong);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.view-btn + .view-btn { border-left: 1.5px solid var(--line); }
.view-btn:hover { background: var(--paper-dim); color: var(--ink); }
.view-btn.active { background: var(--accent); color: var(--paper); }
.view-btn .material-symbols-rounded { font-size: 1.3rem; }
body.dark-theme .filter-select,
body.dark-theme .view-toggle { background: var(--paper); border-color: var(--line); color: var(--ink); }
body.dark-theme .filter-select { color: var(--ink); }

/* ============================================================
   MODO LISTA — variações de layout das grades
   ------------------------------------------------------------
   Ativado adicionando .is-list ao contêiner .*-grid.
   ============================================================ */
.project-grid.is-list,
.portfolio-grid.is-list,
.manuals-grid.is-list {
  grid-template-columns: 1fr;
  gap: 10px;
}
/* Projetos em lista: card horizontal. */
.project-grid.is-list .project-card {
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 20px;
  padding: 14px 20px;
}
.project-grid.is-list .project-card .pname { flex: 1 1 180px; }
.project-grid.is-list .project-card .pmeta { flex: 2 1 220px; }
/* Portfólio em lista: capa à esquerda, texto à direita. */
.portfolio-grid.is-list .portfolio-card { flex-direction: row; align-items: stretch; }
.portfolio-grid.is-list .portfolio-thumb {
  flex: 0 0 200px;
  width: 200px;
  aspect-ratio: auto;
  border-bottom: none;
  border-right: 1.5px solid var(--line);
}
.portfolio-grid.is-list .portfolio-body { flex: 1; }
@media (max-width: 640px) {
  .portfolio-grid.is-list .portfolio-card { flex-direction: column; }
  .portfolio-grid.is-list .portfolio-thumb {
    flex-basis: auto; width: 100%; aspect-ratio: 4/3;
    border-right: none; border-bottom: 1.5px solid var(--line);
  }
}

/* ============================================================
   MANUAIS — AÇÃO DE EDIÇÃO + METADADOS (uploader / nº de projetos)
   ============================================================ */
.manual-edit {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: var(--radius);
  color: var(--line-strong);
  transition: background var(--transition), color var(--transition);
}
.manual-edit:hover { background: var(--paper-dim); color: var(--ink); }
.manual-edit .material-symbols-rounded { font-size: 1.2rem; }
.manual-uploader {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--line-strong);
  letter-spacing: 0.02em;
}
.manual-count {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.02em;
  padding: 2px 7px;
  border-radius: var(--radius);
  color: var(--accent);
  background: var(--accent-dim);
}
body.dark-theme .manual-count { color: #F5A3AF; background: #3A1116; }

/* ============================================================
   RESUMO DO MANUAL — botão de ação + painel lateral + Markdown
   ============================================================ */
/* Botão "Ver resumo" no card (mesma pegada visual do .manual-edit). */
.manual-summary-btn {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: var(--radius);
  color: var(--line-strong);
  transition: background var(--transition), color var(--transition);
}
.manual-summary-btn:hover { background: var(--accent-dim); color: var(--accent); }
.manual-summary-btn .material-symbols-rounded { font-size: 1.2rem; }

/* Overlay + drawer deslizante à direita. */
.manual-summary-panel {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(26, 26, 24, 0.55);
  display: flex;
  justify-content: flex-end;
  backdrop-filter: blur(2px);
}
.manual-summary-panel[hidden] { display: none; }
.manual-summary-drawer {
  width: 100%;
  max-width: 640px;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border-left: 1.5px solid var(--line);
  box-shadow: -20px 0 50px rgba(0, 0, 0, 0.30);
  animation: summarySlideIn var(--transition, 0.2s) ease;
}
@keyframes summarySlideIn {
  from { transform: translateX(24px); opacity: 0.4; }
  to   { transform: translateX(0);    opacity: 1; }
}
.manual-summary-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 24px 14px;
  border-bottom: 1px solid var(--line);
}
.manual-summary-eyebrow {
  display: block;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 4px;
}
.manual-summary-head h3 {
  font-family: var(--display);
  font-weight: 800;
  font-size: 20px;
  margin: 0;
  line-height: 1.2;
  color: var(--ink);
}
.manual-summary-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
}
.manual-summary-tool {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--paper);
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
}
.manual-summary-tool:hover { background: var(--paper-dim); border-color: var(--ink); transform: translateY(-1px); }
.manual-summary-tool .material-symbols-rounded { font-size: 1.05rem; }

/* Estado de carregamento do resumo (geração sob demanda). */
.summary-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  padding: 48px 16px;
  color: var(--line-strong);
}
.summary-loading p {
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.03em;
  color: var(--ink);
}
.summary-loading-hint {
  max-width: 340px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--line-strong);
}
.manual-summary-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 8px 24px 32px;
}

/* Tipografia do conteúdo Markdown (relatório da IA). Leitura confortável. */
.markdown-body { color: var(--ink); font-family: var(--body); font-size: 14.5px; line-height: 1.65; }
.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
  font-family: var(--display);
  font-weight: 800;
  line-height: 1.25;
  margin: 24px 0 8px;
  color: var(--ink);
}
.markdown-body h1 { font-size: 20px; }
.markdown-body h2 { font-size: 17px; }
.markdown-body h3 { font-size: 15px; }
.markdown-body h1:first-child,
.markdown-body h2:first-child,
.markdown-body h3:first-child { margin-top: 8px; }
.markdown-body p { margin: 0 0 12px; }
.markdown-body ul,
.markdown-body ol { margin: 0 0 14px; padding-left: 22px; }
.markdown-body li { margin: 4px 0; }
.markdown-body strong { font-weight: 700; color: var(--ink); }
.markdown-body code {
  font-family: var(--mono);
  font-size: 12.5px;
  background: var(--paper-dim);
  padding: 1px 5px;
  border-radius: 4px;
}
.markdown-body pre {
  background: var(--paper-dim);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  overflow-x: auto;
}
.markdown-body pre code { background: none; padding: 0; }
.markdown-body hr { border: none; border-top: 1px solid var(--line); margin: 20px 0; }
.markdown-body table { width: 100%; border-collapse: collapse; margin: 0 0 14px; font-size: 13px; }
.markdown-body th,
.markdown-body td { border: 1px solid var(--line); padding: 7px 10px; text-align: left; }
.markdown-body th { background: var(--paper-dim); font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em; }

/* Tema escuro. */
body.dark-theme .manual-summary-drawer { background: var(--paper); border-color: var(--line); }
body.dark-theme .manual-summary-head h3,
body.dark-theme .markdown-body,
body.dark-theme .markdown-body strong,
body.dark-theme .markdown-body h1,
body.dark-theme .markdown-body h2,
body.dark-theme .markdown-body h3 { color: var(--ink); }
body.dark-theme .manual-summary-tool { color: var(--ink); }
body.dark-theme .manual-summary-btn:hover { background: var(--accent-dim); color: var(--accent); }

@media (max-width: 560px) {
  .manual-summary-drawer { max-width: 100%; }
  .manual-summary-head { padding: 16px 18px 12px; }
  .manual-summary-tools,
  .manual-summary-body { padding-left: 18px; padding-right: 18px; }
}

/* ============================================================
   PROPOSTAS — FORMULÁRIO DE NOVA PROPOSTA + HISTÓRICO
   ------------------------------------------------------------
   Herda inteiramente o tema do site: todas as cores saem das
   variáveis (--ink / --paper / --paper-dim / --line / --accent),
   por isso o Modo Escuro funciona sem regras duplicadas. Só os
   poucos casos que precisam de contraste extra no escuro têm
   override explícito no fim do bloco.
   ============================================================ */
.proposal-panel { margin-bottom: 28px; }
.proposal-panel:last-child { margin-bottom: 0; }
.proposal-head-hint {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--line-strong);
}
.proposal-panel .hint-opt { color: var(--line-strong); font-weight: 400; font-size: 11px; text-transform: none; letter-spacing: 0; }

/* Acessibilidade: rótulo só para leitores de ecrã. */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Campos em duas colunas (quatro nas "Informações da proposta"), uma só no
   telemóvel. `.span-all` é para os campos que ocupam a linha toda. */
.proposal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.proposal-grid > * { min-width: 0; }
.proposal-grid.is-quad { grid-template-columns: repeat(4, 1fr); }
.proposal-grid .span-all { grid-column: 1 / -1; }
@media (max-width: 980px) { .proposal-grid.is-quad { grid-template-columns: 1fr 1fr; } }
@media (max-width: 720px) {
  .proposal-grid,
  .proposal-grid.is-quad { grid-template-columns: 1fr; }
}

.proposal-hint-text {
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--line-strong);
  margin: 0 0 14px;
}

/* ---- Campos em destaque ----
   Nesta área os campos SÃO o conteúdo, não um detalhe do painel: recebem o
   fundo --paper-dim para se lerem como caixas preenchíveis e, ao focar,
   clareiam para --paper — o contraste mostra onde se está a escrever.
   Dentro dos blocos que já têm fundo próprio (totais, forma de pagamento) o
   campo faz o inverso, para não desaparecer no fundo. */
#proposal-form .input-field { background: var(--paper-dim); }
#proposal-form .input-field:focus { background: var(--paper); border-color: var(--ink); }
#proposal-form .proposal-disc-inp,
#proposal-form .proposal-pgbox .input-field { background: var(--paper); }
#proposal-form .proposal-pgbox .input-field:focus { border-color: var(--accent); }

/* Memorial e afins: as caixas de texto esticam só para baixo — o arraste
   horizontal quebraria a grelha de duas colunas. */
#proposal-form textarea.input-field { resize: vertical; }

/* ---- Foto / render do projeto (upload + pré-visualização) ---- */
.proposal-upload {
  display: block;
  position: relative;
  padding: 0;
  background: var(--paper-dim);
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  overflow: hidden;
  transition: border-color var(--transition), background var(--transition);
}
.proposal-upload:hover { border-color: var(--accent); background: var(--accent-dim); }
.proposal-upload:focus-within { border-color: var(--accent); }
.proposal-upload-ph {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 170px;
  padding: 24px 18px;
  text-align: center;
}
.proposal-upload-ph .material-symbols-rounded { font-size: 34px; color: var(--accent); }
.proposal-upload-title { font-family: var(--head); font-weight: 700; font-size: 14px; color: var(--ink); }
.proposal-upload-sub {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--line-strong);
}
.proposal-upload-img {
  display: block;
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  background: var(--paper);
}
.proposal-upload-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.proposal-upload-name { font-size: 12.5px; color: var(--line-strong); overflow-wrap: anywhere; }

/* ---- Memorial: campos personalizados ---- */
.proposal-custom-wrap { margin-top: 6px; padding-top: 16px; border-top: 1px solid var(--line); }
.proposal-custom-head {
  display: block;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--line-strong);
  margin-bottom: 12px;
}
.proposal-cfield {
  display: grid;
  grid-template-columns: minmax(0, 220px) minmax(0, 1fr) 36px;
  gap: 10px;
  align-items: start;
  margin-bottom: 12px;
}
.proposal-cfield .input-field { margin: 0; }
.proposal-cfield .pr-row-del { margin-top: 2px; }
@media (max-width: 720px) {
  .proposal-cfield { grid-template-columns: minmax(0, 1fr) 36px; }
  .proposal-cfield .proposal-cfield-label { grid-column: 1 / -1; }
}
.proposal-add-custom { margin-top: 2px; }

/* ---- Proposta de valor: um cartão por item ----
   Os campos ganham rótulo e caixa iguais aos do resto do formulário,
   em vez de células de tabela apertadas, e o cartão inteiro reage ao
   foco para se ver logo em qual item se está a escrever. */
.proposal-items { display: flex; flex-direction: column; gap: 12px; }
.proposal-item {
  padding: 16px 18px 4px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.proposal-item:focus-within { border-color: var(--line-strong); box-shadow: var(--shadow); }
.proposal-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.proposal-item-num {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.proposal-item-grid .input-group { margin-bottom: 14px; }
/* Números alinhados à direita, como saem no documento. */
.proposal-item-grid input[type="number"] { text-align: right; font-family: var(--mono); font-size: 13px; }

/* Adicionar item: a mesma caixa tracejada do upload de render. */
.proposal-add-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin: 12px 0 24px;
  padding: 13px 16px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--line-strong);
  background: var(--paper-dim);
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
}
.proposal-add-item:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-dim); }
.proposal-add-item .material-symbols-rounded { font-size: 18px; }

.pr-row-del {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--line-strong);
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
}
.pr-row-del:hover { color: var(--err); border-color: var(--err); background: var(--err-dim); }
.pr-row-del .material-symbols-rounded { font-size: 20px; }

/* Quadro de totais: cartão destacado, recalculado a cada tecla. */
.proposal-totbox {
  margin: 0 0 22px auto;
  max-width: 360px;
  padding: 16px 20px;
  background: var(--paper-dim);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.proposal-totlist { margin: 0; }
.proposal-totline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 5px 0;
}
.proposal-totline dt {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--line-strong);
}
.proposal-totline dd { margin: 0; font-family: var(--mono); font-size: 13.5px; color: var(--ink); }
.proposal-disc-inp { margin: 0; width: 110px; text-align: right; font-family: var(--mono); }
.proposal-totline.is-total {
  border-top: 1.5px solid var(--ink);
  margin-top: 8px;
  padding-top: 12px;
  align-items: baseline;
}
.proposal-tot-label {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink);
}
.proposal-tot-value { font-family: var(--display); font-size: 22px; font-weight: 800; color: var(--accent); }

/* Forma de pagamento — destacada com a cor da marca, como no documento. */
.proposal-pgbox {
  padding: 18px 20px;
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
}
.proposal-pgbox-title {
  display: block;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}

.proposal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 28px;
}
.proposal-actions .btn { display: inline-flex; align-items: center; gap: 6px; }
.proposal-actions .material-symbols-rounded { font-size: 18px; }

/* ---- Histórico de propostas ---- */
.proposal-history { display: flex; flex-direction: column; gap: 10px; }
.proposal-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}
.proposal-row:hover { border-color: var(--accent); box-shadow: var(--shadow); transform: translateY(-1px); }
.proposal-row-icon { color: var(--accent); font-size: 26px; flex-shrink: 0; }
.proposal-row-main { display: flex; flex-direction: column; gap: 5px; min-width: 0; flex: 1; }
.proposal-row-title {
  font-family: var(--head);
  font-weight: 700;
  font-size: 14.5px;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.proposal-row-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  font-size: 12px;
  color: var(--line-strong);
}
.proposal-tag {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 2px 7px;
}
.proposal-row-total {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  flex-shrink: 0;
}
.proposal-row-actions { display: flex; gap: 6px; flex-shrink: 0; }
.proposal-act {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--line-strong);
  cursor: pointer;
  text-decoration: none;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
}
.proposal-act:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-dim); }
.proposal-act.is-danger:hover { color: var(--err); border-color: var(--err); background: var(--err-dim); }
.proposal-act .material-symbols-rounded { font-size: 20px; }

@media (max-width: 720px) {
  .proposal-row { flex-wrap: wrap; }
  .proposal-row-total { order: 3; }
  .proposal-row-actions { order: 4; margin-left: auto; }
}

/* ---- Pré-visualização do documento ----
   O que está dentro da moldura é o PDF a sério, mostrado num <iframe>
   pelo leitor do navegador. A moldura (cabeçalho, rodapé, fundo) segue o
   tema do site. */
.proposal-preview {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: rgba(26, 26, 24, 0.55);
  opacity: 0;
  transition: opacity var(--transition);
}
.proposal-preview.active { opacity: 1; }
.proposal-preview[hidden] { display: none; }
.proposal-preview-dialog {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 860px;
  height: 100%;
  max-height: 100%;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.proposal-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.proposal-preview-label {
  font-family: var(--head);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
}
.proposal-preview-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--line-strong);
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
}
.proposal-preview-close:hover { color: var(--err); border-color: var(--err); background: var(--err-dim); }
/* Atalho para quem não tem leitor de PDF embutido no navegador. */
.proposal-preview-open {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--line-strong);
  text-decoration: none;
  transition: color var(--transition);
}
.proposal-preview-open:hover { color: var(--accent); }
.proposal-preview-open .material-symbols-rounded { font-size: 16px; }
.proposal-preview-open[hidden] { display: none; }
.proposal-preview-scroll {
  flex: 1;
  display: flex;
  min-height: 0;
  padding: 0;
  background: var(--paper-dim);
}
/* O documento em si: ocupa toda a área útil da moldura. */
.proposal-preview-frame {
  flex: 1;
  width: 100%;
  min-height: 60vh;
  border: 0;
  background: var(--paper-dim);
}
.proposal-preview-frame[hidden] { display: none; }
.proposal-preview-msg {
  margin: auto;
  padding: 40px 24px;
  text-align: center;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: var(--line-strong);
}
.proposal-preview-msg[hidden] { display: none; }
.proposal-preview-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
}
.proposal-preview-foot .btn { display: inline-flex; align-items: center; gap: 6px; }
.proposal-preview-foot .material-symbols-rounded { font-size: 18px; }
@media (max-width: 720px) {
  .proposal-preview { padding: 0; }
  .proposal-preview-dialog { max-width: none; height: 100%; border-radius: 0; border: 0; }
  .proposal-preview-label { font-size: 11px; }
}

/* Tema escuro: os poucos textos que ficavam fixos em cinza-claro. */
body.dark-theme .proposal-upload-name,
body.dark-theme .proposal-hint-text,
body.dark-theme .proposal-row-meta,
body.dark-theme .proposal-totline dt { color: #AEBACA; }
body.dark-theme .proposal-upload { background: var(--paper-dim); }
body.dark-theme .proposal-preview { background: rgba(10, 13, 20, 0.65); }
body.dark-theme .proposal-preview-dialog { background: #202634; border-color: #2C3444; }
body.dark-theme .proposal-preview-head,
body.dark-theme .proposal-preview-foot { border-color: #2C3444; }
body.dark-theme .proposal-preview-scroll,
body.dark-theme .proposal-preview-frame { background: #171C26; }
body.dark-theme .proposal-preview-msg { color: #AEBACA; }
body.dark-theme .proposal-preview-close { background: #202634; border-color: #2C3444; }
body.dark-theme .proposal-act:hover { color: var(--accent); }
body.dark-theme .proposal-act.is-danger:hover,
body.dark-theme .pr-row-del:hover { color: var(--err); }
