/* ============================================================================
   Design System — Orquestrador +TOP  ·  "Instrumento de precisão"
   Neutros quentes (greige) · azul-tinta de marca · cor = estado do sistema.
   Complementa o Tailwind (theme.js). Carregar depois do custom.css.
   ============================================================================ */

:root {
  --ground: #F4F2ED;
  --surface: #FCFBF8;
  --raised: #FFFFFF;
  --ink: #1C1B18;
  --ink-2: #57534E;
  --ink-muted: #6B6760; /* passa WCAG AA (~5:1) sobre surface/ground — texto secundário legível */
  --line: #E7E3DA;
  --line-2: #DAD5C9;
  --tinta: #1D3D5C;
  --tinta-700: #142C43;
  --tinta-500: #2C557D;
  --tinta-50: #EEF2F6;
  --valor: #1E6B4F;
  --valor-soft: #E4F0EA;
  --gate: #B4791F;
  --gate-soft: #F7EEDD;
  --bloqueio: #A23B2E;
  --bloqueio-soft: #F6E5E2;
  --shadow-card: 0 1px 2px rgba(28,27,24,.04), 0 1px 3px rgba(28,27,24,.06);
  --shadow-raised: 0 2px 8px rgba(28,27,24,.06), 0 8px 24px rgba(28,27,24,.06);
}

body { background: var(--ground); color: var(--ink); -webkit-font-smoothing: antialiased; }

/* ─── Tipografia: números como protagonistas ──────────────────────────────
   Num sistema que paga pontos, os dígitos são a identidade. */
.num        { font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.num-hero   { font-variant-numeric: tabular-nums; font-weight: 650; letter-spacing: -0.02em; line-height: 1; }
.mono       { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-variant-numeric: tabular-nums; }
.eyebrow    { font-size: 11px; font-weight: 650; letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-muted); }

/* ─── App shell: navegação persistente (acaba com "páginas soltas") ───────── */
.app-shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.app-nav {
  background: var(--tinta-700); color: #DDE6EF;
  display: flex; flex-direction: column; gap: 2px;
  padding: 20px 14px; position: sticky; top: 0; height: 100vh;
}
.app-nav .brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 20px; }
.app-nav .brand-mark {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  background: linear-gradient(135deg, #2C557D, #1D3D5C);
  display: grid; place-items: center; color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12);
}
.app-nav .brand-name { font-weight: 700; font-size: 15px; color: #fff; line-height: 1.1; letter-spacing: -0.01em; }
.app-nav .brand-name b { color: #7FB0DE; font-weight: 800; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; border-radius: 8px; font-size: 14px; font-weight: 500;
  color: #B9C6D6; text-decoration: none; transition: background .12s, color .12s;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: rgba(127,176,222,.16); color: #fff; }
.nav-item svg { width: 18px; height: 18px; flex: none; opacity: .9; }
.nav-foot { margin-top: auto; border-top: 1px solid rgba(255,255,255,.1); padding-top: 12px; }

.app-main { min-width: 0; display: flex; flex-direction: column; }
.app-topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 28px; border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: blur(6px);
  position: sticky; top: 0; z-index: 20;
}
.app-content { padding: 26px 28px 64px; max-width: 1180px; width: 100%; margin: 0 auto; }

/* ─── Cards com HIERARQUIA (não mais "tudo branco igual") ──────────────────── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-card); }
.card-flat { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.card-raised { background: var(--raised); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-raised); }
/* Card que exige AÇÃO do usuário (gate pendente) — o momento de responsabilidade */
.card-gate { background: var(--raised); border: 1px solid color-mix(in srgb, var(--gate) 40%, var(--line)); border-radius: 12px; box-shadow: var(--shadow-raised); position: relative; overflow: hidden; }
.card-gate::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--gate); }

/* ─── Stat tile (KPI) — 1 métrica principal pode ganhar destaque real ─────── */
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 15px 17px; }
.stat .label { font-size: 12.5px; color: var(--ink-2); margin-bottom: 6px; }
.stat .value { font-size: 27px; }
.stat .sub { font-size: 11.5px; color: var(--ink-muted); margin-top: 3px; }
.stat.hero .value { font-size: 40px; }

/* ─── Pills de estado (semântica contida, sem arco-íris) ──────────────────── */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; padding: 3px 10px 3px 9px; border-radius: 999px; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; flex: none; }
.pill-valor { background: var(--valor-soft); color: var(--valor-ink, #12503A); } .pill-valor::before { background: var(--valor); }
.pill-gate { background: var(--gate-soft); color: var(--gate-ink, #7A5011); } .pill-gate::before { background: var(--gate); }
.pill-bloqueio { background: var(--bloqueio-soft); color: var(--bloqueio-ink, #7A2B21); } .pill-bloqueio::before { background: var(--bloqueio); }
.pill-proc { background: var(--tinta-50); color: var(--tinta); } .pill-proc::before { background: var(--tinta-500); animation: pulse-soft 1.4s ease-in-out infinite; }
.pill-neutro { background: #EFECE4; color: var(--ink-2); } .pill-neutro::before { background: var(--ink-muted); }

/* ─── Botões ──────────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-size: 14px; font-weight: 600; padding: 9px 15px; border-radius: 8px; border: 1px solid transparent; cursor: pointer; transition: background .12s, border-color .12s, color .12s; white-space: nowrap; }
.btn:focus-visible { outline: none; box-shadow: var(--shadow-focus, 0 0 0 3px rgba(29,61,92,.25)); }
.btn-primary { background: var(--tinta); color: #fff; } .btn-primary:hover { background: var(--tinta-700); }
.btn-valor { background: var(--valor); color: #fff; } .btn-valor:hover { background: var(--valor-ink, #12503A); }
.btn-ghost { background: transparent; color: var(--ink-2); border-color: var(--line-2); } .btn-ghost:hover { background: #EFECE4; color: var(--ink); }
.btn-quiet { background: transparent; color: var(--ink-2); padding: 7px 10px; } .btn-quiet:hover { background: #EFECE4; color: var(--ink); }
.btn-danger-quiet { background: transparent; color: var(--ink-muted); padding: 7px 10px; } .btn-danger-quiet:hover { background: var(--bloqueio-soft); color: var(--bloqueio); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-sm { font-size: 13px; padding: 6px 11px; }

/* ─── SIGNATURE: trilha de orquestração ───────────────────────────────────────
   Distingue passo-de-IA (○) · decisão-humana-no-gate (◆, âmbar) · concluído (●).
   É a verdade central do produto: LLM decide, humano aprova, determinístico executa. */
.trilha { display: flex; align-items: flex-start; gap: 0; overflow-x: auto; padding: 4px 2px; }
.trilha-passo { display: flex; flex-direction: column; align-items: center; gap: 7px; min-width: 82px; flex: 1; position: relative; }
.trilha-no { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; border: 2px solid var(--line-2); background: var(--surface); color: var(--ink-muted); z-index: 1; }
.trilha-conn { position: absolute; top: 17px; left: 50%; width: 100%; height: 2px; background: var(--line-2); z-index: 0; }
.trilha-label { font-size: 11.5px; font-weight: 600; color: var(--ink-muted); text-align: center; line-height: 1.2; }
.trilha-tipo { font-size: 9.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-muted); }
/* estados */
.trilha-passo.feito .trilha-no { background: var(--valor); border-color: var(--valor); color: #fff; }
.trilha-passo.feito .trilha-conn { background: var(--valor); }
.trilha-passo.feito .trilha-label { color: var(--ink-2); }
.trilha-passo.gate .trilha-no { background: var(--gate); border-color: var(--gate); color: #fff; box-shadow: 0 0 0 4px var(--gate-soft); }
.trilha-passo.gate .trilha-label { color: var(--gate-ink, #7A5011); font-weight: 700; }
.trilha-passo.proc .trilha-no { background: var(--tinta); border-color: var(--tinta); color: #fff; animation: pulse-soft 1.4s ease-in-out infinite; }
.trilha-passo.proc .trilha-label { color: var(--tinta); }
/* nós de gate são losangos: decisão humana ≠ passo automático */
.trilha-passo.is-gate .trilha-no { border-radius: 8px; transform: rotate(45deg); }
.trilha-passo.is-gate .trilha-no > * { transform: rotate(-45deg); }

/* Tabelas de dados — densas, legíveis, números alinhados */
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-muted); font-weight: 650; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.data-table td { padding: 9px 12px; border-bottom: 1px solid var(--line); }
.data-table td.num, .data-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table tr:last-child td { border-bottom: none; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ─── Responsivo: shell colapsa, trilha compacta ──────────────────────────── */
@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .app-nav { position: fixed; inset: 0 auto 0 0; z-index: 50; transform: translateX(-100%); transition: transform .2s; width: 232px; height: 100dvh; }
  .app-nav.open { transform: translateX(0); }
  .app-content { padding: 18px 16px 56px; }
  .app-topbar { padding: 12px 16px; }
  .trilha-passo { min-width: 74px; }
  .trilha-no { width: 30px; height: 30px; }
  .stat.hero .value { font-size: 32px; }
}
