:root {
  --bg: #0e0f13;
  --bg-elevated: #1a1b22;
  --bg-input: #21222b;
  --border: #2e2f3a;
  --text: #e8e8ec;
  --text-dim: #9a9ba8;
  --accent: #ff7a30;
  --accent-hover: #e8661e;
  --accent-soft: rgba(255, 122, 48, 0.16);
  --azul: #3b6fe0;
  --azul-soft: rgba(59, 111, 224, 0.18);
  --success: #4caf82;
  --warning: #d9a441;
  --error: #e0605a;
  --sidebar-width: 264px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ---------------------------------------------------------------------- */
/* Sidebar                                                                  */
/* ---------------------------------------------------------------------- */

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  padding: 6px 8px 20px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.logo span {
  color: var(--text);
}

.logo b {
  color: var(--accent);
  font-weight: 800;
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  background: none;
  border: none;
  color: var(--text-dim);
  padding: 11px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  text-align: left;
  width: 100%;
}

.nav-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.nav-btn:hover {
  background: var(--bg-input);
  color: var(--text);
}

.nav-btn.active {
  background: var(--accent);
  color: white;
  font-weight: 600;
}

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.user-nome {
  font-size: 13px;
  font-weight: 600;
}

.user-sub {
  font-size: 11px;
  color: var(--text-dim);
}

/* ---------------------------------------------------------------------- */
/* Main area                                                                */
/* ---------------------------------------------------------------------- */

.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  border-bottom: 1px solid var(--border);
}

header .status {
  font-size: 13px;
  color: var(--text-dim);
}

.bell {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.bell svg {
  width: 17px;
  height: 17px;
}

main {
  padding: 24px 28px;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  flex: 1;
}

.app-footer {
  padding: 16px 28px;
  font-size: 12px;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ---------------------------------------------------------------------- */
/* Dashboard                                                                */
/* ---------------------------------------------------------------------- */

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon svg {
  width: 20px;
  height: 20px;
}

.stat-icon.laranja {
  background: var(--accent);
  color: white;
}

.stat-icon.azul {
  background: var(--azul);
  color: white;
}

.stat-icon.claro {
  background: var(--text);
  color: var(--bg);
}

.stat-label {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 2px;
}

.stat-value {
  font-size: 22px;
  font-weight: 700;
}

.dashboard-columns {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 16px;
  align-items: start;
}

.panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}

.panel h2 {
  margin: 0 0 4px 0;
  font-size: 16px;
}

.link-ver-todos {
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
}

.link-ver-todos:hover {
  text-decoration: underline;
}

.timeline-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.timeline-item:last-child {
  border-bottom: none;
}

.timeline-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.timeline-icon svg {
  width: 16px;
  height: 16px;
}

.timeline-texto {
  flex: 1;
  min-width: 0;
}

.timeline-titulo {
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-sub {
  font-size: 12px;
  color: var(--text-dim);
}

.timeline-data {
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
}

.sugestao-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.sugestao-item:last-child {
  border-bottom: none;
}

.sugestao-texto {
  font-size: 13px;
  margin-bottom: 6px;
  line-height: 1.4;
}

.sugestao-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sugestao-tag {
  font-size: 11px;
  color: var(--text-dim);
}

/* ---------------------------------------------------------------------- */
/* Formulários / cards genéricos (Chat, Pesquisa, Segundo Cérebro etc.)     */
/* ---------------------------------------------------------------------- */

input[type="text"],
input[type="password"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}

textarea {
  resize: vertical;
  min-height: 60px;
}

button.primary {
  background: var(--accent);
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
}

button.primary:hover {
  background: var(--accent-hover);
}

button.primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

button.secondary {
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}

button.secondary:hover {
  border-color: var(--accent);
}

button.perigo {
  background: transparent;
  color: var(--error);
  border: 1px solid var(--error);
  padding: 10px 18px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}

button.perigo:hover {
  background: rgba(224, 96, 90, 0.1);
}

button.perigo:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
}

.card h3 {
  margin: 0 0 8px 0;
  font-size: 15px;
}

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  margin-right: 6px;
}

.tag.gatilho {
  background: var(--accent-soft);
  color: #ffb27a;
}

.tag.estrutura {
  background: rgba(76, 175, 130, 0.2);
  color: #7fd6ac;
}

.tag.status-aprovado {
  background: rgba(76, 175, 130, 0.2);
  color: #7fd6ac;
}

.tag.status-pendente {
  background: rgba(217, 164, 65, 0.2);
  color: #e8bd6f;
}

.bloco {
  border-left: 3px solid var(--accent);
  padding: 8px 12px;
  margin-bottom: 10px;
  background: var(--bg-input);
  border-radius: 0 6px 6px 0;
}

.bloco .nome {
  font-weight: 600;
  color: var(--accent);
  font-size: 13px;
  margin-bottom: 4px;
}

.bloco .texto {
  font-size: 14px;
  line-height: 1.5;
}

.analise {
  border: 1px dashed var(--border);
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--text-dim);
  background: var(--accent-soft);
}

.analise-titulo {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.contador {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  background: var(--bg-input);
}

.contador.ok {
  color: var(--success);
}

.contador.aviso {
  color: var(--warning);
}

.loading {
  color: var(--text-dim);
  font-size: 13px;
  padding: 12px 0;
}

.erro {
  color: var(--error);
  font-size: 13px;
  padding: 10px 14px;
  background: rgba(224, 96, 90, 0.1);
  border: 1px solid rgba(224, 96, 90, 0.3);
  border-radius: 6px;
  margin: 10px 0;
}

.form-row {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.form-row input {
  flex: 1;
}

label {
  display: block;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.field {
  margin-bottom: 14px;
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

.subsecao {
  margin-bottom: 24px;
}

.acoes-roteiro {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.revisao-roteiro {
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 20px;
}

.revisao-roteiro .acoes-revisao {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.subsecao h2 {
  font-size: 16px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.pequeno {
  font-size: 12px;
  color: var(--text-dim);
}

@media (max-width: 860px) {
  .app-shell {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }
  .sidebar nav {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .stats-row,
  .dashboard-columns {
    grid-template-columns: 1fr;
  }
}

/* ---------------------------------------------------------------------- */
/* Autenticação (login, cadastro, onboarding) — páginas fora da SPA         */
/* ---------------------------------------------------------------------- */

.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
}

.auth-card.largo {
  max-width: 560px;
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 24px;
}

.auth-logo span {
  color: var(--text);
}

.auth-logo b {
  color: var(--accent);
  font-weight: 800;
}

.auth-card h1 {
  font-size: 20px;
  margin: 0 0 6px 0;
}

.auth-card .subtitulo {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 24px;
}

.auth-rodape {
  margin-top: 18px;
  font-size: 13px;
  color: var(--text-dim);
  text-align: center;
}

.auth-rodape a {
  color: var(--accent);
  text-decoration: none;
}

.auth-rodape a:hover {
  text-decoration: underline;
}
