/* DirectFellas v2 — design system baseado no Plane (makeplane/plane):
   bordas sutis, radius 4/6/8, sombras raised quase imperceptíveis, Inter 13px,
   accent usado com moderação. Marca DF: vermelho #cc0000, wordmark Lency.
   Tema claro é o padrão; [data-tema="escuro"] inverte. */

@font-face {
  font-family: 'Lency';
  src: url('/assets/optilency.otf') format('opentype');
  font-display: swap;
}

:root {
  /* fundo (Plane light) */
  --canvas: #eff0f0;
  --surface: #ffffff;
  --surface-2: #fafafa;
  --layer-1: #f4f5f5;
  --layer-2: #ffffff;
  --layer-3: #eff0f0;
  --hover-trans: rgba(0, 0, 0, 0.05);
  --active-trans: rgba(0, 0, 0, 0.09);
  /* borda */
  --border: #eaebeb;
  --border-2: #dadcdd;
  /* texto */
  --txt-1: #1d1f20;
  --txt-2: #4e5355;
  --txt-3: #676c6f;
  --txt-4: #80868a;
  /* marca */
  --accent: #cc0000;
  --accent-hover: #a80000;
  --accent-soft: rgba(204, 0, 0, 0.08);
  --on-accent: #ffffff;
  /* estados da esteira */
  --st-pendente: #a3a3a2;
  --st-rodando: #f59e0b;
  --st-validado: #16a34a;
  --st-nao-validado: #dc2626;
  --st-escala: #3f76ff;
  /* apoio */
  --verde: #16a34a; --ambar: #f59e0b; --perigo: #dc2626;
  --sombra-raised: 0px 1px 6px -1px rgba(41, 47, 61, 0.03), 0px 1px 4px 0px rgba(41, 47, 61, 0.04);
  --sombra-raised-2: 0px 2px 4px -1px rgba(41, 47, 61, 0.04), 0px 4px 6px -1px rgba(41, 47, 61, 0.05);
  --sombra-overlay: 0px 10px 10px -10px rgba(41, 47, 61, 0.04), 0px 30px 60px -12px rgba(41, 47, 61, 0.10);
  --fonte: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

[data-tema="escuro"] {
  --canvas: #0e0f10;
  --surface: #141515;
  --surface-2: #181a1b;
  --layer-1: #181a1b;
  --layer-2: #1e2021;
  --layer-3: #222425;
  --hover-trans: rgba(255, 255, 255, 0.05);
  --active-trans: rgba(255, 255, 255, 0.09);
  --border: #222425;
  --border-2: #36393a;
  --txt-1: #e4e6e7;
  --txt-2: #cacdce;
  --txt-3: #afb3b6;
  --txt-4: #80868a;
  --accent: #ff5b59;
  --accent-hover: #ff7a78;
  --accent-soft: rgba(255, 91, 89, 0.12);
  --st-escala: #6c95f2;
  --sombra-raised: 0px 1px 6px -1px rgba(0, 0, 0, 0.3), 0px 1px 4px 0px rgba(0, 0, 0, 0.3);
  --sombra-raised-2: 0px 2px 4px -1px rgba(0, 0, 0, 0.35), 0px 4px 6px -1px rgba(0, 0, 0, 0.35);
  --sombra-overlay: 0px 10px 10px -10px rgba(0, 0, 0, 0.4), 0px 30px 60px -12px rgba(0, 0, 0, 0.6);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--fonte);
  font-size: 13px;
  line-height: 1.4;
  color: var(--txt-1);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
svg { display: block; }
.oculto { display: none !important; }
.mono { font-family: var(--mono); }
.wordmark { font-family: 'Lency', 'Cinzel', serif; letter-spacing: 0.02em; }
.wordmark b { color: var(--accent); font-weight: inherit; }

/* ── Layout: sidebar + main ─────────────────────────────────────────────── */
.app { display: flex; min-height: 100vh; }
.side {
  width: 250px; flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 12px 8px 10px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.side-marca { padding: 2px 8px 14px; font-size: 17px; }
.side-link {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 8px; border-radius: 6px;
  font-size: 13px; font-weight: 500; color: var(--txt-2);
  line-height: 20px; width: 100%; text-align: left;
}
.side-link:hover { background: var(--hover-trans); }
.side-link.ativo { background: var(--active-trans); color: var(--txt-1); }
.side-link svg { width: 16px; height: 16px; stroke-width: 1.7; flex-shrink: 0; color: var(--txt-3); }
.side-link .trunca { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-sec { margin-top: 16px; }
.side-tit {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 8px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em; color: var(--txt-4);
}
.side-tit button { color: var(--txt-4); border-radius: 4px; padding: 1px; }
.side-tit button:hover { background: var(--hover-trans); color: var(--txt-2); }
.side-ponto { width: 8px; height: 8px; border-radius: 3px; flex-shrink: 0; }
.side-esticar { flex: 1; }
.side-user {
  display: flex; align-items: center; gap: 8px;
  padding: 8px; border-top: 1px solid var(--border); margin-top: 10px;
}
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* topbar (52px, como o header do Plane) */
.top {
  height: 52px; flex-shrink: 0;
  display: flex; align-items: center; gap: 10px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 30;
}
.top .migalha { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; color: var(--txt-3); min-width: 0; }
.top .migalha .atual { color: var(--txt-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top .sep { color: var(--txt-4); }
.top-acoes { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.burger { display: none; padding: 6px; border-radius: 6px; color: var(--txt-2); }
.burger:hover { background: var(--hover-trans); }
.burger svg { width: 18px; height: 18px; }

.conteudo { padding: 20px; max-width: 1400px; width: 100%; }

/* ── Abas ───────────────────────────────────────────────────────────────── */
.tabs {
  display: flex; gap: 2px; overflow-x: auto;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  padding: 0 20px;
  position: sticky; top: 52px; z-index: 25;
}
.tab {
  padding: 9px 12px 8px; font-size: 13px; font-weight: 500;
  color: var(--txt-3); border-bottom: 2px solid transparent;
  white-space: nowrap; display: flex; align-items: center; gap: 6px;
}
.tab:hover { color: var(--txt-1); }
.tab.ativa { color: var(--txt-1); border-bottom-color: var(--accent); }
.tab .n {
  font-size: 11px; font-weight: 600; color: var(--txt-3);
  background: var(--layer-1); border-radius: 999px; padding: 1px 7px;
}

/* ── Botões ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 30px; padding: 0 14px; border-radius: 4px;
  font-size: 13px; font-weight: 500;
  background: var(--accent); color: var(--on-accent);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn:hover { background: var(--accent-hover); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-sec {
  background: var(--surface); color: var(--txt-2);
  border: 1px solid var(--border-2);
}
.btn-sec:hover { background: var(--surface-2); color: var(--txt-1); }
.btn-ghost { background: transparent; color: var(--txt-3); }
.btn-ghost:hover { background: var(--hover-trans); color: var(--txt-1); }
.btn-perigo { background: transparent; color: var(--perigo); border: 1px solid var(--perigo); }
.btn-perigo:hover { background: rgba(220, 38, 38, 0.08); }
.btn-sm { height: 26px; padding: 0 10px; font-size: 11px; }
.btn svg { width: 14px; height: 14px; stroke-width: 2; }

/* ── Inputs ─────────────────────────────────────────────────────────────── */
.campo { display: flex; flex-direction: column; gap: 4px; }
.rotulo { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--txt-3); }
.input, .select, .textarea {
  height: 32px; padding: 0 10px; border-radius: 4px;
  border: 1px solid var(--border-2); background: var(--surface);
  font-size: 13px; color: var(--txt-1); width: 100%;
}
.textarea { height: auto; min-height: 84px; padding: 8px 10px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.input::placeholder, .textarea::placeholder { color: var(--txt-4); }
.select { appearance: none; padding-right: 26px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2380868a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; }
.erro-campo { font-size: 12px; color: var(--perigo); }

/* célula editável (herança da v1, look Plane: invisível até hover/focus) */
.cel {
  background: transparent; border: 1px solid transparent; border-radius: 4px;
  padding: 3px 6px; font-size: 13px; color: var(--txt-1);
  width: 100%; min-width: 60px;
}
.cel:hover { border-color: var(--border-2); }
.cel:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }
select.cel { appearance: none; cursor: pointer; }
.cel-salvo { animation: flash-ok 0.9s ease-out; }
@keyframes flash-ok { 0% { background: rgba(22, 163, 74, 0.18); } 100% { background: transparent; } }

/* ── Tabela (spreadsheet do Plane: header sticky, linhas 44px, borda fina) ─ */
.tbl-wrap {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; overflow: auto; max-height: 72vh;
}
.tbl { width: 100%; border-collapse: collapse; min-width: 720px; }
.tbl th {
  position: sticky; top: 0; z-index: 5;
  height: 40px; padding: 0 12px; text-align: left;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--txt-3); background: var(--layer-1);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.tbl td {
  height: 44px; padding: 4px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px; color: var(--txt-2); vertical-align: middle;
}
.tbl tbody tr { transition: background 0.1s; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .titulo-cel { color: var(--txt-1); font-weight: 500; }
.tbl .num { text-align: right; font-family: var(--mono); font-size: 12px; }

/* ── Pills de estado (esteira) ──────────────────────────────────────────── */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 9px; border-radius: 999px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
  background: var(--layer-1); color: var(--txt-2);
  border: 1px solid var(--border);
}
.pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--txt-4); }
.pill-pendente::before { background: var(--st-pendente); }
.pill-rodando { color: #b45309; border-color: rgba(245, 158, 11, 0.4); background: rgba(245, 158, 11, 0.08); }
.pill-rodando::before { background: var(--st-rodando); }
.pill-validado { color: #15803d; border-color: rgba(22, 163, 74, 0.4); background: rgba(22, 163, 74, 0.08); }
.pill-validado::before { background: var(--st-validado); }
.pill-nao_validado { color: var(--txt-3); }
.pill-nao_validado::before { background: var(--st-nao-validado); }
.pill-escala { color: #2c5cd8; border-color: rgba(63, 118, 255, 0.4); background: rgba(63, 118, 255, 0.08); }
.pill-escala::before { background: var(--st-escala); }
[data-tema="escuro"] .pill-rodando { color: #fbbf24; }
[data-tema="escuro"] .pill-validado { color: #4ade80; }
[data-tema="escuro"] .pill-escala { color: #93b4ff; }

.tag {
  display: inline-flex; align-items: center; height: 20px; padding: 0 8px;
  border-radius: 4px; font-size: 11px; font-weight: 600;
  background: var(--layer-1); border: 1px solid var(--border); color: var(--txt-3);
}
.tag-vermelha { color: var(--accent); border-color: var(--accent-soft); background: var(--accent-soft); }
.tag-verde { color: #15803d; border-color: rgba(22, 163, 74, 0.25); background: rgba(22, 163, 74, 0.08); }

/* ── Kanban (colunas 320px, cards radius 8, sombra raised) ──────────────── */
.board { display: flex; gap: 16px; align-items: flex-start; overflow-x: auto; padding-bottom: 16px; }
.col { width: 320px; flex-shrink: 0; }
.col-head {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 4px; position: sticky; top: 0;
  font-size: 13px; font-weight: 600; color: var(--txt-1);
}
.col-head .n { font-size: 13px; font-weight: 500; color: var(--txt-3); }
.col-cards { display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.cartao {
  background: var(--layer-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px; font-size: 13px;
  box-shadow: var(--sombra-raised);
  transition: border-color 0.15s, box-shadow 0.15s;
  cursor: pointer; display: block; width: 100%; text-align: left;
}
.cartao:hover { border-color: var(--border-2); box-shadow: var(--sombra-raised-2); }
.cartao .titulo { color: var(--txt-1); font-weight: 500; font-size: 13px; margin-bottom: 6px; }
.cartao .props { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; color: var(--txt-3); font-size: 11px; }

/* ── Cards genéricos / grade ────────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 16px; box-shadow: var(--sombra-raised);
}
.card-tit { font-size: 13px; font-weight: 600; color: var(--txt-1); display: flex; align-items: center; gap: 8px; }
.grade { display: grid; gap: 12px; }
.kicker { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--txt-4); }
.meta { font-size: 12px; color: var(--txt-3); }
.linha { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ── Avatares ───────────────────────────────────────────────────────────── */
.avatar {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700; color: #101014;
  background: var(--layer-3); text-transform: uppercase;
}

/* ── Checkbox "feito" do junior ─────────────────────────────────────────── */
.chk {
  width: 18px; height: 18px; border-radius: 4px;
  border: 1.5px solid var(--border-2); background: var(--surface);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.12s; flex-shrink: 0;
}
.chk svg { width: 12px; height: 12px; stroke-width: 3; color: #fff; opacity: 0; }
.chk.on { background: var(--verde); border-color: var(--verde); }
.chk.on svg { opacity: 1; }
.chk:disabled { opacity: 0.4; cursor: default; }

/* ── Peek panel (detalhe de tarefa, estilo Plane side-peek) ─────────────── */
.scrim {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(16, 18, 20, 0.4);
}
.peek {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 70;
  width: min(560px, 100vw);
  background: var(--surface); border-left: 1px solid var(--border);
  box-shadow: 0px 4px 8px 0px rgba(0,0,0,0.12), 0px 6px 12px 0px rgba(16,24,40,0.12), 0px 1px 16px 0px rgba(16,24,40,0.12);
  display: flex; flex-direction: column;
  animation: peek-in 0.18s ease-out;
}
@keyframes peek-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.peek-head {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.peek-corpo { padding: 20px 24px; overflow-y: auto; flex: 1; }
.peek-titulo { font-size: 16px; font-weight: 600; color: var(--txt-1); line-height: 1.35; }
.peek-desc {
  margin-top: 14px; font-size: 13px; color: var(--txt-2);
  white-space: pre-wrap; line-height: 1.6;
}
.peek-props { margin-top: 20px; display: grid; grid-template-columns: 120px 1fr; gap: 10px 12px; align-items: center; }
.peek-props .p-rotulo { font-size: 12px; color: var(--txt-3); display: flex; align-items: center; gap: 6px; }
.peek-props .p-rotulo svg { width: 14px; height: 14px; stroke-width: 1.7; }

/* ── Modal ──────────────────────────────────────────────────────────────── */
.modal-fundo {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(16, 18, 20, 0.45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 9vh 16px 16px; overflow-y: auto;
}
.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: var(--sombra-overlay);
  width: 100%; max-width: 480px; padding: 20px;
  display: flex; flex-direction: column; gap: 14px;
}
.modal h3 { font-size: 15px; font-weight: 600; }

/* ── Toast ──────────────────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  z-index: 100; padding: 10px 18px; border-radius: 8px;
  background: var(--txt-1); color: var(--canvas);
  font-size: 13px; font-weight: 500; box-shadow: var(--sombra-overlay);
  max-width: 92vw;
}
.toast.sucesso { background: var(--verde); color: #fff; }
.toast.erro { background: var(--perigo); color: #fff; }

/* ── Acordeão (escola do tráfego) ───────────────────────────────────────── */
.acordeao { border: 1px solid var(--border); border-radius: 8px; background: var(--surface); overflow: hidden; }
.acordeao + .acordeao { margin-top: 8px; }
.acordeao summary {
  list-style: none; cursor: pointer; padding: 12px 16px;
  font-size: 13px; font-weight: 600; color: var(--txt-1);
  display: flex; align-items: center; gap: 8px;
}
.acordeao summary::-webkit-details-marker { display: none; }
.acordeao summary::before { content: '›'; color: var(--txt-4); font-size: 15px; transition: transform 0.15s; }
.acordeao[open] summary::before { transform: rotate(90deg); }
.acordeao .corpo { padding: 0 16px 14px 34px; font-size: 13px; color: var(--txt-2); line-height: 1.65; white-space: pre-line; }

/* seções colapsáveis (pós-teste arquivados etc.) */
.sec-head {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 6px 2px; font-size: 13px; font-weight: 600; color: var(--txt-1);
  user-select: none;
}
.sec-head .n { color: var(--txt-3); font-weight: 500; }
.sec-head .caret { transition: transform 0.15s; color: var(--txt-4); }
.sec-head.fechada .caret { transform: rotate(-90deg); }

/* ── Login ──────────────────────────────────────────────────────────────── */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }

/* ── Responsivo: sidebar off-canvas ─────────────────────────────────────── */
@media (max-width: 900px) {
  .side {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 90;
    transform: translateX(-100%); transition: transform 0.22s ease;
    box-shadow: var(--sombra-overlay); height: 100dvh;
  }
  .app.side-aberta .side { transform: none; }
  .side-scrim { position: fixed; inset: 0; z-index: 85; background: rgba(16, 18, 20, 0.4); display: none; }
  .app.side-aberta .side-scrim { display: block; }
  .burger { display: inline-flex; }
  .conteudo { padding: 14px; }
  .tabs { padding: 0 8px; }
  .peek { width: 100vw; }
  .peek-props { grid-template-columns: 104px 1fr; }
}
