/* DESK by AllBridge — mesmos tokens do Meu Dólar (regra de 10/01: todos os apps iguais).
   Estilo Attio: quase tudo neutro, um destaque amarelo só no que é ação principal. */
:root {
  --paper: #FBF9F5; --surface: #FFFFFF; --surface2: #F4EFE6; --ink: #1A1814; --muted: #665E53;
  --line: #E9E2D6; --accent: #EFBA2E; --accent-ink: #8A6300; --chip: #FBF0CF; --chip-ink: #7A5700;
  --pos: #04754F; --neg: #C7302B; --shadow: 0 1px 2px rgba(26, 24, 20, .06);
  --serif: "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #151310; --surface: #1D1A16; --surface2: #26221C; --ink: #F5F1E8; --muted: #ABA292;
    --line: #302B24; --accent-ink: #F2C94C; --chip: #3A3014; --chip-ink: #F2C94C;
    --pos: #22C55E; --neg: #EF4444; --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #151310; --surface: #1D1A16; --surface2: #26221C; --ink: #F5F1E8; --muted: #ABA292;
  --line: #302B24; --accent-ink: #F2C94C; --chip: #3A3014; --chip-ink: #F2C94C;
  --pos: #22C55E; --neg: #EF4444; --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--ink); font: 14px/1.45 var(--sans); }
a { color: var(--accent-ink); }
button, input, select { font: inherit; color: inherit; }
.serif { font-family: var(--serif); font-weight: 500; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 18px; padding: 28px; display: flex; flex-direction: column; gap: 16px; box-shadow: var(--shadow); }
.login-card img { width: 160px; height: 160px; border-radius: 14px; align-self: center; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.field input { min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); color: var(--ink); }
.field input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.erro { color: var(--neg); font-size: 13px; min-height: 1em; }

/* ---------- botões ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px;
  padding: 0 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 500; }
a.btn { text-decoration: none; }
.btn:hover { background: var(--surface2); }
.btn.p { background: var(--accent); border-color: var(--accent); color: #1A1814; font-weight: 600; }
.btn.p:hover { filter: brightness(.97); }
.btn.big { min-height: 44px; }

/* ---------- casca ---------- */
.app { display: flex; flex-wrap: wrap; min-height: 100vh; }
.side { flex: 1 1 210px; max-width: 100%; background: var(--surface); border-right: 1px solid var(--line);
  padding: 20px 12px; display: flex; flex-direction: column; gap: 2px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 18px; }
.brand img { width: 34px; height: 34px; border-radius: 8px; }
.brand b { display: block; font-family: var(--serif); font-weight: 500; font-size: 19px; letter-spacing: .2em; line-height: 1; }
.brand small { display: block; font-size: 9.5px; letter-spacing: .16em; color: var(--muted); margin-top: 3px; }
.nav { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 12px; border-radius: 8px; color: var(--muted);
  text-decoration: none; font-weight: 500; border: 0; background: none; cursor: pointer; text-align: left; width: 100%; }
.nav:hover, .nav.on { background: var(--surface2); color: var(--ink); }
.nav .n { margin-left: auto; font-size: 12px; color: var(--muted); font-weight: 400; }
.nav .breve { margin-left: auto; font-size: 10.5px; color: var(--muted); }
.side .rodape { margin-top: auto; padding: 12px 8px 0; font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }
.side .rodape button { background: none; border: 0; padding: 0; color: var(--accent-ink); cursor: pointer; text-align: left; }
main { flex: 999 1 560px; min-width: 0; padding: 28px 32px; display: flex; flex-direction: column; gap: 18px; }
@media (max-width: 760px) { main { padding: 20px 16px; } .side { border-right: 0; border-bottom: 1px solid var(--line); } }

.topo { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.topo h1 { margin: 0; font-family: var(--serif); font-weight: 500; font-size: 32px; }
.ferr { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.busca { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px; border: 1px solid var(--line);
  border-radius: 12px; background: var(--surface); color: var(--muted); }
.busca input { border: 0; background: transparent; outline: none; color: var(--ink); width: 200px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chipbtn { min-height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: transparent;
  color: var(--muted); cursor: pointer; font-size: 13px; font-weight: 500; }
.chipbtn.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); min-height: 36px; padding: 0 12px; cursor: pointer; color: var(--muted); }
.seg button.on { background: var(--surface2); color: var(--ink); font-weight: 600; }

/* ---------- tabela ---------- */
.caixa { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: auto; box-shadow: var(--shadow); }
table { border-collapse: collapse; width: 100%; min-width: 760px; }
th { position: sticky; top: 0; background: var(--surface); text-align: left; font-size: 12px; font-weight: 600; color: var(--muted);
  padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
tbody tr { cursor: pointer; }
tbody tr:hover td { background: var(--surface2); }
tr:last-child td { border-bottom: 0; }
.nome { font-weight: 500; }
.chip { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 500;
  background: var(--surface2); color: var(--muted); }
.chip.a { background: var(--chip); color: var(--chip-ink); }
.chip.ok { color: var(--pos); }
.chip.ruim { color: var(--neg); }
.vazio { padding: 40px 16px; text-align: center; color: var(--muted); }
.mais { padding: 10px 14px; color: var(--muted); font-size: 13px; }

/* ---------- kanban ---------- */
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 6px; align-items: flex-start; }
.col { flex: 0 0 260px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px;
  display: flex; flex-direction: column; gap: 8px; max-height: 70vh; overflow-y: auto; }
.colh { display: flex; justify-content: space-between; font-weight: 600; font-size: 13px; padding: 4px 4px 6px; position: sticky; top: -10px; background: var(--surface); }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer;
  display: flex; flex-direction: column; gap: 4px; text-align: left; width: 100%; }
.card:hover { border-color: var(--muted); }
.card small { color: var(--muted); font-size: 12px; }

/* ---------- ficha ---------- */
.veu { position: fixed; inset: 0; background: rgba(10, 9, 7, .35); display: flex; justify-content: flex-end; z-index: 10; }
.ficha { width: min(520px, 100%); height: 100%; background: var(--surface); border-left: 1px solid var(--line); overflow-y: auto;
  padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.ficha h2 { margin: 0; font-family: var(--serif); font-weight: 500; font-size: 26px; }
.campos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.campos div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.campos span { font-size: 12px; color: var(--muted); }
.campos b { font-weight: 500; overflow-wrap: anywhere; }
.bloco { display: flex; flex-direction: column; gap: 8px; }
.bloco h3 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.apol { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.apol .l1 { display: flex; justify-content: space-between; gap: 8px; }
.fechar { align-self: flex-end; }
.carregando { padding: 60px 0; text-align: center; color: var(--muted); }

/* ---------- funil (estilo Attio: neutro, cor só na faixa/bolinha da fase) ---------- */
.fboard { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 8px; align-items: flex-start; }
.fcol { flex: 0 0 256px; background: var(--surface2); border: 1px solid var(--line); border-top: 3px solid var(--fase); border-radius: 10px;
  padding: 10px; display: flex; flex-direction: column; gap: 8px; max-height: 75vh; overflow-y: auto; }
.fcol.sobre { outline: 2px dashed var(--fase); outline-offset: -2px; }
.fcolh { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; padding: 2px 4px; position: sticky; top: -10px; background: var(--surface2); z-index: 1; }
.fcolh::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--fase); flex: none; }
.fcolh .muted { margin-left: auto; font-weight: 500; font-size: 12px; }
.fsub { display: flex; flex-direction: column; gap: 2px; padding: 6px 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; font-size: 12px; color: var(--muted); }
.fsub div { display: flex; justify-content: space-between; } .fsub b { color: var(--ink); font-weight: 500; }
.fcards { display: flex; flex-direction: column; gap: 6px; }
.fcard { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; display: flex; flex-direction: column; gap: 5px;
  box-shadow: var(--shadow); cursor: grab; text-align: left; }
.fcard:hover { border-color: var(--muted); } .fcard.arrasto { opacity: .4; }
.fcard .nome { font-size: 13px; } .fcard small { font-size: 11px; }
.fchip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 500; background: var(--surface2); color: var(--ink); align-self: flex-start; }
.fchip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--fase); }
.link { background: none; border: 0; color: var(--accent-ink); cursor: pointer; font: inherit; padding: 0 4px; }
.ficha select, .apol select { min-height: 32px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); padding: 0 8px; }
