/* CONSULTOR RAIZ — estilos. Sem dependências externas, só stack de fontes do sistema. */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #eef1f4;
  --text: #1c2430;
  --muted: #5b6675;
  --border: #dfe4ea;
  --accent: #14532d;
  --accent-2: #166534;
  --accent-soft: #e6f2e9;
  --urgente: #b91c1c;
  --urgente-soft: #fdecec;
  --importante: #b45309;
  --importante-soft: #fdf3e3;
  --evolucao: #15803d;
  --evolucao-soft: #e7f6ec;
  --grey: #94a3b8;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 4px 16px rgba(16, 24, 40, .06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--accent-2); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
img, svg { max-width: 100%; }

.container { max-width: 960px; margin: 0 auto; padding: 0 16px 64px; }
.narrow { max-width: 640px; }

/* Header */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.topbar-inner {
  max-width: 960px; margin: 0 auto; padding: 12px 16px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  width: 40px; height: 40px; flex: 0 0 40px; border-radius: 12px;
  background: var(--accent); color: #fff; display: grid; place-items: center;
  font-weight: 800; font-size: 20px;
}
.brand h1 { font-size: 18px; margin: 0; line-height: 1.2; letter-spacing: .2px; }
.brand p { margin: 0; font-size: 12px; color: var(--muted); }
.topbar-spacer { flex: 1; }
.user-chip { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }

/* Tabs */
.tabs {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin: 16px 0 4px;
}
.tab {
  border: 1px solid var(--border); background: var(--surface);
  border-radius: 999px; padding: 8px 14px; font-size: 14px; font-weight: 600;
  color: var(--text);
}
.tab[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Cards / generic */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; margin-top: 16px;
}
.card h2 { margin: 0 0 6px; font-size: 20px; }
.card h3 { margin: 0 0 8px; font-size: 16px; }
.card p { margin: 8px 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.lead { font-size: 17px; color: #334155; }
.tagline { font-size: 15px; color: var(--muted); margin-top: 4px; }
.hero { text-align: left; }
.hero h2 { font-size: 26px; line-height: 1.25; }
.pillar-tag {
  display: inline-block; font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .4px; padding: 3px 8px; border-radius: 999px; background: var(--surface-2);
}
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
}
.badge.local { background: #eef1f4; color: #475569; }
.badge.ia { background: var(--accent-soft); color: var(--accent); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; }

.priority { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.priority.urgente { background: var(--urgente-soft); color: var(--urgente); }
.priority.importante { background: var(--importante-soft); color: var(--importante); }
.priority.evolucao { background: var(--evolucao-soft); color: var(--evolucao); }
.priority.sem { background: var(--surface-2); color: var(--muted); }

/* Forms */
label { display: block; font-weight: 600; font-size: 14px; margin: 14px 0 6px; }
label .hint { display: block; font-weight: 400; color: var(--muted); font-size: 13px; margin-top: 2px; }
input[type="text"], input[type="email"], input[type="password"], input[type="date"], textarea, select {
  width: 100%; padding: 11px 12px; border: 1px solid var(--border); border-radius: 10px;
  background: #fff; color: var(--text); font-size: 15px;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.char-count { font-size: 12px; color: var(--muted); text-align: right; margin-top: 4px; }
.char-count.invalid { color: var(--urgente); font-weight: 600; }

.btn {
  display: inline-block; border: none; border-radius: 10px; padding: 12px 18px;
  font-weight: 700; font-size: 15px; background: var(--accent); color: #fff;
  text-decoration: none; text-align: center;
}
.btn:hover { background: #0f3d21; }
.btn:disabled { opacity: .55; cursor: wait; }
.btn.secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn.ghost { background: transparent; color: var(--accent-2); padding: 8px 10px; }
.btn.danger { background: #fff; color: var(--urgente); border: 1px solid #f0c4c4; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.btn-row .btn { flex: 1 1 auto; }
.link-btn { background: none; border: none; color: var(--accent-2); font-weight: 600; padding: 6px 0; text-decoration: underline; }

.steps { display: flex; gap: 8px; margin: 16px 0 4px; }
.step-dot {
  flex: 1; height: 6px; border-radius: 999px; background: var(--border);
}
.step-dot.active { background: var(--accent); }
.step-label { font-size: 13px; color: var(--muted); margin-bottom: 4px; }

/* Disclaimer */
.disclaimer {
  background: #fff8e6; border: 1px solid #f0d48a; border-radius: 12px;
  padding: 14px 16px; font-size: 13px; color: #5b4a12; margin-top: 16px;
}
.disclaimer strong { color: #4a3a0e; }
footer.site-footer {
  max-width: 960px; margin: 32px auto 0; padding: 20px 16px 32px;
  border-top: 1px solid var(--border); font-size: 13px; color: var(--muted);
}

/* Lists */
.list { list-style: none; margin: 8px 0 0; padding: 0; }
.list li { padding: 10px 0; border-top: 1px solid var(--border); }
.list li:first-child { border-top: none; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--border); font-size: 14px; }
.kv:first-child { border-top: none; }

/* Pillar colours */
.pillar-mental { --pc: #7c3aed; }
.pillar-emocional { --pc: #db2777; }
.pillar-pessoal { --pc: #0891b2; }
.pillar-financeiro { --pc: #059669; }
.pillar-empresarial { --pc: #4f46e5; }
.pillar-estrategico { --pc: #b45309; }
.pillar-execucao { --pc: #dc2626; }

/* Mind map */
.map-wrap { overflow-x: auto; }
.map-svg { display: block; width: 100%; min-width: 340px; height: auto; }
.map-node { cursor: pointer; }
.map-node circle.node-bg { fill: #fff; stroke: var(--pc, var(--grey)); stroke-width: 2.5; }
.map-node.selected circle.node-bg { stroke-width: 4; filter: drop-shadow(0 2px 6px rgba(0,0,0,.18)); }
.map-node text { font-family: var(--font); font-size: 12px; font-weight: 700; fill: var(--text); text-anchor: middle; }
.map-node .node-sub { font-size: 10px; font-weight: 600; fill: var(--muted); }
.map-center circle { fill: var(--accent); }
.map-center text { fill: #fff; font-weight: 800; font-size: 14px; text-anchor: middle; }
.map-center .map-center-sub { font-size: 10px; font-weight: 600; fill: #d1fae5; }
.map-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-top: 10px; }
.map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* Tasks */
.task {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 0; border-top: 1px solid var(--border);
}
.task:first-child { border-top: none; }
.task input[type="checkbox"] { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--accent); flex: 0 0 auto; }
.task-body { flex: 1; min-width: 0; }
.task-title { font-weight: 700; margin: 0; }
.task.done .task-title { text-decoration: line-through; color: var(--muted); }
.task-meta { font-size: 13px; color: var(--muted); margin: 4px 0 0; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.task-actions { margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; }
.task-actions button { font-size: 13px; padding: 6px 10px; }
.unblock-box {
  margin-top: 10px; background: var(--surface-2); border-radius: 10px; padding: 12px;
  font-size: 14px;
}
.unblock-box ul { margin: 8px 0 0; padding-left: 18px; }
.reason-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.reason-btn {
  border: 1px solid var(--border); background: #fff; border-radius: 10px;
  padding: 10px; font-size: 14px; text-align: left; font-weight: 600;
}
.reason-btn[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

/* Chat */
.chat-log { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; max-height: 420px; overflow-y: auto; padding-right: 4px; }
.chat-msg { max-width: 85%; padding: 10px 12px; border-radius: 12px; font-size: 14px; white-space: pre-wrap; }
.chat-msg.user { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.chat-msg.assistant { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 4px; }
.chat-msg .chat-engine { display: block; font-size: 11px; opacity: .75; margin-top: 6px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.chip {
  border: 1px solid var(--border); background: #fff; border-radius: 999px;
  padding: 7px 12px; font-size: 13px; font-weight: 600;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chat-form { display: flex; gap: 8px; margin-top: 12px; }
.chat-form input { flex: 1; }

/* Progress */
.progress { height: 12px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin: 10px 0 6px; }
.progress > div { height: 100%; background: var(--accent); border-radius: 999px; transition: width .3s ease; }
.history-item {
  display: flex; gap: 12px; align-items: flex-start; width: 100%; text-align: left;
  background: none; border: none; border-top: 1px solid var(--border); padding: 14px 0;
}
.history-item:first-child { border-top: none; }
.history-item:hover .history-summary { color: var(--accent-2); }
.history-summary { font-weight: 600; margin: 0; }
.history-meta { font-size: 13px; color: var(--muted); margin: 2px 0 0; }

/* Alerts / states */
.alert { border-radius: 10px; padding: 12px 14px; font-size: 14px; margin-top: 12px; }
.alert.error { background: var(--urgente-soft); color: #7f1d1d; border: 1px solid #f0c4c4; }
.alert.success { background: var(--evolucao-soft); color: #14532d; border: 1px solid #bfe6c8; }
.alert.info { background: #eef4ff; color: #1e3a5f; border: 1px solid #c8d9f5; }
.empty { color: var(--muted); font-size: 14px; padding: 12px 0; }
.loading { color: var(--muted); padding: 24px 0; text-align: center; }
.hidden { display: none !important; }
blockquote {
  margin: 12px 0; padding: 12px 16px; border-left: 4px solid var(--accent);
  background: var(--accent-soft); border-radius: 0 10px 10px 0; font-style: italic;
}
blockquote cite { display: block; font-style: normal; font-size: 13px; color: var(--muted); margin-top: 6px; }
.detail-panel { border-top: 1px solid var(--border); margin-top: 14px; padding-top: 14px; }
.detail-panel h3 { margin-top: 0; }

/* Auth toggle */
.auth-toggle { display: flex; gap: 6px; margin-top: 8px; }
.auth-toggle button {
  flex: 1; border: 1px solid var(--border); background: var(--surface-2);
  padding: 10px; border-radius: 10px; font-weight: 700;
}
.auth-toggle button[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }

@media (max-width: 560px) {
  .card { padding: 16px; }
  .hero h2 { font-size: 22px; }
  .reason-grid { grid-template-columns: 1fr; }
  .chat-msg { max-width: 92%; }
  .btn-row .btn { flex-basis: 100%; }
  .user-chip { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .progress > div { transition: none; }
}

/* Admin — estatísticas e tabelas */
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px; margin-top: 16px;
}
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px;
}
.stat-value { font-size: 26px; font-weight: 800; line-height: 1.1; }
.stat-label { font-size: 13px; color: var(--muted); margin-top: 4px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th, .data-table td { text-align: left; padding: 10px 8px; border-top: 1px solid var(--border); vertical-align: top; }
.data-table thead th { border-top: none; color: var(--muted); font-size: 13px; }
.data-table { display: block; overflow-x: auto; }
.data-table table { width: 100%; }
@media (max-width: 560px) {
  .data-table { font-size: 13px; }
}
